Beispiel #1
0
    def send(self, cmd_type, addr, data_tags = None, cb = None):
        """Send the msg to the mote
        """
        oap_msg = OAPMessage.build_oap(
            self.seq_num,
            self.session_id,
            cmd_type,
            addr,
            tags=data_tags,
            sync=True
        )

        # TODO: adjust send_data to match connector
        # send_data expects msg as list of integers
        oap_payload = [ord(b) for b in oap_msg]
        
        #print ' '.join(['TX: ']+["%.2x"%c for c in oap_payload])
        
        self.send_data(
            self.mac,
            0,
            OAPMessage.OAP_PORT,
            OAPMessage.OAP_PORT,
            0,
            oap_payload
        )
        
        # append the callback for the response to the message queue
        if cb:
            self.message_queue.append((self.seq_num, cmd_type, cb))
Beispiel #2
0
    def send(self, cmd_type, addr, data_tags=None, cb=None):
        """Send the msg to the mote
        """
        oap_msg = OAPMessage.build_oap(self.seq_num,
                                       self.session_id,
                                       cmd_type,
                                       addr,
                                       tags=data_tags,
                                       sync=True)

        # TODO: adjust send_data to match connector
        # send_data expects msg as list of integers
        oap_payload = [ord(b) for b in oap_msg]

        #print ' '.join(['TX: ']+["%.2x"%c for c in oap_payload])

        self.send_data(self.mac, 0, OAPMessage.OAP_PORT, OAPMessage.OAP_PORT,
                       0, oap_payload)

        # append the callback for the response to the message queue
        if cb:
            self.message_queue.append((self.seq_num, cmd_type, cb))