def send_nonce(self): """ Transmit server's current nonce """ # Convert nonce to SWAP value value = SwapValue(self.nonce) # Status packet to be sent status = SwapStatusPacket(self._xmlnetwork.devaddress, SwapRegId.ID_SECU_NONCE, value) self.nonce += 1 if self.nonce > 0xFF: self.nonce = 0 status.nonce = self.nonce status.send(self)
def send_status(self, mote, regid): """ Send status message informing about a register @param mote: Mote containing the register @param regid: Register ID """ # Get register reg = mote.getRegister(regid) if reg is not None: # Status packet to be sent status = SwapStatusPacket(mote.address, regid, reg.value) status.srcAddress = self._xmlnetwork.devaddress self.nonce += 1 if self.nonce > 0xFF: self.nonce = 0 status.nonce = self.nonce status.send(self)