fout.write(event_header) # event classes create_events(fout, events) create_events(fout, subevents) # defines_text = '' # python_defines_string(,defines) fout.write(event_factory_template.format(defines_text, cases, subcases)) # find root btstack_root = os.path.abspath(os.path.dirname(sys.argv[0]) + '/..') gen_path = btstack_root + '/platform/daemon/binding/python/btstack/' # read defines from hci_cmds.h and hci.h defines = parser.parse_defines() # parse commands commands = parser.parse_daemon_commands(camel_case=False) # parse bluetooth.h to get used events (events, le_events, event_types) = parser.parse_events() # create events, le meta events, event factory, and create_event_factory(events, le_events, event_types) create_command_builder(commands) # done print('Done!')
cases = '' for event_type, event_name, format, args in events: event_name = camel_case(event_name) cases += java_event_factory_event.format(event_type, event_name) subcases = '' for event_type, event_name, format, args in le_events: event_name = camel_case(event_name) subcases += java_event_factory_subevent.format(event_type, event_name) with open(outfile, 'wt') as fout: defines_text = java_defines_string(defines) fout.write(java_event_factory_template.format(package, defines_text, cases, subcases)) # read defines from hci_cmds.h and hci.h defines = parser.parse_defines() # # parse commands commands = parser.parse_commands() # parse hci.h to get used events (events, le_events, event_types) = parser.parse_events() # create events, le meta events, event factory, and create_events(events) create_events(le_events) create_event_factory(events, le_events, event_types) create_btstack_java(commands) # done print('Done!')