static void DecodeChannelDACInputRegister(uint8_t *info, uint8_t data[3], const CLS1_StdIOType *io) { uint8_t buf[16]; UTIL1_strcpy(buf, sizeof(buf), (unsigned char*)"0x"); UTIL1_strcatNum8Hex(buf, sizeof(buf), data[0]); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)" 0x"); UTIL1_strcatNum8Hex(buf, sizeof(buf), data[1]); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)" 0x"); UTIL1_strcatNum8Hex(buf, sizeof(buf), data[2]); CLS1_SendStatusStr(info, buf, io->stdOut); CLS1_SendStr((unsigned char*)"\r\n", io->stdOut); }
static uint8_t PrintStatus(const CLS1_StdIOType *io) { uint8_t data[2*3*4]; uint8_t buf[16]; CLS1_SendStatusStr((unsigned char*)"MCP4728", (unsigned char*)"\r\n", io->stdOut); UTIL1_strcpy(buf, sizeof(buf), (unsigned char*)"0x"); UTIL1_strcatNum8Hex(buf, sizeof(buf), MCP4728_I2C_ADDRESS); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"\r\n"); CLS1_SendStatusStr((unsigned char*)" I2C addr", buf, io->stdOut); if (MCP4728_Read(data, sizeof(data))==ERR_OK) { DecodeChannelDACInputRegister((unsigned char*)" A DAC Reg", &data[0], io); DecodeChannelDACInputRegister((unsigned char*)" A EEPROM", &data[3], io); DecodeChannelDACInputRegister((unsigned char*)" B DAC Reg", &data[6], io); DecodeChannelDACInputRegister((unsigned char*)" B EEPROM", &data[9], io); DecodeChannelDACInputRegister((unsigned char*)" C DAC Reg", &data[12], io); DecodeChannelDACInputRegister((unsigned char*)" C EEPROM", &data[15], io); DecodeChannelDACInputRegister((unsigned char*)" D DAC Reg", &data[18], io); DecodeChannelDACInputRegister((unsigned char*)" D EEPROM", &data[21], io); } else { CLS1_SendStatusStr((unsigned char*)" device", (unsigned char*)"ERROR!\r\n", io->stdOut); } #if PL_CONFIG_HAS_MCP4728_RDY CLS1_SendStatusStr((unsigned char*)" RDY Pin", MCP4728_RDY_GetVal()!=0?(unsigned char*)"input: HIGH, ready\r\n":(unsigned char*)"input: LOW, busy\r\n", io->stdOut); #endif #if PL_CONFIG_HAS_MCP4728_LDAC CLS1_SendStatusStr((unsigned char*)" LDAC Pin", MCP4728_LDAC_GetVal()!=0?(unsigned char*)"output: HIGH, output with UDAC bit\r\n":(unsigned char*)"output: LOW, immediate\r\n", io->stdOut); #endif return ERR_OK; }
static uint8_t HandleDataRxMessage(RAPP_MSG_Type type, uint8_t size, uint8_t *data, RNWK_ShortAddrType srcAddr, bool *handled, RPHY_PacketDesc *packet) { #if PL_HAS_SHELL uint8_t buf[32]; CLS1_ConstStdIOTypePtr io = CLS1_GetStdio(); #endif uint8_t val; (void)size; (void)packet; switch(type) { case RAPP_MSG_TYPE_DATA: /* generic data message */ *handled = TRUE; val = *data; /* get data value */ #if PL_HAS_DRIVE DRV_EnableDisable(TRUE); #endif #if PL_HAS_SHELL SHELL_SendString((unsigned char*)"Data: "); SHELL_SendString(data); SHELL_SendString((unsigned char*)" from addr 0x"); buf[0] = '\0'; #if RNWK_SHORT_ADDR_SIZE==1 UTIL1_strcatNum8Hex(buf, sizeof(buf), srcAddr); #else UTIL1_strcatNum16Hex(buf, sizeof(buf), srcAddr); #endif UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"\r\n"); SHELL_SendString(buf); #endif /* PL_HAS_SHELL */ return ERR_OK; break; default: break; } /* switch */ return ERR_OK; }
static uint8_t HandleDataRxMessage(RAPP_MSG_Type type, uint8_t size, uint8_t *data, RNWK_ShortAddrType srcAddr, bool *handled, RPHY_PacketDesc *packet) { #if PL_HAS_SHELL uint8_t buf[16]; CLS1_ConstStdIOTypePtr io = CLS1_GetStdio(); #endif uint8_t val; (void)size; (void)packet; switch(type) { case RAPP_MSG_TYPE_DATA: /* <type><size><data */ *handled = TRUE; val = *data; /* get data value */ #if PL_HAS_SHELL CLS1_SendStr((unsigned char*)"Data: ", io->stdOut); CLS1_SendNum8u(val, io->stdOut); CLS1_SendStr((unsigned char*)" from addr 0x", io->stdOut); buf[0] = '\0'; #if RNWK_SHORT_ADDR_SIZE==1 UTIL1_strcatNum8Hex(buf, sizeof(buf), srcAddr); #else UTIL1_strcatNum16Hex(buf, sizeof(buf), srcAddr); #endif UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"\r\n"); CLS1_SendStr(buf, io->stdOut); #endif return ERR_OK; default: break; } /* switch */ return ERR_OK; }
static uint8_t PrintStatus(CLS1_ConstStdIOType *io) { w5100_config_t config; uint8_t buf[24]; int i; CLS1_SendStatusStr((unsigned char*)"w5100", (unsigned char*)"\r\n", io->stdOut); if (W5100_ReadConfig(&config)!=ERR_OK) { CLS1_SendStr((unsigned char*)"ReadConfig() failed!\r\n", io->stdErr); return ERR_FAILED; } /* gateway address */ buf[0] = '\0'; for(i=0;i<sizeof(config.gateway);i++) { UTIL1_strcatNum8u(buf, sizeof(buf), config.gateway[i]); if (i<sizeof(config.gateway)-1) { UTIL1_chcat(buf, sizeof(buf), '.'); } else { UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"\r\n"); } } CLS1_SendStatusStr((unsigned char*)" Gateway", buf, io->stdOut); /* netmask */ buf[0] = '\0'; for(i=0;i<sizeof(config.netmask);i++) { UTIL1_strcatNum8u(buf, sizeof(buf), config.netmask[i]); if (i<sizeof(config.netmask)-1) { UTIL1_chcat(buf, sizeof(buf), '.'); } else { UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"\r\n"); } } CLS1_SendStatusStr((unsigned char*)" NetMask", buf, io->stdOut); /* HW/MAC address */ buf[0] = '\0'; for(i=0;i<sizeof(config.hwaddr);i++) { UTIL1_strcatNum8Hex(buf, sizeof(buf), config.hwaddr[i]); if (i<sizeof(config.hwaddr)-1) { UTIL1_chcat(buf, sizeof(buf), '-'); } else { UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"\r\n"); } } CLS1_SendStatusStr((unsigned char*)" MAC", buf, io->stdOut); /* IP address */ buf[0] = '\0'; for(i=0;i<sizeof(config.ipaddr);i++) { UTIL1_strcatNum8u(buf, sizeof(buf), config.ipaddr[i]); if (i<sizeof(config.ipaddr)-1) { UTIL1_chcat(buf, sizeof(buf), ':'); } else { UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"\r\n"); } } CLS1_SendStatusStr((unsigned char*)" IP", buf, io->stdOut); return ERR_OK; }
static void dump_byte_array(uint8_t *buffer, uint8_t bufferSize, bool inHex) { uint8_t buf[8]; for (uint8_t i = 0; i < bufferSize; i++) { UTIL1_strcpy(buf, sizeof(buf), " "); if (inHex) { UTIL1_strcatNum8Hex(buf, sizeof(buf), buffer[i]); } else { UTIL1_strcatNum8u(buf, sizeof(buf), buffer[i]); } CLS1_SendStr(buf, CLS1_GetStdio()->stdOut); } }
static uint8_t HandleDataRxMessage(RAPP_MSG_Type type, uint8_t size, uint8_t *data, RNWK_ShortAddrType srcAddr, bool *handled, RPHY_PacketDesc *packet) { #if PL_HAS_SHELL uint8_t buf[32]; CLS1_ConstStdIOTypePtr io = CLS1_GetStdio(); #endif uint8_t val; protocol42 rxdata; (void)size; (void)packet; switch(type) { case RAPP_MSG_TYPE_DATA: /* generic data message */ *handled = TRUE; val = *data; /* get data value */ #if PL_HAS_SHELL //TODO SEND AN SHELQUEUE CBR CLS1_SendStr((unsigned char*)"Data: ", io->stdOut); CLS1_SendNum8u(val, io->stdOut); CLS1_SendStr((unsigned char*)" from addr 0x", io->stdOut); buf[0] = '\0'; #if RNWK_SHORT_ADDR_SIZE==1 UTIL1_strcatNum8Hex(buf, sizeof(buf), srcAddr); #else UTIL1_strcatNum16Hex(buf, sizeof(buf), srcAddr); #endif UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"\r\n"); CLS1_SendStr(buf, io->stdOut); #endif /* PL_HAS_SHELL */ return ERR_OK; case RAPP_MSG_TYPE_PROTOCOL42: rxdata.target = (int8_t)*data; rxdata.type = (int8_t)*(data+1); rxdata.data = (*(data+2)); reciveData42(rxdata); default: /*! \todo Handle your own messages here */ break; } /* switch */ return ERR_OK; }
static uint8_t PrintStatus(const CLS1_StdIOType *io) { uint8_t buf[32]; CLS1_SendStatusStr((unsigned char*)"app", (unsigned char*)"\r\n", io->stdOut); UTIL1_strcpy(buf, sizeof(buf), (unsigned char*)"0x"); #if RNWK_SHORT_ADDR_SIZE==1 UTIL1_strcatNum8Hex(buf, sizeof(buf), APP_dstAddr); #else UTIL1_strcatNum16Hex(buf, sizeof(buf), APP_dstAddr); #endif UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"\r\n"); CLS1_SendStatusStr((unsigned char*)" dest addr", buf, io->stdOut); return ERR_OK; }
static void RemoteTask (void *pvParameters) { (void)pvParameters; #if PL_CONFIG_HAS_JOYSTICK (void)APP_GetXY(&midPointX, &midPointY, NULL, NULL); #endif FRTOS1_vTaskDelay(1000/portTICK_PERIOD_MS); for(;;) { if (REMOTE_isOn) { #if PL_CONFIG_HAS_JOYSTICK if (REMOTE_useJoystick) { uint8_t buf[2]; int16_t x, y; int8_t x8, y8; /* send periodically messages */ APP_GetXY(&x, &y, &x8, &y8); buf[0] = x8; buf[1] = y8; if (REMOTE_isVerbose) { uint8_t txtBuf[48]; UTIL1_strcpy(txtBuf, sizeof(txtBuf), (unsigned char*)"TX: x: "); UTIL1_strcatNum8s(txtBuf, sizeof(txtBuf), x8); UTIL1_strcat(txtBuf, sizeof(txtBuf), (unsigned char*)" y: "); UTIL1_strcatNum8s(txtBuf, sizeof(txtBuf), y8); UTIL1_strcat(txtBuf, sizeof(txtBuf), (unsigned char*)" to addr 0x"); #if RNWK_SHORT_ADDR_SIZE==1 UTIL1_strcatNum8Hex(txtBuf, sizeof(txtBuf), RNETA_GetDestAddr()); #else UTIL1_strcatNum16Hex(txtBuf, sizeof(txtBuf), RNETA_GetDestAddr()); #endif UTIL1_strcat(txtBuf, sizeof(txtBuf), (unsigned char*)"\r\n"); SHELL_SendString(txtBuf); } (void)RAPP_SendPayloadDataBlock(buf, sizeof(buf), RAPP_MSG_TYPE_JOYSTICK_XY, RNETA_GetDestAddr(), RPHY_PACKET_FLAGS_REQ_ACK); LED1_Neg(); } #endif FRTOS1_vTaskDelay(200/portTICK_PERIOD_MS); } else { FRTOS1_vTaskDelay(1000/portTICK_PERIOD_MS); } } /* for */ }
static void AuthNTag216(Uid *id) { /* Ntag216_AUTH */ //This example show how you can get Authenticated by the NTAG213,215,216 by default the tags are unprotected in order to protect them we need to write 4 different values: // Using mfrc522.MIFARE_Ultralight_Write(PageNum, Data, #Databytes)) //1.- we need to write the 32bit passWord to page 0xE5 !for ntag 213 and 215 page is different refer to nxp documentation! //2.- Now Write the 16 bits pACK to the page 0xE6 use the 2 high bytes like this: pACKH + pACKL + 00 + 00 after an authentication the tag will return this secret bytes //3.- Now we need to write the first page we want to protect this is a 1 byte data in page 0xE3 we need to write 00 + 00 + 00 + firstPage all pages after this one are write protected // Now WRITE protection is ACTIVATED so we need to get authenticated in order to write the last data //4.- Finally we need to write an access record in order to READ protect the card this step is optional only if you want to read protect also write 80 + 00 + 00 + 00 to 0xE4 //After completeing all these steps you will nee to authentiate first in order to read or write ant page after the first page you selected to protect //To disengage proection just write the page (0xE3) to 00 + 00 + 00 + FF that going to remove all protection //Made by GARGANTUA from RoboCreators.com & paradoxalabs.com uint8_t PSWBuff[] = {0xFF, 0xFF, 0xFF, 0xFF}; //32 bit PassWord default FFFFFFFF uint8_t pACK[] = {0, 0}; //16 bit PassWord ACK returned by the NFCtag uint8_t buf[16]; MFRC522_StatusCode status; if (id->sak) { } CLS1_SendStr("Auth: ", CLS1_GetStdio()->stdOut); status = MFRC522_PCD_NTAG216_AUTH(&PSWBuff[0], pACK); //Request Authentification if return STATUS_OK we are good if (status!=STATUS_OK) { CLS1_SendStr("FAILED\r\n", CLS1_GetStdio()->stdErr); return; } CLS1_SendStr("\r\n", CLS1_GetStdio()->stdOut); //Print PassWordACK buf[0] = '\0'; UTIL1_strcatNum8Hex(buf, sizeof(buf), pACK[0]); UTIL1_strcat(buf, sizeof(buf), " "); UTIL1_strcat(buf, sizeof(buf), "\r\n"); CLS1_SendStr(buf, CLS1_GetStdio()->stdOut); uint8_t WBuff[] = {0x00, 0x00, 0x00, 0x04}; uint8_t RBuff[18]; //Serial.print("CHG BLK: "); //Serial.println(mfrc522.MIFARE_Ultralight_Write(0xE3, WBuff, 4)); //How to write to a page MFRC522_PICC_DumpMifareUltralightToSerial(); //This is a modifier dunp just cghange the for cicle to < 232 instead of < 16 in order to see all the pages on NTAG216 }
static uint8_t PrintStatus(const CLS1_StdIOType *io) { uint8_t buf[48]; int i; CLS1_SendStatusStr((unsigned char*)"rfid", (unsigned char*)"\r\n", io->stdOut); CLS1_SendStatusStr((unsigned char*)" card", RFID_uid!=NULL?(uint8_t*)"yes\r\n":(uint8_t*)"no\r\n", io->stdOut); if (RFID_uid!=NULL) { buf[0] = '\0'; for (i=0; i<RFID_uid->size; i++) { UTIL1_strcatNum8Hex(buf, sizeof(buf), RFID_uid->uidByte[i]); UTIL1_strcat(buf, sizeof(buf), " "); } UTIL1_strcat(buf, sizeof(buf), "\r\n"); CLS1_SendStatusStr((unsigned char*)" UID", buf, io->stdOut); UTIL1_strcpy(buf, sizeof(buf), MFRC522_PICC_GetTypeName(MFRC522_PICC_GetType(RFID_uid->sak))); UTIL1_strcat(buf, sizeof(buf), "\r\n"); CLS1_SendStatusStr((unsigned char*)" type", buf, io->stdOut); } CLS1_SendStatusStr((unsigned char*)" dump", RFID_dumpNewCardInformation?(uint8_t*)"on\r\n":(uint8_t*)"off\r\n", io->stdOut); return ERR_OK; }
/*! \brief This routine is called as callback by the radio driver on reception of a data packet \param msg Pointer to the message we received. */ static void RADIO_HandleMessage(uint8_t *msg) { char buf[32]; uint8_t i, size; if (RADIO_isSniffing && *msg==RADIO_QUEUE_MSG_SNIFF) { msg++; size = *msg++; UTIL1_strcpy(buf, sizeof(buf), "\r\nch #:"); /* use new line at the beginning, as the hex dump at the end might be fill up buffer completely */ UTIL1_strcatNum16s(buf, sizeof(buf), RADIO_Channel); UTIL1_strcat(buf, sizeof(buf), " size:"); UTIL1_strcatNum16s(buf, sizeof(buf), size); UTIL1_strcat(buf, sizeof(buf), " ASCII: "); SHELL_SendMessage(buf); buf[0] = '\0'; /* write as string */ for(i=0;i<size && i<sizeof(buf);i++) { UTIL1_chcat(buf, sizeof(buf), msg[i]); } SHELL_SendMessage(buf); /* write as hex */ buf[0] = '\0'; UTIL1_strcat(buf, sizeof(buf), " hex: "); for(i=0; i<size;i++) { UTIL1_strcatNum8Hex(buf, sizeof(buf), msg[i]); UTIL1_strcat(buf, sizeof(buf), " "); } SHELL_SendMessage(buf); SHELL_SendMessage("\r\n"); #if PL_HAS_REMOTE && PL_HAS_MOTOR /*! \todo Implement handling for your remote control */ } else if (*msg==RADIO_QUEUE_MSG_ACCEL) { msg++; size = *msg++; REMOTE_ParseMsg((const unsigned char*)msg+sizeof(RADIO_PREFIX_STR)-1, size-sizeof(RADIO_PREFIX_STR)-1); #endif } }
static portTASK_FUNCTION(RemoteTask, pvParameters) { #if PL_HAS_WATCHDOG int i; #endif (void)pvParameters; #if PL_HAS_JOYSTICK (void)APP_GetXY(&midPointX, &midPointY, NULL, NULL); #endif for(;;) { if (REMOTE_isOn) { #if PL_HAS_ACCEL if (REMOTE_useAccelerometer) { #if PL_HAS_KEYS uint8_t buf[7]; uint8_t keys; #else /* PL_HAS_KEYS */ uint8_t buf[6]; #endif /* PL_HAS_KEYS */ int16_t x, y, z; /* send periodically accelerometer messages */ #if PL_HAS_KEYS APP_GetKeys(&keys); #endif /* PL_HAS_KEYS */ ACCEL_GetValues(&x, &y, &z); buf[0] = (uint8_t)(x&0xFF); buf[1] = (uint8_t)(x>>8); buf[2] = (uint8_t)(y&0xFF); buf[3] = (uint8_t)(y>>8); buf[4] = (uint8_t)(z&0xFF); buf[5] = (uint8_t)(z>>8); #if PL_HAS_KEYS buf[6] = keys; #endif /* PL_HAS_KEYS */ if (REMOTE_isVerbose) { uint8_t txtBuf[48]; UTIL1_strcpy(txtBuf, sizeof(txtBuf), (unsigned char*)"TX: x: "); UTIL1_strcatNum16s(txtBuf, sizeof(txtBuf), x); UTIL1_strcat(txtBuf, sizeof(txtBuf), (unsigned char*)" y: "); UTIL1_strcatNum16s(txtBuf, sizeof(txtBuf), y); UTIL1_strcat(txtBuf, sizeof(txtBuf), (unsigned char*)" z: "); UTIL1_strcatNum16s(txtBuf, sizeof(txtBuf), z); UTIL1_strcat(txtBuf, sizeof(txtBuf), (unsigned char*)" to addr 0x"); #if RNWK_SHORT_ADDR_SIZE==1 UTIL1_strcatNum8Hex(txtBuf, sizeof(txtBuf), RNETA_GetDestAddr()); #else UTIL1_strcatNum16Hex(txtBuf, sizeof(txtBuf), RNETA_GetDestAddr()); #endif UTIL1_strcat(txtBuf, sizeof(txtBuf), (unsigned char*)"\r\n"); SHELL_SendString(txtBuf); } (void)RAPP_SendPayloadDataBlock(buf, sizeof(buf), RAPP_MSG_TYPE_ACCEL, RNETA_GetDestAddr(), RPHY_PACKET_FLAGS_REQ_ACK); LED1_Neg(); } #endif #if PL_HAS_JOYSTICK if (REMOTE_useJoystick) { #if PL_HAS_KEYS uint8_t buf[3]; uint8_t keys; #else /* PL_HAS_KEYS */ uint8_t buf[2]; #endif /* PL_HAS_KEYS */ int16_t x, y; int8_t x8, y8; /* send periodically accelerometer messages */ #if PL_HAS_KEYS APP_GetKeys(&keys); #endif /* PL_HAS_KEYS */ APP_GetXY(&x, &y, &x8, &y8); buf[0] = x8; buf[1] = y8; #if PL_HAS_KEYS buf[2] = keys; #endif /* PL_HAS_KEYS */ if (REMOTE_isVerbose) { uint8_t txtBuf[48]; UTIL1_strcpy(txtBuf, sizeof(txtBuf), (unsigned char*)"TX: x: "); UTIL1_strcatNum8s(txtBuf, sizeof(txtBuf), x8); UTIL1_strcat(txtBuf, sizeof(txtBuf), (unsigned char*)" y: "); UTIL1_strcatNum8s(txtBuf, sizeof(txtBuf), y8); UTIL1_strcat(txtBuf, sizeof(txtBuf), (unsigned char*)" to addr 0x"); #if RNWK_SHORT_ADDR_SIZE==1 UTIL1_strcatNum8Hex(txtBuf, sizeof(txtBuf), RNETA_GetDestAddr()); #else UTIL1_strcatNum16Hex(txtBuf, sizeof(txtBuf), RNETA_GetDestAddr()); #endif UTIL1_strcat(txtBuf, sizeof(txtBuf), (unsigned char*)"\r\n"); SHELL_SendString(txtBuf); } (void)RAPP_SendPayloadDataBlock(buf, sizeof(buf), RAPP_MSG_TYPE_JOYSTICK_XY, RNETA_GetDestAddr(), RPHY_PACKET_FLAGS_REQ_ACK); LED1_Neg(); } #endif #if PL_HAS_WATCHDOG for(i=0; i<2; i++) { /* do it in smaller steps */ WDT_IncTaskCntr(WDT_TASK_ID_REMOTE, 100); FRTOS1_vTaskDelay(100/portTICK_RATE_MS); } #else FRTOS1_vTaskDelay(200/portTICK_RATE_MS); #endif } else { #if PL_HAS_WATCHDOG for(i=0; i<10; i++) { /* do it in smaller steps */ WDT_IncTaskCntr(WDT_TASK_ID_REMOTE, 100); FRTOS1_vTaskDelay(100/portTICK_RATE_MS); } #else FRTOS1_vTaskDelay(1000/portTICK_RATE_MS); #endif } } /* for */
void RAPP_SniffPacket(RPHY_PacketDesc *packet, bool isTx) { uint8_t buf[32]; const CLS1_StdIOType *io; int i; uint8_t dataSize; RNWK_ShortAddrType addr; io = CLS1_GetStdio(); if (isTx) { CLS1_SendStr((unsigned char*)"Packet Tx ", io->stdOut); } else { CLS1_SendStr((unsigned char*)"Packet Rx ", io->stdOut); } UTIL1_strcpy(buf, sizeof(buf), (unsigned char*)"flags: "); UTIL1_strcatNum16s(buf, sizeof(buf), packet->flags); CLS1_SendStr(buf, io->stdOut); if (packet->flags!=RPHY_PACKET_FLAGS_NONE) { CLS1_SendStr((unsigned char*)"(", io->stdOut); if (packet->flags&RPHY_PACKET_FLAGS_IS_ACK) { CLS1_SendStr((unsigned char*)"IS_ACK,", io->stdOut); } if (packet->flags&RPHY_PACKET_FLAGS_REQ_ACK) { CLS1_SendStr((unsigned char*)"REQ_ACK", io->stdOut); } CLS1_SendStr((unsigned char*)")", io->stdOut); } UTIL1_strcpy(buf, sizeof(buf), (unsigned char*)" size: "); UTIL1_strcatNum16s(buf, sizeof(buf), packet->phySize); CLS1_SendStr(buf, io->stdOut); /* PHY */ CLS1_SendStr((unsigned char*)" PHY data: ", io->stdOut); dataSize = RPHY_BUF_SIZE(packet->phyData); for(i=0; i<dataSize+RPHY_HEADER_SIZE;i++) { buf[0] = '\0'; UTIL1_strcatNum8Hex(buf, sizeof(buf), packet->phyData[i]); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)" "); CLS1_SendStr(buf, io->stdOut); } /* MAC */ UTIL1_strcpy(buf, sizeof(buf), (unsigned char*)" MAC size:"); UTIL1_strcatNum8u(buf, sizeof(buf), dataSize); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)" type:"); UTIL1_strcatNum8Hex(buf, sizeof(buf), RMAC_BUF_TYPE(packet->phyData)); CLS1_SendStr(buf, io->stdOut); RMAC_DecodeType(buf, sizeof(buf), packet); CLS1_SendStr(buf, io->stdOut); UTIL1_strcpy(buf, sizeof(buf), (unsigned char*)" s#:"); UTIL1_strcatNum8Hex(buf, sizeof(buf), RMAC_BUF_SEQN(packet->phyData)); CLS1_SendStr(buf, io->stdOut); /* NWK */ UTIL1_strcpy(buf, sizeof(buf), (unsigned char*)" NWK src:"); addr = RNWK_BUF_GET_SRC_ADDR(packet->phyData); #if RNWK_SHORT_ADDR_SIZE==1 UTIL1_strcatNum8Hex(buf, sizeof(buf), addr); #else UTIL1_strcatNum16Hex(buf, sizeof(buf), addr); #endif UTIL1_strcat(buf, sizeof(buf), (unsigned char*)" dst:"); addr = RNWK_BUF_GET_DST_ADDR(packet->phyData); #if RNWK_SHORT_ADDR_SIZE==1 UTIL1_strcatNum8Hex(buf, sizeof(buf), addr); #else UTIL1_strcatNum16Hex(buf, sizeof(buf), addr); #endif CLS1_SendStr(buf, io->stdOut); /* APP */ if (dataSize>RMAC_HEADER_SIZE+RNWK_HEADER_SIZE) { /* there is application data */ UTIL1_strcpy(buf, sizeof(buf), (unsigned char*)" APP type:"); UTIL1_strcatNum8Hex(buf, sizeof(buf), RAPP_BUF_TYPE(packet->phyData)); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)" size:"); UTIL1_strcatNum8Hex(buf, sizeof(buf), RAPP_BUF_SIZE(packet->phyData)); CLS1_SendStr(buf, io->stdOut); } CLS1_SendStr((unsigned char*)"\r\n", io->stdOut); }