HTTP server stream data types. More...

Macros

#define GOS_HS_STREAM_WRITE_ALL (( gos_hs_stream_ws_client_t )UINT32_MAX)

Typedefs

typedef void * gos_hs_stream_ws_client_t
typedef bool(* gos_hs_stream_ws_accept_callback_t ) (void)
Callback for a websocket stream wants to connect. More...
typedef void(* gos_hs_stream_handler_t ) (const char *stream_name, const gos_msgpack_object_t *in_data, gos_msgpack_context_t *out_context, void *arg)
Handler to be invoked when a REST or Websocket clients reads/writes a stream. More...

Enumerations

enum gos_hs_stream_permissions_t {
GOS_HS_STREAM_PERMISSION_NONE = 0,
GOS_HS_STREAM_PERMISSION_READ = (1 << 0),
GOS_HS_STREAM_PERMISSION_WRITE = (1 << 1),
GOS_HS_STREAM_PERMISSION_ALL = 0xFF
}

Detailed Description

HTTP server stream data types.

Macro Definition Documentation

GOS_HS_STREAM_WRITE_ALL

#define GOS_HS_STREAM_WRITE_ALL   (( gos_hs_stream_ws_client_t )UINT32_MAX)

Write all connected websocket clients

This should only be used with gos_hs_stream_ws_write()

Examples:
demo/3d_demo/main.c , demo/accelerometer_stream/main.c , and hurricane/arducam/camera.c .

Typedef Documentation

gos_hs_stream_handler_t

typedef void(* gos_hs_stream_handler_t) (const char *stream_name, const gos_msgpack_object_t *in_data, gos_msgpack_context_t *out_context, void *arg)

Handler to be invoked when a REST or Websocket clients reads/writes a stream.

This handler is registered for a specific stream. It is invoked when either a REST or Websocket client wants to read or write the stream.

If the client is writing the stream then the in_data will be non-null. In this case, the app should use the msgpack APIs to read the in_data being written by the remote client.

If the client is reading the stream then the out_context will be non-null. In this case, the app should use the msgpack APIs to write to the provided gos_msgpack_context_t . After all the data is written, the app must call gos_hs_stream_flush() to send the data to the client.

Note
This handler executes in the application thread context.
Parameters
stream_name[in] The name of the stream that is being read/written
in_data[in] If NOT NULL, this is the data being written from the client to the device.
out_context[in] If NOT NULL, this is a gos_msgpack_context_t context the app should use to write data to the client
arg[in] Argument that was given when the stream handler was registered

gos_hs_stream_ws_accept_callback_t

typedef bool(* gos_hs_stream_ws_accept_callback_t) (void)

Callback for a websocket stream wants to connect.

This is used to disallowed a websocket client from connecting.

Note
Executes in HTTP server thread context
Returns
true if the websocket client is ALLOWED connect, false to stop the websocket client from connecting

gos_hs_stream_ws_client_t

Handle to connected websocket client

This is used to read or write a specific websocket client.

Enumeration Type Documentation

gos_hs_stream_permissions_t

Stream permissions

This specifies the permissions a remote client has for a given stream This is used when registering a stream with gos_hs_stream_register()

Enumerator
GOS_HS_STREAM_PERMISSION_NONE

No permissions.

GOS_HS_STREAM_PERMISSION_READ

Client can read data from stream.

GOS_HS_STREAM_PERMISSION_WRITE

Client can write data to stream.

GOS_HS_STREAM_PERMISSION_ALL

Client has all permissions.