ok, so when downlink data from NS server to node..
i need to convert value to Base64 (i use Chirpstack) then send it on Port 2 (as example, i can use API to)
I then need to retreive the value in node.
Example:
int value of "24156"
Convert to HEX: 24156 -> 0x5E5C
Convert HEX to Base64: 0x5E5C -> Xlw=
now send with chirpstack dashboard or API
Great...
now get that value with great LMICPP-Arduino
union ArrayToInteger {
byte array[2];
uint16_t integer;
};
if (LMIC.getDataLen()) {
PRINT_DEBUG(1, F("Received %d bytes of payload - Receive class C"), LMIC.getDataLen());
auto data = LMIC.getData();
if (data) {
uint8_t port = LMIC.getPort();
if (port == 2) {
ArrayToInteger converter; //Create a converter
converter.array[0]=data[1];
converter.array[1]=data[0];
PRINT_DEBUG(1, F("UNION RESULT:"));
PRINT_DEBUG(1, F("Received %02X HEX"), converter.integer);
PRINT_DEBUG(1, F("Received %d Value"), converter.integer);
}
else {
//showText(reinterpret_cast<const char *>(data));
}
}
}
auto data = LMIC.getData(); // i get the my data...
but is there a better way ? i dont what to send text, so i need to convert HEX to base64 in first place..
but i need to receive int value to assign to variable in ESP.
can i get value "directly from data array?" or the method i use are ok?
ok, so when downlink data from NS server to node..
i need to convert value to Base64 (i use Chirpstack) then send it on Port 2 (as example, i can use API to) I then need to retreive the value in node.
Example:
int value of "24156"
Convert to HEX: 24156 -> 0x5E5C Convert HEX to Base64: 0x5E5C -> Xlw=
now send with chirpstack dashboard or API
Great...
now get that value with great LMICPP-Arduino
auto data = LMIC.getData(); // i get the my data...
but is there a better way ? i dont what to send text, so i need to convert HEX to base64 in first place.. but i need to receive int value to assign to variable in ESP.
can i get value "directly from data array?" or the method i use are ok?
many thanks.. :)