printf( "[Invalid Size]" );
}
// The detailed error code: Invalid CRC32
if ( pTxReport->m_iQError & WIMINET_IO_REPORT_ER_CRCODE )
{
printf( "[Invalid CRC32]" );
}
// The end of this line
printf( "rn" );
// The Tx data size
printf( " [5] Count=%lurn", pTxReport->m_dwCount );
// The error code
iError |= pTxReport->m_iQError;
}
break;
case WIMINET_EVENT_COMMUTE_ERR:
{
iExit |= 0X02;
printf( " [1] Event=Commute Failurern" );
printf( " [2] Object=0X%04Xrn", iObject );
// The error code
iError |= 0X10;
}
break;
case WIMINET_EVENT_CONNECT_ERR:
{
iExit |= 0X02;
printf( " [1] Event=Connect Failurern" );
printf( " [2] Object=0X%04Xrn", iObject );
// The error code
iError |= 0X20;
}
break;
case WIMINET_EVENT_WOR_COMMUTE:
{
iExit |= 0X01;
printf( " [1] Event=eWOR Commutern" );
printf( " [2] Object=0X%04Xrn", iObject );
// The TxReport status
pTxReport = ( WiMinet_TxReport * )buffer;
// The report status
printf( " [3] Size=%d Bytesrn", iSize );
// The Tx data size
printf( " [4] Count=%lurn", pTxReport->m_dwCount );
}
break;
default:
{
// The message code
printf( " [1] Code=0X%02Xrn", iEvent );
printf( " [2] Object=0X%04Xrn", iObject );
}
break;
}
}
// The unknown error code
return iError;
}
// *****************************************************************************
// Design Notes:
// -----------------------------------------------------------------------------
unsigned char Print_WiMinet_BATVol( void )
{
unsigned char iExit;
unsigned char iAttr;
unsigned char iStatus;
unsigned long dwSize;
unsigned short iSource;
ULARGE_INTEGER qwTimerA;
ULARGE_INTEGER qwTimerB;
WiMinet_RxReport report;
// The exit condition
iExit = 0X00;
// Update the start timer
GetSystemTimeAsFileTime( ( LPFILETIME )&qwTimerA );
// Wait some timer
while ( !iExit )
{
// Update the start timer
GetSystemTimeAsFileTime( ( LPFILETIME )&qwTimerB );
// Get the offset value
qwTimerB.QuadPart -= qwTimerA.QuadPart;
// Check the time out value
if ( qwTimerB.QuadPart >= 0X02UL * X64_SEC_TIMER_CONST )
{
// Convert to mini-second timer
qwTimerB.QuadPart /= X64_MIS_TIMER_CONST;
// The error status
printf( "rn[WiMinet Report=%I64u]:Time Out Errorrn", qwTimerB.QuadPart );
return 0XFF;
}
// Query the Rx status
QueryRxMsgStatus( 0X00, ( char * )&iStatus );
// No received packet arrived
if ( iStatus == RXD_TASK_STATUS_JOB_WAITING )
{
continue;
}
// Check if ready to report
if ( !( iStatus & RXD_TASK_STATUS_REPORTTABLE ) )
{
continue;
}
// Convert to mini-second timer
qwTimerB.QuadPart /= X64_MIS_TIMER_CONST;
// The notice header
printf( "rn[WiMinet Report=%I64u]:rn", qwTimerB.QuadPart );
// The source node address
GetRxMessageNode( 0X00, ( short * )&iSource );
// The packet size
GetRxMessageSize( 0X00, &dwSize );
// The packet attribute
GetRxMessageAttr( 0X00, ( char * )&iAttr );
// Clear this object
memset( &report, 0X00, sizeof( report ) );
// Read this message
ReadInputMessage( 0X00, ( char * )&report, sizeof( report ) );
// The report status
printf( " [1] Size=%lurn", dwSize );
printf( " [2] Attr=0X%02Xrn", iAttr );
printf( " [3] Source=0X%04Xrn", iSource );
printf( " [4] Device=0X%02X(%d)rn", report.m_iDevice, report.m_iDevice );
printf( " [5] Version=0X%08lX", report.m_dwBuild );
// The build version for firmware update
printf(
" --> [20%u.%u.%u+R%u]rn",
( unsigned char )( report.m_dwBuild >> 0X18 ),
( unsigned char )( report.m_dwBuild >> 0X10 ),
( unsigned char )( report.m_dwBuild >> 0X08 ),
( unsigned char )( report.m_dwBuild >> 0X00 ) );
// The received byte size by the remote endpoint
dwSize = ( ( unsigned long )report.m_iMBSize << 0X10 ) + report.m_iLBSize;
// The client received byte size
printf( " [6] Counter=%lu Bytesrn", dwSize );
// The battery voltage
printf( " [7] Battery=%.3f(V)rn", report.m_iBATVol * 0.001f );
// The RxRSSI voltage
printf( " [8] RxRSSI=%d(dBm)rn", report.m_iRxRSSI );
// The RxRSSI voltage
printf( " [9] TxRSSI=%d(dBm)rn", report.m_iTxRSSI );
// The client receive error code
printf( " [A] Error=0X%02X", report.m_iQError );
// The detailed error code: Rx Time Out
if ( report.m_iQError & WIMIET_IO_REPORT_RX_TIMEOUT )
{
printf( " [Rx Time Out]" );
}
// The detailed error code: No Header
if ( report.m_iQError & WIMINET_IO_REPORT_NO_HEADER )
{
printf( "[No Header]" );
}
// The detailed error code: Invalid Size
if ( report.m_iQError & WIMINET_IO_REPORT_ER_AMOUNT )
{
printf( "[Invalid Size]" );
}