I'm working on a mesh where every node take a picture, encode it in base64 and send the result to the root node. The encoded array is 'unsigned char' but the function used to send the data to the root node via mesh accepts a String. And if I try to create a String from the 'unsigned char' array I get the error: invalid conversion from 'unsigned char' to 'const char*'*.
unsigned char* base64 = (unsigned char*)heap_caps_malloc(4*(_jpg_buf_len/3)+1, MALLOC_CAP_8BIT); if (base64 == NULL) Serial.println("Can not malloc memory"); unsigned int base64_length = encode_base64(_jpg_buf, _jpg_buf_len, base64); //unsigned int encode_base64(unsigned char input, unsigned int input_length, unsigned char output); String to = bridgeNodeName; mesh.sendSingle(to, base64); //bool painlessMesh::sendSingle(uint32_t dest, String &msg)
What's the best method to avoid this problem?