maxEventDataSize is negative when not connected to the cloud

We've noticed that Particle.maxEventDataSize() returns -210 when the device is not connected to the cloud but 1024 when it is. Is this intended behavior?

Device: BRN402
deviceOS: 5.5

Yes, this is intentional. The values for the event data, variable data, and function argument size are only available when you are connected to the cloud. If not connected, SYSTEM_ERROR_INVALID_STATE (-210) is returned. There's now a mention of that in the docs.

Is there any way to get the max event size for a specific SKU that doesn't change as a function of connectivity? My understanding is that it's mostly SKU driven except that there are some modem's that are different within the same SKU (i.e., boron).

The limits in this page are correct. There's a list of constants which are the values based on the platform ID, not taking into account the cloud imposed limitations and older SARA-R410M-02B modems (LTE Cat M1). The constants are always available and being constants can be used for global or stack allocated arrays.

Okay. So if I were to use particle::protocol::MAX_EVENT_DATA_LENGTH it would return 1024 for any B SoM or Boron if on deviceOS>3.x even if it had a SARA-R410M-02B? Is there to grab the correct size regardless of modem? I've got a large-ish fleet with devices bought over 5+ years, so it's quite likely I have the SARA-R410M-02B.

Correct, it would always return 1024 for an Boron or B SoM with Device OS 3.0.0 or later.

It appears the rule to lower the event data size is that the modem is a SARA-R410 with a firmware version <= 203. The firmware version is hard to get, however. It's extracted from the ATI9 command using this code.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.