Constants and enums
The values the SDK expects you to pass in, and the identifiers it expects you to match on. Prefer these over string literals; an enum member is checked at compile time, a typo in a literal is not.
Everything here is importable from the package root:
import { ESPTransport, ESPSecurity, ESPTransportMode } from "@espressif/rainmaker-neo-base-sdk";
Provisioning
ESPTransport; how the app reaches an unprovisioned device:
| Member | Value |
|---|---|
ble | "ble" |
softap | "softap" |
ESPSecurity, the device's security scheme. Numeric, so ESPSecurity.unsecure is 0, secure is 1, secure2 is 2. Do not pass the names as strings.
ESPProvisionStatus: success or failure, returned by setNetworkCredentials(). Also numeric.
ESPProvResponseStatus; the status on a progress callback: onProgress during the flow, succeed on the final call. String-valued.
ESPConnectStatus: connected, failedToConnect, disconnected. Numeric.
ProvisionType: CHAL_RESP is "chal_resp", the challenge-response flow and the only one implemented. It is the default, so you rarely pass it.
Claiming
ClaimCapabilities: CAMERA_CLAIM is "camera_claim", for devices that stream video.
ESPClaimStatus, the status on a claiming progress callback: inProgress, success, failed, aborted. String-valued.
Transports and subscriptions
ESPTransportMode: mqtt, the transport the SDK ships. Use the enum member in a transport order rather than a raw string; a custom transport uses an arbitrary string instead.
DEFAULT_TRANSPORT_ORDER, the array ["local", "mqtt"]. Exported for reference; the SDK applies it as the default already.
SubscriptionChannelIds: MQTT is "mqtt", the only channel this SDK ships. External channels define their own IDs.
NODE_PARAMS_CHANGED_EVENT: "rmneo.event.node_params_changed", the eventType on every node update.
Events and discovery
ESPRMNeoEventType, the two events user.subscribe() accepts:
| Member | Delivers |
|---|---|
nodeUpdates | Parameter updates from any node |
Time series
TIME_SERIES_PROPERTY is "time_series"; the flag in a parameter's properties array marking it as recorded. Check it before offering a history view:
import { TIME_SERIES_PROPERTY } from "@espressif/rainmaker-neo-base-sdk";
const recorded = light.params.filter((p) => p.properties.includes(TIME_SERIES_PROPERTY));
DEFAULT_NODE_ONLINE_TIMEOUT_MS is 120000 and DEFAULT_NODE_ONLINE_POLL_INTERVAL_MS is 5000, the defaults behind provision()'s online wait.
Error code objects
Each error class has a matching object of codes, all exported: ConfigErrorCodes, APICallValidationErrorCodes, AuthErrorCodes, TokenErrorCodes, ProvErrorCodes, ClaimErrorCodes, ValidationErrorCodes, StorageAdapterErrorCodes. Compare against these instead of typing code strings:
import { ConfigErrorCodes } from "@espressif/rainmaker-neo-base-sdk";
if (error.code === ConfigErrorCodes.SDK_NOT_CONFIGURED) {
// configure the SDK first
}
ErrorLabels holds the class names used as each error's label. See Errors for the codes themselves.
Also exported, but not for you
The barrel re-exports a good deal of the SDK's own machinery: REST path builders (APIPathV1), HTTP verbs, storage keys, and roughly a dozen message catalogues such as NodeSuccessMessages, ScheduleErrorMessages and ClaimProgressMessages.
These are visible because the barrel re-exports a whole module, not because they are supported API. They change without notice and are not part of the SDK's compatibility promise. ESPRMNeoStorageKeys in particular is a separate enum from the keys the SDK actually writes, so do not use it to read the SDK's stored values.
If you find yourself reaching for one of these, the operation you want is probably missing from the documented surface; worth raising rather than working around.
Related
- Errors — the classes these codes belong to
- Provisioning — where the transport and security enums are used
- Transports —
ESPTransportModein a priority order - Events —
ESPRMNeoEventTypein use - Types — the interfaces these values appear in