BACnetStack_RegisterCallbackSCStartListening
void BACnetStack_RegisterCallbackSCStartListening( bool (*FPCallbackSCStartListening)(const char *websocketUri, const uint32_t websocketUriLength));Registers the callback the stack calls to ask the host to start ACCEPTING inbound WebSocket connections on a URI - the hub-function and direct-connect accept roles.
Fires from inside Tick().
MANDATORY FOR ANY ACCEPT ROLE. With hub-function or direct-connect accept enabled and this callback unregistered, the BACnet/SC data link logs “CallbackSCStartListening has not been registered” and refuses to run, so the device never listens.
THE RETURN IS HONORED. The stack marks itself listening only when you return true, and retries on every subsequent Tick while you return false. Do not report success for a listener you did not open.
ACCEPTED CONNECTIONS: the stack has no “peer accepted” callback. For every WebSocket accepted on a listening URI, the host chooses a connection string of the form <acceptUri>|client=<token>, where <acceptUri> is exactly the URI passed to this callback and <token> is non-empty, unique among open sockets, and stable for the socket’s lifetime. Pass that string as sourceConnectionString on every ReceiveMessageForPort for that socket; the stack passes it back as connectionString when it sends to that peer. The whole string must fit maxConnectionStringLength. The bare <acceptUri> is never a send target for a specific peer. See the BACnet/SC manual section 18.3.1.
The URI is stack-owned and NUL-terminated, valid only for the duration of the call; the length excludes the terminator. Registering has no effect if BACnet/SC was not compiled (STACK_OPTION_DATA_LINK_LAYER_SC).
See also: CASBACnetStack::FPCallbackSCStartListening
Parameters
Section titled “Parameters”| Parameter | Direction | Description |
|---|---|---|
FPCallbackSCStartListening |
in | The function pointer for the CallbackSCStartListening function. See CASBACnetStack::FPCallbackSCStartListening for more info. |
Callback type
Section titled “Callback type”Topic: BACnet/SC. Declared in CASBACnetStackDLL.h.