client version of coap
Dependencies: nRF24L01P cantcoap3
Diff: coapClient.cpp
- Revision:
- 1:1d936c763440
- Parent:
- 0:6a6f97ca5572
- Child:
- 2:e8823d9fa162
--- a/coapClient.cpp Fri Jan 18 14:12:24 2019 +0000 +++ b/coapClient.cpp Sun Jan 20 13:48:02 2019 +0000 @@ -3,7 +3,7 @@ // #include <cstring> -#include "CoapClient.h" +#include "coapClient.h" bool match_uri(CoapPDU& coapPDU, char* uri) { @@ -14,12 +14,12 @@ } -bool isExpectedResponse(CoapPDU& response, u_int16_t message_id, char* uri) { +bool isExpectedResponse(CoapPDU& response, uint16_t message_id, char* uri) { return match_uri(response, uri) && response.getType() == CoapPDU::COAP_ACKNOWLEDGEMENT && response.getMessageID() == message_id; } -bool CoapClient::isAck(CoapPDU& response, u_int16_t message_id, char* uri) { +bool CoapClient::isAck(CoapPDU& response, uint16_t message_id, char* uri) { if (response.validate()) { if (isExpectedResponse(response, message_id, uri)) { return true; @@ -145,11 +145,8 @@ return this->message_counter++; } -CoapClient::CoapClient(uint8_t* token, int retransmissionLimit, int timeout, RadioWrapper& radio) : radioWrapper(radio), - listeningTimeout( - timeout), - retransmissionLimit( - retransmissionLimit) { +CoapClient::CoapClient(uint8_t* token, int retransmissionLimit, int timeout, int channel, unsigned long long rx_address, unsigned long long tx_address) : +listeningTimeout(timeout), retransmissionLimit(retransmissionLimit), radioWrapper(channel, rx_address, tx_address) { std::memcpy(this->token, token, 4); this->message_counter = 16; }