static void MHMSUartRx(uint8 port, uint8 event) { uint8 ch[5]; HalUARTRead(MHMS_PORT, ch, 5); dev_gateway = TRUE; //flag that device is acting as device if (ch[2]==0x21) //if statement to check for command from Mobile Health Monitor Software { sysPingRsp(); //Ping sent back to Mobile Health Monitor Software //syncAttempted=TRUE; zapSync(); if(znpPanId == INVALID_PAN_ID){ //if still invalid id, there is no PAN so set one up by becoming the coordinator if(zap_set_logicalType(ZG_DEVICETYPE_COORDINATOR)){ HalLcdWriteString("Initilizing NWK...",HAL_LCD_LINE_7); } else{ HalLcdWriteString("Problem",HAL_LCD_LINE_7); } } else{ MHMSAddr = znpAddr; if (ZSuccess != osal_start_timerEx(MHMSTaskId, MHMS_EVT_ANN, MHMS_DLY_ANN)) { (void)osal_set_event(MHMSTaskId, MHMS_EVT_ANN); } } } }
void sysPingReqRcvd(void) { sysPingRsp(); }
static void pulseUartRx(uint8 port, uint8 event) { #ifdef TVSA_DEMO uint8 ch; while (HalUARTRead(PULSE_PORT, &ch, 1)) { switch (pulseState) { case SOP_STATE: if (PULSE_SOP_VAL == ch) { pulseState = CMD_STATE; } break; case CMD_STATE: pulseCmd = ch; pulseState = FCS_STATE; break; case FCS_STATE: if (pulseCmd == ch) { if (pulseCmd == PULSE_CMD_BEG) { pulseAddr = NLME_GetShortAddr(); } else if (pulseCmd == PULSE_CMD_END) { pulseAddr = INVALID_NODE_ADDR; } (void)osal_set_event(pulseTaskId, PULSE_EVT_ANN); } pulseState = SOP_STATE; break; default: break; } } #else uint8 ch[5]; HalUARTRead(PULSE_PORT, ch, 5); if (ch[2]==0x21) //if statement to check for command from Z-Sensor Monitor { sysPingRsp(); //syncAttempted=TRUE; zapSync(); if(znpPanId == INVALID_PAN_ID){ //if still invalid id, there is no PAN so set one up by becomeing the coordinator if(zap_set_logicalType(ZG_DEVICETYPE_COORDINATOR)){ HalLcdWriteString("Should be Coord.",HAL_LCD_LINE_7); } else{ HalLcdWriteString("Problem",HAL_LCD_LINE_7); } } else{ pulseAddr = znpAddr; if (ZSuccess != osal_start_timerEx(pulseTaskId, PULSE_EVT_ANN, PULSE_DLY_ANN)) { (void)osal_set_event(pulseTaskId, PULSE_EVT_ANN); } } } #endif }