Esempio n. 1
0
    def create_with_create_new_file(file_id,
                                    file_header,
                                    interface_type=InterfaceType.HOST,
                                    interface_configuration=None):
        cmd = Command()
        cmd.add_forward_action(interface_type, interface_configuration)
        cmd.add_action(
            RegularAction(operation=CreateNewFile(operand=FileHeaderOperand(
                file_id=file_id, file_header=file_header))))

        return cmd
Esempio n. 2
0
 def parse_alp_return_file_header_action(self, b7, b6, s):
     operand = FileHeaderOperand.parse(s)
     return RegularAction(group=b7,
                          resp=b6,
                          operation=ReturnFileHeader(operand=operand))
Esempio n. 3
0
 def parse_alp_create_file_action(self, b7, b6, s):
     operand = FileHeaderOperand.parse(s)
     return RegularAction(group=b7,
                          resp=b6,
                          operation=CreateNewFile(operand=operand))
Esempio n. 4
0
# the interface config
cmd.add_action(
    RegularAction(operation=WriteFileData(
        operand=Data(offset=Offset(id=0x42, offset=Length(0)),
                     data=list(interface_config)))))

# enable action on sensor file
file_header = FileHeader(properties=FileProperties(
    act_enabled=True,
    act_condition=ActionCondition.WRITE,
    storage_class=StorageClass.TRANSIENT),
                         alp_command_file_id=0x41,
                         interface_file_id=0x42,
                         file_size=2,
                         allocated_size=2,
                         permissions=FilePermissions())

cmd.add_action(
    RegularAction(operation=WriteFileHeader(
        operand=FileHeaderOperand(file_id=0x40, file_header=file_header))))

print("Executing ...")
responses = modem.execute_command(alp_command=cmd, timeout_seconds=30)

for resp in responses:
    if not resp.execution_completed:
        print("{} reconfigured to use D7AActP".format(
            resp.get_d7asp_interface_status().addressee.id))

print("Done")