Exemplo n.º 1
0
 def get(self):
     return InputModule.concat_bytearrays(
         (
             InputModule.uint16_to_bytearray((self.__sensor.get_temperature() + 100) * 100),
             InputModule.uint16_to_bytearray(self.__sensor.get_humidity() * 100),
             InputModule.uint16_to_bytearray(self.__sensor.get_co2())
         )
     )
Exemplo n.º 2
0
 def get(self):
     return InputModule.concat_bytearrays(
         (
             InputModule.uint16_to_bytearray(self.sensor.get_x_acceleration()),
             InputModule.uint16_to_bytearray(self.sensor.get_y_acceleration()),
             InputModule.uint16_to_bytearray(self.sensor.get_z_acceleration()),
         )
     )
Exemplo n.º 3
0
 def get(self):
     return InputModule.concat_bytearrays(
         (InputModule.uint16_to_bytearray(
             (self.sensor.temperature + 100) * 100),
          InputModule.uint16_to_bytearray(self.sensor.humidity * 100),
          InputModule.uint32_to_bytearray(self.sensor.pressure * 100),
          InputModule.uint16_to_bytearray(self.sensor.altitude * 100),
          InputModule.uint32_to_bytearray(self.sensor.gas)))
Exemplo n.º 4
0
    def get(self):
        data = self.sensor.MyGPS()

        # no gps
        if data == None:
            return InputModule.concat_bytearrays(
                (InputModule.uint32_to_bytearray(0),
                 InputModule.uint32_to_bytearray(0),
                 InputModule.uint16_to_bytearray(0)))

        return InputModule.concat_bytearrays(
            (InputModule.uint32_to_bytearray(data[0] * 10000),
             InputModule.uint32_to_bytearray(data[1] * 10000),
             InputModule.uint16_to_bytearray(data[2])))
Exemplo n.º 5
0
 def get(self):
     try:
         data = self.sensor.getData()
         return InputModule.concat_bytearrays(
             (
                 InputModule.uint16_to_bytearray(data[0][1]*10),
                 InputModule.uint16_to_bytearray(data[1][1]*10),
             )
         )
     except:
         b = bytearray(20)
         for i in range(0, len(b)):
             b[i] = 0
         return b
Exemplo n.º 6
0
 def get(self):
     try:
         data = self.sensor.getData()
         return InputModule.concat_bytearrays(
             (InputModule.uint16_to_bytearray(data["pm1_par1"] * 100),
              InputModule.uint16_to_bytearray(data["pm25_par2"] * 100),
              InputModule.uint16_to_bytearray(data["pm10_par3"] * 100),
              InputModule.uint16_to_bytearray(data["pm1"] * 100),
              InputModule.uint16_to_bytearray(data["pm25"] * 100),
              InputModule.uint16_to_bytearray(data["pm10"] * 100),
              InputModule.uint16_to_bytearray(data["pm05_cnt"] * 100),
              InputModule.uint16_to_bytearray(data["pm1_cnt"] * 100),
              InputModule.uint16_to_bytearray(data["pm25_cnt"] * 100),
              InputModule.uint16_to_bytearray(data["pm5_cnt"] * 100),
              InputModule.uint16_to_bytearray(data["pm10_cnt"] * 100),
              InputModule.uint16_to_bytearray(data["grain"] * 100)))
     except:
         b = bytearray(24)
         for i in range(0, len(b)):
             b[i] = 0
         return b
Exemplo n.º 7
0
 def get(self):
     array = bytearray(1)
     return InputModule.uint16_to_bytearray(
         self.sensor.read_input_registers())
Exemplo n.º 8
0
 def get(self):
     return InputModule.uint16_to_bytearray(self.sensor.measure())