def main(args): global start_time if not args.host: logger.info('No readers specified.') return 0 # special case default Tari values tari = args.tari if args.modulation in Modulation_DefaultTari: t_suggested = Modulation_DefaultTari[args.modulation] if args.tari: logger.warn('recommended Tari for %s is %d', args.modulation, t_suggested) else: tari = t_suggested logger.info('selected recommended Tari of %d for %s', args.tari, args.modulation) enabled_antennas = [int(x.strip()) for x in args.antennas.split(',')] antmap = { host: { str(ant): 'Antenna {}'.format(ant) for ant in enabled_antennas } for host in args.host } logger.info('Antenna map: %s', antmap) # d.callback will be called when all connections have terminated normally. # use d.addCallback(<callable>) to define end-of-program behavior. d = defer.Deferred() d.addCallback(finish) factory_args = dict( onFinish=d, duration=args.time, report_every_n_tags=args.every_n, antenna_dict=antmap, tx_power=args.tx_power, modulation=args.modulation, tari=tari, session=args.session, mode_identifier=args.mode_identifier, tag_population=args.population, start_inventory=True, disconnect_when_done=args.time and args.time > 0, reconnect=args.reconnect, tag_content_selector={ 'EnableROSpecID': False, 'EnableSpecIndex': False, 'EnableInventoryParameterSpecID': False, 'EnableAntennaID': False, 'EnableChannelIndex': True, 'EnablePeakRSSI': False, 'EnableFirstSeenTimestamp': False, 'EnableLastSeenTimestamp': True, 'EnableTagSeenCount': True, 'EnableAccessSpecID': False }, impinj_search_mode=args.impinj_search_mode, impinj_tag_content_selector=None, ) if args.impinj_reports: factory_args['impinj_tag_content_selector'] = { 'EnableRFPhaseAngle': True, 'EnablePeakRSSI': False, 'EnableRFDopplerFrequency': False } fac = LLRPClientFactory(**factory_args) # tag_report_cb will be called every time the reader sends a TagReport # message (i.e., when it has "seen" tags). fac.addTagReportCallback(tag_report_cb) for host in args.host: if ':' in host: host, port = host.split(':', 1) port = int(port) else: port = args.port reactor.connectTCP(host, port, fac, timeout=3) # catch ctrl-C and stop inventory before disconnecting reactor.addSystemEventTrigger('before', 'shutdown', shutdown, fac) # start runtime measurement to determine rates start_time = monotonic() reactor.run()
map(lambda x: int(x.strip()), args.antennas.split(','))) # Create Clients and set them to connect fac = LLRPClientFactory(report_every_n_tags=args.every_n, antennas=enabled_antennas, tx_power=args.tx_power, modulation=args.modulation, start_inventory=True, tari=args.tari, tag_content_selector={ 'EnableROSpecID': True, 'EnableSpecIndex': True, 'EnableInventoryParameterSpecID': True, 'EnableAntennaID': True, 'EnableChannelIndex': True, 'EnablePeakRRSI': True, 'EnableFirstSeenTimestamp': True, 'EnableLastSeenTimestamp': True, 'EnableTagSeenCount': True, 'EnableAccessSpecID': True, }) fac.addTagReportCallback(tag_seen_callback) for host in args.host: reactor.connectTCP(host, args.port, fac, timeout=3) reactor.addSystemEventTrigger('before', 'shutdown', polite_shutdown, fac) # Start server & connect to readers reactor.run()
def main(args): global start_time if not args.host: logger.info('No readers specified.') return 0 # special case default Tari values if args.modulation in Modulation_DefaultTari: t_suggested = Modulation_DefaultTari[args.modulation] if args.tari: logger.warn('recommended Tari for %s is %d', args.modulation, t_suggested) else: args.tari = t_suggested logger.info('selected recommended Tari of %d for %s', args.tari, args.modulation) enabled_antennas = map(lambda x: int(x.strip()), args.antennas.split(',')) # d.callback will be called when all connections have terminated normally. # use d.addCallback(<callable>) to define end-of-program behavior. d = defer.Deferred() d.addCallback(finish) fac = LLRPClientFactory(onFinish=d, duration=args.time, report_every_n_tags=args.every_n, antennas=enabled_antennas, tx_power=args.tx_power, modulation=args.modulation, tari=args.tari, session=args.session, mode_index=args.mode_index, mode_identifier=args.mode_identifier, tag_population=args.population, start_inventory=True, disconnect_when_done=(args.time > 0), reconnect=args.reconnect, tag_content_selector={ 'EnableROSpecID': False, 'EnableSpecIndex': False, 'EnableInventoryParameterSpecID': False, 'EnableAntennaID': True, 'EnableChannelIndex': False, 'EnablePeakRRSI': True, 'EnableFirstSeenTimestamp': False, 'EnableLastSeenTimestamp': True, 'EnableTagSeenCount': True, 'EnableAccessSpecID': False }) # tag_report_cb will be called every time the reader sends a TagReport # message (i.e., when it has "seen" tags). fac.addTagReportCallback(tag_report_cb) for host in args.host: if ':' in host: host, port = host.split(':', 1) port = int(port) else: port = args.port reactor.connectTCP(host, port, fac, timeout=3) # catch ctrl-C and stop inventory before disconnecting reactor.addSystemEventTrigger('before', 'shutdown', shutdown, fac) # start runtime measurement to determine rates start_time = time.time() reactor.run()
map(lambda x: int(x.strip()), args.antennas.split(','))) # Create Clients and set them to connect fac = LLRPClientFactory(report_every_n_tags=args.every_n, antennas=enabled_antennas, tx_power=args.tx_power, modulation=args.modulation, start_inventory=True, tari=args.tari, tag_content_selector={ 'EnableROSpecID': True, 'EnableSpecIndex': True, 'EnableInventoryParameterSpecID': True, 'EnableAntennaID': True, 'EnableChannelIndex': True, 'EnablePeakRSSI': True, 'EnableFirstSeenTimestamp': True, 'EnableLastSeenTimestamp': True, 'EnableTagSeenCount': True, 'EnableAccessSpecID': True, }) fac.addTagReportCallback(tag_seen_callback) for host in args.host: reactor.connectTCP(host, args.port, fac, timeout=3) reactor.addSystemEventTrigger('before', 'shutdown', polite_shutdown, fac) # Start server & connect to readers reactor.run()
def main(args): global start_time if not args.host: logger.info('No readers specified.') return 0 # special case default Tari values tari = args.tari if args.modulation in Modulation_DefaultTari: t_suggested = Modulation_DefaultTari[args.modulation] if args.tari: logger.warn('recommended Tari for %s is %d', args.modulation, t_suggested) else: tari = t_suggested logger.info('selected recommended Tari of %d for %s', args.tari, args.modulation) enabled_antennas = [int(x.strip()) for x in args.antennas.split(',')] antmap = { host: { str(ant): 'Antenna {}'.format(ant) for ant in enabled_antennas } for host in args.host } logger.info('Antenna map: %s', antmap) # d.callback will be called when all connections have terminated normally. # use d.addCallback(<callable>) to define end-of-program behavior. d = defer.Deferred() d.addCallback(finish) factory_args = dict( onFinish=d, duration=args.time, report_every_n_tags=args.every_n, antenna_dict=antmap, tx_power=args.tx_power, modulation=args.modulation, tari=tari, session=args.session, mode_identifier=args.mode_identifier, tag_population=args.population, start_inventory=True, disconnect_when_done=args.time and args.time > 0, reconnect=args.reconnect, tag_content_selector={ 'EnableROSpecID': True, 'EnableSpecIndex': False, 'EnableInventoryParameterSpecID': False, 'EnableAntennaID': True, 'EnableChannelIndex': False, 'EnablePeakRRSI': True, 'EnableFirstSeenTimestamp': False, 'EnableLastSeenTimestamp': True, 'EnableTagSeenCount': True, 'EnableAccessSpecID': False }, impinj_search_mode=args.impinj_search_mode, ) fac = LLRPClientFactory(**factory_args) # tag_report_cb will be called every time the reader sends a TagReport # message (i.e., when it has "seen" tags). fac.addTagReportCallback(tag_report_cb) for host in args.host: if ':' in host: host, port = host.split(':', 1) port = int(port) else: port = args.port reactor.connectTCP(host, port, fac, timeout=3) # catch ctrl-C and stop inventory before disconnecting reactor.addSystemEventTrigger('before', 'shutdown', shutdown, fac) # start runtime measurement to determine rates start_time = time.monotonic() reactor.run()
def main(args): global start_time if not args.host: logger.info('No readers specified.') return 0 enabled_antennas = [int(x.strip()) for x in args.antennas.split(',')] antmap = { host: { str(ant): 'Antenna {}'.format(ant) for ant in enabled_antennas } for host in args.host } logger.info('Antenna map: %s', antmap) # d.callback will be called when all connections have terminated normally. # use d.addCallback(<callable>) to define end-of-program behavior. d = defer.Deferred() d.addCallback(finish) factory_args = dict( onFinish=d, duration=args.time, report_every_n_tags=args.every_n, antenna_dict=antmap, tx_power=args.tx_power, tari=args.tari, session=args.session, mode_identifier=args.mode_identifier, tag_population=args.population, start_inventory=True, disconnect_when_done=args.time and args.time > 0, reconnect=args.reconnect, tag_filter_mask=args.tag_filter_mask, tag_content_selector={ 'EnableROSpecID': False, 'EnableSpecIndex': False, 'EnableInventoryParameterSpecID': False, 'EnableAntennaID': False, 'EnableChannelIndex': True, 'EnablePeakRSSI': False, 'EnableFirstSeenTimestamp': False, 'EnableLastSeenTimestamp': True, 'EnableTagSeenCount': True, 'EnableAccessSpecID': False }, impinj_extended_configuration=args.impinj_extended_configuration, impinj_search_mode=args.impinj_search_mode, impinj_tag_content_selector=None, ) if args.impinj_reports: factory_args['impinj_tag_content_selector'] = { 'EnableRFPhaseAngle': True, 'EnablePeakRSSI': False, 'EnableRFDopplerFrequency': False } if args.impinj_fixed_freq: factory_args['impinj_fixed_frequency_param'] = { 'FixedFrequencyMode': 2, 'ChannelListIndex': [1] } fac = LLRPClientFactory(**factory_args) # tag_report_cb will be called every time the reader sends a TagReport # message (i.e., when it has "seen" tags). fac.addTagReportCallback(tag_report_cb) for host in args.host: if ':' in host: host, port = host.split(':', 1) port = int(port) else: port = args.port reactor.connectTCP(host, port, fac, timeout=3) # catch ctrl-C and stop inventory before disconnecting reactor.addSystemEventTrigger('before', 'shutdown', shutdown, fac) # start runtime measurement to determine rates start_time = monotonic() reactor.run()