Notecards skipping JSON (Transparent Mode)

Hello, I want to know if Notecards can be used in Transparent Mode, skipping JSON to comunicate with cloud. We are using MCU 16bits with low consumption and with own protocol which is not compatible with JSON .

Thanks.

Hi @marc.palma.inolve! We’re glad to have you on the forums!

Can you give an example of the data format and size you are trying to send?

We have multiple options for transforming your data cloud-side (JSONata), or sending encoded binary payloads if that’s right for your data.

It would be much easier to guide you down a path if I better understood the shape of your data.

Cheers,
Zak

1 Like

We are just sending in raw data a packet with 22bytes HEADER, 64 bytes PAYLOAD and CHECKSUM, maximum length packet of 97 bytes.

For example, our MCU sends via UART to WIFI Module in transparent mode:
5B D0 00 10 BF AA 78 74 2F 05 1C 93 AF 74 78 74 2F 05 1C 93 59 E8 59 CB AA B0 03 01 48 14 28 EB 76 DA 45 F7 0C 1B
and our server are waiting the same data via socket.

Based on that, I would suggest using the special payload field of the note.add API.

Effectively, you would base64 encode the raw packet, then you can deliver the encoded payload to your server then decode it and go.

Best,
Zak

Using this note.add , which packet I have to send to notecard? The following example would be correct?

{
“req”: “note.add”,
“file”: “xxxx”,
“payload”: { 5B D0 00 10 BF AA 78 74 2F 05 1C 93 AF 74 78 74 2F 05 1C 93 59 E8 59 CB AA B0 03 01 48 14 28 EB 76 DA 45 F7 0C 1B },
}

For my understand, our server will get all data, so can decode payload and go, right?

Thanks

Very close!

Here is an example in C:

  uint8_t * buf = { 0x5B, 0xD0, 0x00, 0x10, 0xBF, 0xAA, 0x78, 0x74, 0x2F, 0x05, 0x1C, 0x93, 0xAF, 0x74, 0x78, 0x74, 0x2F, 0x05, 0x1C, 0x93, 0x59, 0xE8, 0x59, 0xCB, 0xAA, 0xB0, 0x03, 0x01, 0x48, 0x14, 0x28, 0xEB, 0x76, 0xDA, 0x45, 0xF7, 0x0C, 0x1B };
  size_t size = 38;

  if (J * req = NoteNewRequest("note.add")) {
    JAddStringToObject(req, "file", "xxxx");
    JAddBinaryToObject(req, "payload", buf, size);
    J * rsp = NoteRequestResponse(req);
    if (NoteResponseError(rsp)) {
      const char *err = JGetString(rsp, "err");
      // Error: Described by `err` field
    } else {
      // No errors
    }
    JDelete(rsp);
  } else {
    // Error: Unable to allocate memory
  }
1 Like

Hi Zak,

One question, do you provide the libraries/Drivers to comunicate with your notecards? As my understand, our Device will comunicate with Notecard via UART, and our device must add the note.add API to comunicate correctly with Notecard, right?

According to the previous example, we would need the libraries to encode our raw data packet, in the correct form to be read for notecards.

We found some examples in arduino but, we didn’t found the libraries to be used for the “NoteNewRequest” call or “JAddStringToObject”, etc…

Thanks for all.

Hello again @marc.palma.inolve,

We offer three SDKs:

  1. note-c, a C-based API that will give you all the APIs you mentioned above.

  2. note-arduino, a C++ wrapper around note-c, which gives you the entire API of note-c plus a common Arduino-isms and makes it easy to install via the Arduino Library Manager.

  3. note-python, a Python-based API.