1
2 PORTS_KEY = 'ports'
3 CONTROLLER_ID_KEY = 'controller_id'
4 FIRMWARE_KEY = 'firmware_updater'
5 AUTO_LOAD_KEY = 'auto_load'
6 VENDORID = 'vendor_id'
7 PRODUCTIDS = 'product_ids'
8 MODEL_NAME = 'model_name'
9 DIRECTIONKEY = 'direction'
10 PORTNAMEKEY = 'name'
11 MACNAMEKEY = 'mac_name'
12 PROPSKEY = 'props'
13 SYNC = 'sync'
14 SCRIPT = 'script'
15 NOTES_CC = 'notes_cc'
16 REMOTE = 'remote'
17 PLAIN_OLD_MIDI = 'plain_old_midi'
18
20 if not type(direction) is str:
21 raise AssertionError
22 raise type(port_name) is str or AssertionError
23 raise props == None or type(props) is list or AssertionError
24 if props:
25 for prop in props:
26 raise type(prop) is str or AssertionError
27
28 raise mac_name == None or type(mac_name) is str or AssertionError
29 capabilities = {DIRECTIONKEY: direction,
30 PORTNAMEKEY: port_name,
31 PROPSKEY: props}
32 capabilities[MACNAMEKEY] = mac_name and mac_name
33 return capabilities
34
35
36 -def inport(port_name = '', props = [], mac_name = None):
39
40
41 -def outport(port_name = '', props = [], mac_name = None):
44
45
47 """ Generate a hardwareId dict"""
48 raise type(vendor_id) is int or AssertionError
49 raise type(product_ids) is list or AssertionError
50 for product_id in product_ids:
51 raise type(product_id) is int or AssertionError
52
53 raise type(model_name) is str or AssertionError
54 return {VENDORID: vendor_id,
55 PRODUCTIDS: product_ids,
56 MODEL_NAME: model_name}
57