diff options
-rw-r--r-- | src/phFriNfc_LlcpTransport_Connection.c | 16 | ||||
-rw-r--r-- | src/phFriNfc_LlcpUtils.c | 14 | ||||
-rw-r--r-- | src/phFriNfc_LlcpUtils.h | 4 |
3 files changed, 14 insertions, 20 deletions
diff --git a/src/phFriNfc_LlcpTransport_Connection.c b/src/phFriNfc_LlcpTransport_Connection.c index 2db1192..7475b42 100644 --- a/src/phFriNfc_LlcpTransport_Connection.c +++ b/src/phFriNfc_LlcpTransport_Connection.c @@ -1973,7 +1973,7 @@ NFCSTATUS phFriNfc_LlcpTransport_ConnectionOriented_Accept(phFriNfc_LlcpTranspor NFCSTATUS status = NFCSTATUS_SUCCESS; uint32_t offset = 0; - uint16_t miux; + uint8_t miux[2]; uint8_t i; /* Store the options in the socket */ @@ -2023,15 +2023,15 @@ NFCSTATUS phFriNfc_LlcpTransport_ConnectionOriented_Accept(phFriNfc_LlcpTranspor if(pLlcpSocket->localMIUX != PHFRINFC_LLCP_MIUX_DEFAULT) { /* Encode MIUX value */ - phFriNfc_Llcp_EncodeMIUX(&pLlcpSocket->localMIUX, - &miux); + phFriNfc_Llcp_EncodeMIUX(pLlcpSocket->localMIUX, + miux); /* Encode MIUX in TLV format */ status = phFriNfc_Llcp_EncodeTLV(&pLlcpSocket->sSocketSendBuffer, &offset, PHFRINFC_LLCP_TLV_TYPE_MIUX, PHFRINFC_LLCP_TLV_LENGTH_MIUX, - (uint8_t*)&miux); + miux); if(status != NFCSTATUS_SUCCESS) { /* Call the CB */ @@ -2178,7 +2178,7 @@ NFCSTATUS phFriNfc_LlcpTransport_ConnectionOriented_Connect( phFriNfc_LlcpTransp NFCSTATUS status = NFCSTATUS_SUCCESS; uint32_t offset = 0; - uint16_t miux = 0; + uint8_t miux[2]; /* Test if a nSap is present */ if(nSap != PHFRINFC_LLCP_SAP_DEFAULT) @@ -2205,15 +2205,15 @@ NFCSTATUS phFriNfc_LlcpTransport_ConnectionOriented_Connect( phFriNfc_LlcpTransp if(pLlcpSocket->localMIUX != PHFRINFC_LLCP_MIUX_DEFAULT) { /* Encode MIUX value */ - phFriNfc_Llcp_EncodeMIUX(&pLlcpSocket->localMIUX, - &miux); + phFriNfc_Llcp_EncodeMIUX(pLlcpSocket->localMIUX, + miux); /* Encode MIUX in TLV format */ status = phFriNfc_Llcp_EncodeTLV(&pLlcpSocket->sSocketSendBuffer, &offset, PHFRINFC_LLCP_TLV_TYPE_MIUX, PHFRINFC_LLCP_TLV_LENGTH_MIUX, - (uint8_t*)&miux); + miux); if(status != NFCSTATUS_SUCCESS) { return status = PHNFCSTVAL(CID_FRI_NFC_LLCP_TRANSPORT, NFCSTATUS_FAILED); diff --git a/src/phFriNfc_LlcpUtils.c b/src/phFriNfc_LlcpUtils.c index 3927552..872fd51 100644 --- a/src/phFriNfc_LlcpUtils.c +++ b/src/phFriNfc_LlcpUtils.c @@ -127,20 +127,14 @@ NFCSTATUS phFriNfc_Llcp_EncodeTLV( phNfc_sData_t *psValueBuffer, } /* TODO: comment function EncodeMIUX */ -void phFriNfc_Llcp_EncodeMIUX(uint16_t* pMiux, - uint16_t* pMiuxEncoded) +void phFriNfc_Llcp_EncodeMIUX(uint16_t miux, + uint8_t* pMiuxEncoded) { - uint16_t miux = *pMiux; - uint8_t encodeBuffer[2]; - /* MASK */ miux = miux & PHFRINFC_LLCP_TLV_MIUX_MASK; - encodeBuffer[0] = miux >> 8; - encodeBuffer[1] = (uint8_t)miux; - - /* Set the new value of MIUX */ - *pMiuxEncoded =(encodeBuffer[0]) + (encodeBuffer[1] *16*16); + pMiuxEncoded[0] = miux >> 8; + pMiuxEncoded[1] = miux & 0xff; } /* TODO: comment function EncodeRW */ diff --git a/src/phFriNfc_LlcpUtils.h b/src/phFriNfc_LlcpUtils.h index 7d789e5..a1004a1 100644 --- a/src/phFriNfc_LlcpUtils.h +++ b/src/phFriNfc_LlcpUtils.h @@ -70,8 +70,8 @@ NFCSTATUS phFriNfc_Llcp_EncodeTLV( phNfc_sData_t *psValueBuffer, uint8_t length, uint8_t *pValue); -void phFriNfc_Llcp_EncodeMIUX(uint16_t* pMiux, - uint16_t* pMiuxEncoded); +void phFriNfc_Llcp_EncodeMIUX(uint16_t pMiux, + uint8_t* pMiuxEncoded); void phFriNfc_Llcp_EncodeRW(uint8_t *pRw); |