/********************************************************************* * @fn zclHA_LcdStatusLine1 * * @brief Display LCD line 1 with network status * only call after on network * ZC: PPPP CH ADDR * ZR: PPPP CH ADDR * ZE: PPPP CH ADDR * * @param kind (0=ZC, 1=ZR, 2=ZED) * * @return none */ void zclHA_LcdStatusLine1( uint8 kind ) { #if defined ( LCD_SUPPORTED ) char szLine[20]; // copy in what node type it is if ( kind > ZCL_HA_DEVICE_END_DEVICE ) { return; } // ZE: PANx CH ADDR osal_memcpy( szLine, NwkInfoStrs[kind], 4 ); zclHA_uint16toa( _NIB.nwkPanId, &szLine[4] ); szLine[8] = ' '; _ltoa( _NIB.nwkLogicalChannel, (void *)(&szLine[9]), 10 ); szLine[11] = ' '; zclHA_uint16toa( _NIB.nwkDevAddress, &szLine[12] ); HalLcdWriteString( (char*)szLine, HAL_LCD_LINE_1 ); #endif }
/********************************************************************* * @fn zclSampleTemperatureSensor_EZModeCB * * @brief The Application is informed of events. This can be used to show on the UI what is * going on during EZ-Mode steering/finding/binding. * * @param state - an * * @return none */ static void zclSampleTemperatureSensor_EZModeCB( zlcEZMode_State_t state, zclEZMode_CBData_t *pData ) { #ifdef LCD_SUPPORTED char szLine[20]; char *pStr; uint8 err; #endif // time to go into identify mode if ( state == EZMODE_STATE_IDENTIFYING ) { zclSampleTemperatureSensor_IdentifyTime = ( EZMODE_TIME / 1000 ); // convert to seconds zclSampleTemperatureSensor_ProcessIdentifyTimeChange(); } // autoclosing, show what happened (success, cancelled, etc...) if( state == EZMODE_STATE_AUTOCLOSE ) { #ifdef LCD_SUPPORTED pStr = NULL; err = pData->sAutoClose.err; if ( err == EZMODE_ERR_SUCCESS ) { pStr = "EZMode: Success"; } else if ( err == EZMODE_ERR_NOMATCH ) { pStr = "EZMode: NoMatch"; // not a match made in heaven } if ( pStr ) { if ( giTemperatureSensorScreenMode == TEMPSENSE_MAINMODE ) { HalLcdWriteString ( pStr, HAL_LCD_LINE_2 ); } } #endif } // finished, either show DstAddr/EP, or nothing (depending on success or not) if( state == EZMODE_STATE_FINISH ) { // turn off identify mode zclSampleTemperatureSensor_IdentifyTime = 0; zclSampleTemperatureSensor_ProcessIdentifyTimeChange(); #ifdef LCD_SUPPORTED // if successful, inform user which nwkaddr/ep we bound to pStr = NULL; err = pData->sFinish.err; if( err == EZMODE_ERR_SUCCESS ) { // "EZDst:1234 EP:34" osal_memcpy( szLine, "EZDst:", 6 ); zclHA_uint16toa( pData->sFinish.nwkaddr, &szLine[6] ); osal_memcpy( &szLine[10], " EP:", 4 ); _ltoa( pData->sFinish.ep, (void *)(&szLine[14]), 16 ); // _ltoa NULL terminates pStr = szLine; } else if ( err == EZMODE_ERR_BAD_PARAMETER ) { pStr = "EZMode: BadParm"; } else if ( err == EZMODE_ERR_CANCELLED ) { pStr = "EZMode: Cancel"; } else { pStr = "EZMode: TimeOut"; } if ( pStr ) { if ( giTemperatureSensorScreenMode == TEMPSENSE_MAINMODE ) { HalLcdWriteString ( pStr, HAL_LCD_LINE_2 ); } } #endif // LCD_SUPPORTED // show main UI screen 3 seconds after joining network osal_start_timerEx( zclSampleTemperatureSensor_TaskID, SAMPLETEMPERATURESENSOR_MAIN_SCREEN_EVT, 3000 ); // report current temperature reading 15 seconds after joinging the network osal_start_timerEx( zclSampleTemperatureSensor_TaskID, SAMPLETEMPERATURESENSOR_TEMP_SEND_EVT, SAMPLETEMPERATURESENSOR_REPORT_INTERVAL ); } }