2015-03-15 20:45:52 +01:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief Implementation of lw_readelem_wtp_board_data
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
2015-04-10 17:52:01 +02:00
|
|
|
#include "log.h"
|
2015-03-15 20:45:52 +01:00
|
|
|
#include "wtpinfo.h"
|
|
|
|
|
|
|
|
#include "lwapp.h"
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Read LWAPP board data element
|
|
|
|
* @param wtpinfo results are stored here
|
|
|
|
* @param type type of msg element (must be LWMSGELEM_WTP_BOARD_DATA)
|
|
|
|
* @param msgelem msg element data
|
|
|
|
* @param len length of msg element
|
|
|
|
* @return 0 if msg is not wtp board data\n
|
|
|
|
* 1 board data successful read
|
|
|
|
*/
|
|
|
|
int lw_readelem_wtp_board_data(struct wtpinfo *wtpinfo, int type, uint8_t *msgelem, int len)
|
|
|
|
{
|
2015-03-23 07:48:27 +01:00
|
|
|
if (type != LW_ELEM_WTP_BOARD_DATA)
|
2015-03-15 20:45:52 +01:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
if ( len != 46 ) {
|
2015-03-31 08:04:03 +02:00
|
|
|
cw_dbg(DBG_MSG_ERR,"LWAPP msg size wrong. (WTP BOARD DATA) must be 46");
|
2015-03-15 20:45:52 +01:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2015-03-16 02:41:35 +01:00
|
|
|
// uint16_t card_id = htonl( * ( (uint16_t*)(msgelem) ) );
|
|
|
|
// uint16_t card_rev = htonl( * ( (uint16_t*)(msgelem +2 ) ) );
|
2015-03-15 20:45:52 +01:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|