// Autogenerated C header file for WSSK
#ifndef _JACDAC_SPEC_WSSK_H
#define _JACDAC_SPEC_WSSK_H 1

#define JD_SERVICE_CLASS_WSSK  0x13b739fe

// enum StreamingType (uint16_t)
#define JD_WSSK_STREAMING_TYPE_JACDAC 0x1
#define JD_WSSK_STREAMING_TYPE_DMESG 0x2
#define JD_WSSK_STREAMING_TYPE_EXCEPTIONS 0x100
#define JD_WSSK_STREAMING_TYPE_TEMPORARY_MASK 0xff
#define JD_WSSK_STREAMING_TYPE_PERMAMENT_MASK 0xff00
#define JD_WSSK_STREAMING_TYPE_DEFAULT_MASK 0x100

// enum DataType (uint8_t)
#define JD_WSSK_DATA_TYPE_BINARY 0x1
#define JD_WSSK_DATA_TYPE_JSON 0x2

/**
 * Argument: message string (bytes). Issued when a command fails.
 */
#define JD_WSSK_CMD_ERROR 0xff

/**
 * Argument: status StreamingType (uint16_t). Enable/disable forwarding of all Jacdac frames, exception reporting, and `dmesg` streaming.
 */
#define JD_WSSK_CMD_SET_STREAMING 0x90

/**
 * Argument: payload bytes. Send from gateway when it wants to see if the device is alive.
 * The device currently only support 0-length payload.
 */
#define JD_WSSK_CMD_PING_DEVICE 0x91

/**
 * Report: Argument: payload bytes
 */

/**
 * Argument: payload bytes. Send from device to gateway to test connection.
 */
#define JD_WSSK_CMD_PING_CLOUD 0x92

/**
 * Report: Argument: payload bytes
 */

/**
 * No args. Get SHA256 of the currently deployed program.
 */
#define JD_WSSK_CMD_GET_HASH 0x93

/**
 * Report: Argument: sha256 u8[32] (bytes)
 */

/**
 * Argument: size B uint32_t. Start deployment of a new program.
 */
#define JD_WSSK_CMD_DEPLOY_START 0x94

/**
 * Report: No args
 */

/**
 * Argument: payload bytes. Payload length must be multiple of 32 bytes.
 */
#define JD_WSSK_CMD_DEPLOY_WRITE 0x95

/**
 * Report: No args
 */

/**
 * No args. Finish deployment.
 */
#define JD_WSSK_CMD_DEPLOY_FINISH 0x96

/**
 * Report: No args
 */

/**
 * Upload a labelled tuple of values to the cloud.
 * The tuple will be automatically tagged with timestamp and originating device.
 */
#define JD_WSSK_CMD_C2D 0x97
typedef struct jd_wssk_c2d {
    uint8_t datatype;  // DataType
    char topic[0];  // string0
    // uint8_t payload[0];
} jd_wssk_c2d_t;


/**
 * Upload a binary message to the cloud.
 */
#define JD_WSSK_CMD_D2C 0x98
typedef struct jd_wssk_d2c_report {
    uint8_t datatype;  // DataType
    char topic[0];  // string0
    // uint8_t payload[0];
} jd_wssk_d2c_report_t;


/**
 * Argument: frame bytes. Sent both ways.
 */
#define JD_WSSK_CMD_JACDAC_PACKET 0x99

/**
 * Report: Argument: frame bytes
 */

/**
 * Argument: logs bytes. The `logs` field is string in UTF-8 encoding, however it can be split in the middle of UTF-8 code point.
 * Controlled via `dmesg_en`.
 */
#define JD_WSSK_CMD_DMESG 0x9a

/**
 * Argument: logs bytes. The format is the same as `dmesg` but this is sent on exceptions only and is controlled separately via `exception_en`.
 */
#define JD_WSSK_CMD_EXCEPTION_REPORT 0x9b

#endif
