Esempio n. 1
0
 def configure(self):
     current_db = db.get(self.uid)
     if not current_db.has('config'):
         return False
     data = current_db.get('config')
     self.send(data)
     log.debug('Configuration data sent = %s', data)
     config = packets.TeltonikaConfiguration(data)
     answer = b''
     try:
         log.debug('Waiting for the answer from device...')
         answer = self.recv()
     except Exception as E:
         log.error(E)
     current_db.remove('config')
     return config.isCorrectAnswer(answer)
Esempio n. 2
0
 def getPushSmsData(self, config):
     """
      Creates push sms data (1st config method) - WE USE THIS!
      @param config:
      @return:
     """
     # create config packet and save it to the database
     packet = self.getConfigurationPacket(config)
     current_db = db.get(config['identifier'])
     current_db.set('config', packet.rawData)
     # create push-sms for configuration
     buffer = self.getInitiationSmsBuffer(config)
     data = [{
         'message': binascii.hexlify(buffer).decode(),
         'bin': consts.SMS_BINARY_HEX_STRING,
         'push': True
     }]
     return data