This code from RH_RF95.h library works fine, but
is there another way to copy the array?
is there another way to copy the array?
B4X:
ArrayByte* RF95::getReceive() {
Byte buffer[RH_RF95_MAX_MESSAGE_LEN];
Byte len = RH_RF95_MAX_MESSAGE_LEN;
rf95->recv(buffer, &len);
ArrayByte* arr = CreateStackMemoryObject(ArrayByte);
arr->data = (StackMemory::buffer + StackMemory::cp);
for (int i = 0;i < len; i++) {
StackMemory::buffer[StackMemory::cp++] = buffer[i];
}
arr->length=len;
return arr;
}