def configure_sensor(serial_device, sensor_id, serial_enabled, channel,
                     sleep_enabled):
    aci = AciUart.AciUart(port=serial_device, baudrate=115200)
    # Wait for serial connection to be ready
    time.sleep(2)
    cmd = sensei_cmd.SetConfig(sensor_id, serial_enabled, channel,
                               sleep_enabled)
    data = cmd.serialize()
    aci.write_aci_cmd(AciCommand.AciAppCommand(data=data,
                                               length=len(data) + 1))

    # Wait for flash to be written
    time.sleep(2)
    aci.write_aci_cmd(AciCommand.AciRadioReset())

    aci.stop()
Exemple #2
0
def set_time(serial_device):
    aci = AciUart.AciUart(port=serial_device, baudrate=115200)
    # Wait for serial connection to be ready
    time.sleep(2)
    cmd = sensei_cmd.SetTime()
    data = cmd.serialize()
    aci.write_aci_cmd(AciCommand.AciAppCommand(data=data,
                                               length=len(data) + 1))
    aci.stop()
Exemple #3
0
 def FlagGet(self, Handle, FlagIndex):
     self.acidev.write_aci_cmd(
         AciCommand.AciFlagGet(handle=Handle, flag_index=FlagIndex))
Exemple #4
0
 def FlagSet(self, Handle, FlagIndex, FlagValue=True):
     self.acidev.write_aci_cmd(
         AciCommand.AciFlagSet(handle=Handle,
                               flag_index=FlagIndex,
                               flag_value=FlagValue))
Exemple #5
0
 def Stop(self):
     self.acidev.write_aci_cmd(AciCommand.AciStop())
Exemple #6
0
 def ValueGet(self, Handle):
     self.acidev.write_aci_cmd(AciCommand.AciValueGet(handle=Handle))
Exemple #7
0
 def MinIntervalGet(self):
     self.acidev.write_aci_cmd(AciCommand.AciIntervalMinMsGet())
Exemple #8
0
 def AccessAddressGet(self):
     self.acidev.write_aci_cmd(AciCommand.AciAccessAddressGet())
Exemple #9
0
 def RadioReset(self):
     self.acidev.write_aci_cmd(AciCommand.AciRadioReset())
Exemple #10
0
 def Echo(self, Data):
     self.acidev.write_aci_cmd(
         AciCommand.AciEcho(data=Data, length=(len(Data) + 1)))
Exemple #11
0
 def run_app_command(self, command):
     data = command.serialize()
     retval = self.aci.write_aci_cmd(
         AciCommand.AciAppCommand(data=data, length=len(data) + 1))
     print("Events received: %s" % retval)
     return retval
Exemple #12
0
 def __repr__(self):
     return str.format(
         "I am %s and my Lenght is %d, OpCode is 0x%02x, CommandOpCode is %s, StatusCode is %s, and Data is %s"
         % (self.__class__.__name__, self.Len, self.OpCode,
            AciCommand.AciCommandLookUp(self.CommandOpCode),
            AciStatusLookUp(self.StatusCode), self.Data))
Exemple #13
0
 def __repr__(self):
     return "%s length:%d opcode:0x%02x command_opcode:%s status_code:%s data:%s" % (
         self.__class__.__name__, self.Len, self.OpCode,
         AciCommand.AciCommandLookUp(self.CommandOpCode),
         AciStatusLookUp(self.StatusCode), self.Data)
Exemple #14
0
 def DFUData(self, Data):
     self.acidev.write_aci_cmd(
         AciCommand.AciDfuData(data=Data, length=(len(Data) + 1)))
Exemple #15
0
 def Init(self, AccessAddress=0x8E89BED6, MinInterval=100, Channel=39):
     self.acidev.write_aci_cmd(
         AciCommand.AciInit(access_address=AccessAddress,
                            min_interval=MinInterval,
                            channel=Channel))
Exemple #16
0
 def BuildVersionGet(self):
     self.acidev.write_aci_cmd(AciCommand.AciBuildVersionGet())
Exemple #17
0
 def ValueSet(self, Handle, Data):
     self.acidev.write_aci_cmd(
         AciCommand.AciValueSet(handle=Handle,
                                data=Data,
                                length=(len(Data) + 3)))
Exemple #18
0
 def ChannelGet(self):
     self.acidev.write_aci_cmd(AciCommand.AciChannelGet())
Exemple #19
0
 def ValueDisable(self, Handle):
     self.acidev.write_aci_cmd(AciCommand.AciValueDisable(handle=Handle))
Exemple #20
0
 def run_app_command(self, command):
     data = command.serialize()
     return self.aci.write_aci_cmd(AciCommand.AciAppCommand(data=data,length=len(data)+1))
 def AppCommand(self, data=[]):
     self.acidev.write_aci_cmd(AciCommand.AciAppCommand(data=data,length=len(data)+1))