void Dummy::peerAddEvent(uint8_t *data, uint8_t len) { // we received an peer add event, which means, there was a peer added in this respective channel // 1st byte and 2nd byte shows the peer channel, 3rd and 4th byte gives the peer index // no need for sending an answer, but we could set default data to the respective list3/4 #ifdef DM_DBG Serial << F("peerAddEvent: pCnl1: "); pHexB(data[0]); Serial << F(", pCnl2: "); pHexB(data[1]); Serial << F(", pIdx1: "); pHexB(data[2]); Serial << F(", pIdx2: "); pHexB(data[3]); Serial << F("\n"); #endif if ((data[0]) && (data[1])) { // dual peer add if (data[0]%2) { // odd hm->setListFromModule(regCnl,data[2],(uint8_t*)peerOdd,sizeof(peerOdd)); hm->setListFromModule(regCnl,data[3],(uint8_t*)peerEven,sizeof(peerEven)); } else { // even hm->setListFromModule(regCnl,data[2],(uint8_t*)peerEven,sizeof(peerEven)); hm->setListFromModule(regCnl,data[3],(uint8_t*)peerOdd,sizeof(peerOdd)); } } else { // single peer add if (data[0]) hm->setListFromModule(regCnl,data[2],(uint8_t*)peerSingle,sizeof(peerSingle)); if (data[1]) hm->setListFromModule(regCnl,data[3],(uint8_t*)peerSingle,sizeof(peerSingle)); } }
void Relay::pairSetEvent(uint8_t *data, uint8_t len) { // we received a message from master to set a new value, typical you will find three bytes in data // 1st byte = value; 2nd byte = ramp time; 3rd byte = duration time; // after setting the new value we have to send an enhanced ACK (<- 0E E7 80 02 1F B7 4A 63 19 63 01 01 C8 00 54) #ifdef DM_DBG Serial << F("pairSetEvent, value:") << pHexB(data[0]); if (len > 1) Serial << F(", rampTime: ") << pHexB(data[1]); if (len > 3) Serial << F(", duraTime: ") << pHexB(data[3]); Serial << '\n'; #endif //hm->sendACKStatus(regCnl,modStat,0); }
void Relay::peerMsgEvent(uint8_t type, uint8_t *data, uint8_t len) { // we received a peer event, in type you will find the marker if it was a switch(3E), remote(40) or sensor(41) event // appropriate answer is an ACK #ifdef DM_DBG Serial << F("peerMsgEvent, type: ") << pHexB(type) << F(", data: ") << pHex(data,len) << '\n'; #endif //hm->send_ACK(); }
void Dummy::peerMsgEvent(uint8_t type, uint8_t *data, uint8_t len) { // we received a peer event, in type you will find the marker if it was a switch(3E), remote(40) or sensor(41) event // appropriate answer is an ACK #ifdef DM_DBG Serial << F("peerMsgEvent, type: "); pHexB(type); Serial << F(", data: "); pHex(data,len, SERIAL_DBG_PHEX_MODE_LF); #endif hm->send_ACK(); }