def get_amount_of_ucans(): """ Receives amount of uCAN modules """ return CoreCommandSpec(instruction='FS', request_fields=[ AddressField('cc_address'), LiteralBytesField(0), LiteralBytesField(0) ], response_fields=[ AddressField('cc_address'), PaddingField(2), ByteField('amount'), PaddingField(2) ])
def device_information_list_inputs(): """ Device information list for inputs """ return CoreCommandSpec(instruction='DL', request_fields=[LiteralBytesField(1)], response_fields=[ ByteField('type'), ByteArrayField('information', lambda length: length - 1) ])
def _sensor_values(instruction, field): """ Receive sensor byte values """ return CoreCommandSpec( instruction='SI', request_fields=[ ByteField('module_nr'), LiteralBytesField(instruction) ], response_fields=[ByteField('module_nr'), PaddingField(1), field])
def general_configuration_number_of_modules(): """ Receives general configuration regarding number of modules """ return CoreCommandSpec(instruction='GC', request_fields=[LiteralBytesField(0)], response_fields=[ ByteField('type'), ByteField('output'), ByteField('input'), ByteField('sensor'), ByteField('ucan'), ByteField('ucan_input'), ByteField('ucan_sensor') ])
def get_ucan_address(): """ Receives the uCAN address of a specific uCAN """ return CoreCommandSpec(instruction='FS', request_fields=[ AddressField('cc_address'), LiteralBytesField(1), ByteField('ucan_nr') ], response_fields=[ AddressField('cc_address'), PaddingField(2), AddressField('ucan_address', 3) ])
def general_configuration_max_specs(): """ Receives general configuration regarding maximum specifications (e.g. max number of input modules, max number of basic actions, ...) """ return CoreCommandSpec(instruction='GC', request_fields=[LiteralBytesField(1)], response_fields=[ ByteField('type'), ByteField('output'), ByteField('input'), ByteField('sensor'), ByteField('ucan'), WordField('groups'), WordField('basic_actions'), ByteField('shutters'), ByteField('shutter_groups') ])