Ejemplo n.º 1
0
void printResponseCb(Rx64Response& rx, uintptr_t data) {
	Print *p = (Print*)data;
	p->println("Rx64Response received:");
	printField(p, F("  From: 0x"), rx.getRemoteAddress64());
	printField(p, F("  Rssi: 0x"), rx.getRssi());
	printField(p, F("  Receive options: 0x"), rx.getOption());
	if (rx.getDataLength() > 8)
		p->print("  Payload:\r\n    ");
	else
		p->print("  Payload: ");
	printHex(*p, rx.getFrameData() + rx.getDataOffset(), rx.getDataLength(), F(" "), F("\r\n    "), 8);
	p->println();
}
Ejemplo n.º 2
0
                }else{
                  //get dest address (it is my own)
                  //lladdr_dest = &my_mac;
                  lladdr_dest->addr[0] = my_mac.addr[0]; // Copy my_mac address to lladdr_dest
                  lladdr_dest->addr[1] = my_mac.addr[1];
                }
                
                lladdr_src->addr[0] = rxResp.getRemoteAddress16() >> 8;
                lladdr_src->addr[1] = rxResp.getRemoteAddress16() & 0x00FF;
          }else
            return false;
        } else {           
            if (UIP_LLADDR_LEN == UIP_802154_LONGADDR_LEN){
                Rx64Response rx64 = Rx64Response();
                xbee.getResponse().getRx64Response(rx64);
                memcpy(data, rx64.getData(), rx64.getDataLength());
                *length = rx64.getDataLength();
                                
                //get destination addresses
                if(rx64.getOption() == ZB_BROADCAST_PACKET){ //Then packet was a broadcast.. destination address is 0xFFFF, we use an all-zeroes address to represent broadcast
					//lladdr_dest = NULL;
                	rimeaddr_copy((rimeaddr_t*)lladdr_dest , &rimeaddr_null, UIP_LLADDR_LEN); // Copy an all-zeroes address to lladdr_dest
                }else{
					//get dest address (it is my own)
					//lladdr_dest = &my_mac;
					rimeaddr_copy((rimeaddr_t*)lladdr_dest , (rimeaddr_t*)(&my_mac), UIP_LLADDR_LEN); // Copy my_mac address to lladdr_dest
                }
                
                //get sorce address
                for(int i=0; i<UIP_LLADDR_LEN; ++i){
                  lladdr_src->addr[i] = rx64.getFrameData()[i];