()
| 118 | |
| 119 | |
| 120 | def main(): |
| 121 | BoardShim.enable_dev_board_logger() |
| 122 | logging.basicConfig(level=logging.DEBUG) |
| 123 | |
| 124 | parser = argparse.ArgumentParser() |
| 125 | # use docs to check which parameters are required for specific board, e.g. for Cyton - set serial port |
| 126 | parser.add_argument('--timeout', type=int, help='timeout for device discovery or connection', required=False, |
| 127 | default=0) |
| 128 | parser.add_argument('--ip-port', type=int, help='ip port', required=False, default=0) |
| 129 | parser.add_argument('--ip-protocol', type=int, help='ip protocol, check IpProtocolType enum', required=False, |
| 130 | default=0) |
| 131 | parser.add_argument('--ip-address', type=str, help='ip address', required=False, default='') |
| 132 | parser.add_argument('--serial-port', type=str, help='serial port', required=False, default='') |
| 133 | parser.add_argument('--mac-address', type=str, help='mac address', required=False, default='') |
| 134 | parser.add_argument('--other-info', type=str, help='other info', required=False, default='') |
| 135 | parser.add_argument('--streamer-params', type=str, help='streamer params', required=False, default='') |
| 136 | parser.add_argument('--serial-number', type=str, help='serial number', required=False, default='') |
| 137 | parser.add_argument('--board-id', type=int, help='board id, check docs to get a list of supported boards', |
| 138 | required=False, default=BoardIds.SYNTHETIC_BOARD) |
| 139 | parser.add_argument('--file', type=str, help='file', required=False, default='') |
| 140 | parser.add_argument('--master-board', type=int, help='master board id for streaming and playback boards', |
| 141 | required=False, default=BoardIds.NO_BOARD) |
| 142 | args = parser.parse_args() |
| 143 | |
| 144 | params = BrainFlowInputParams() |
| 145 | params.ip_port = args.ip_port |
| 146 | params.serial_port = args.serial_port |
| 147 | params.mac_address = args.mac_address |
| 148 | params.other_info = args.other_info |
| 149 | params.serial_number = args.serial_number |
| 150 | params.ip_address = args.ip_address |
| 151 | params.ip_protocol = args.ip_protocol |
| 152 | params.timeout = args.timeout |
| 153 | params.file = args.file |
| 154 | params.master_board = args.master_board |
| 155 | |
| 156 | board_shim = BoardShim(args.board_id, params) |
| 157 | try: |
| 158 | board_shim.prepare_session() |
| 159 | board_shim.start_stream(450000, args.streamer_params) |
| 160 | Graph(board_shim) |
| 161 | except BaseException: |
| 162 | logging.warning('Exception', exc_info=True) |
| 163 | finally: |
| 164 | if board_shim.is_prepared(): |
| 165 | logging.info('Releasing session') |
| 166 | board_shim.release_session() |
| 167 | |
| 168 | |
| 169 | if __name__ == '__main__': |
no test coverage detected