Exemple #1
0
 def reattributing_indexes(self):
     self.deco = loads(
         Websock.get_deco())  #retrieves the disconnected cards.
     for mac in self.pos_unknown.keys():
         if len(self.deco) > 0:
             # dummy security, should do something in the case of it happenning but dunno what (yet)
             pixel_deco = self.deco.popitem()
             self.pos_unknown[mac] = (
                 (-1, -1), pixel_deco[1][1]
             )  #associate the disconnected card index to the unknown card.
     self.pixels = loads(
         Websock.get_pixels())  #retrieves the current pixel list
     self.pixels['default'] = ((-1, -1), -1)  #adds the fake pixel security.
Exemple #2
0
 def ama_care(self):
     #Get the new pixel addressed positions
     tmp = Websock.get_pixels()
     if tmp != None and tmp != {}:
         Mesh.pixels = json.loads(tmp)
     tmp = json.loads(Websock.get_pos_unk())
     if tmp != None:
         Listen.unk = tmp
     #Get the model format to check
     tmp = Websock.get_ama_model()
     if tmp != None:
         self.ama_check = eval(tmp)['ama']
     if self.ama_model():
         # send a COLOR frame only if the model match the expected model
         Mesh.sequence = (Mesh.sequence + 1) % 65536
         array = self.msg.color(self.model._model, Mesh.sequence,
                                Mesh.pixels, Listen.unk, self.ama_check)
         self.mesh_conn.send(array)