BSB Developer Docs
Loading...
Searching...
No Matches
ble_system_command.h File Reference

Available ble commands definition and common methods. More...

#include "ble.h"
#include "ble_intercom_types.h"

Go to the source code of this file.

Data Structures

struct  BleCommandItem
 Struct for one command handlers. More...
 

Typedefs

typedef bool(* BleCommandHandler) (BleIntercomFrameGeneric *frame, void *context)
 Command handler callback function type.
 

Enumerations

enum  BleSystemCommand {
  BleCommandUnknown , BleCommandInit , BleCommandDeinit , BleCommandEnable ,
  BleCommandDisable , BleCommandGetStatus , BleCommandSetStatus , BleCommandForgetPairing ,
  BleCommandCount
}
 Enumeration of possible ble commands. More...
 

Functions

bool ble_command_request_process (BleIntercomFrameGeneric *frame, void *context)
 Send frame as a request to another side.
 
bool ble_command_response_process (BleIntercomFrameGeneric *frame, void *context)
 Send frame as a response to another side.
 
bool ble_command_deinit_process (BleIntercomFrameGeneric *frame, void *context)
 Deinit all ble services in case of an error.
 

Variables

const BleCommandItem ble_commands []
 Array with command handlers.
 

Detailed Description

Available ble commands definition and common methods.

Typedef Documentation

◆ BleCommandHandler

typedef bool(* BleCommandHandler) (BleIntercomFrameGeneric *frame, void *context)

Command handler callback function type.

Parameters
[in]framePointer to frame
[in]contextExecution context
Returns
true when handling was fine, otherwise false

Enumeration Type Documentation

◆ BleSystemCommand

Enumeration of possible ble commands.

Some commands are used internally, others by public api. In general almost all commands are processed as request/response pair. If one side sends command as a request then other side performs command and sends back a response with a result.

Enumerator
BleCommandInit 

Internal command used to init ble at device startup, sends automatically when all requirements are met.

BleCommandDeinit 

Internal command used to deinit ble if some serious failures occurred.

BleCommandEnable 

Enable ble.

After this command device becomes visible for all scanning devices or for paired one only. Used in ble_start

BleCommandDisable 

Disable ble.

Used by ble_stop

BleCommandGetStatus 

Get ble status.

Used by ble_get_state

BleCommandSetStatus 

Internal command, used to update status from SiWG917 to U5.

BleCommandForgetPairing 

Forget currently paired remote device.

Used by ble_forget

BleCommandCount 

Commands count.

Function Documentation

◆ ble_command_deinit_process()

bool ble_command_deinit_process ( BleIntercomFrameGeneric * frame,
void * context )

Deinit all ble services in case of an error.

This function contains common logic for BleCommandDeinit shared by both sides and is called when some serious error happened and there is a need to shut down all internal ble services.

Parameters
[in]framepointer to frame to be sent
[in]contextfor frame processing
Returns
always false

◆ ble_command_request_process()

bool ble_command_request_process ( BleIntercomFrameGeneric * frame,
void * context )

Send frame as a request to another side.

Parameters
[in]framepointer to frame to be sent
[in]contextfor frame processing
Returns
true if send operation was success, otherwise false

◆ ble_command_response_process()

bool ble_command_response_process ( BleIntercomFrameGeneric * frame,
void * context )

Send frame as a response to another side.

Parameters
[in]framepointer to frame to be sent
[in]contextfor frame processing
Returns
true if send operation was successful, otherwise false

Variable Documentation

◆ ble_commands

const BleCommandItem ble_commands[]
extern

Array with command handlers.

Each side has its own command handlers implementation which are placed in ble_system_command_u5.c for U5 and and ble_system_command_917.c for 917. This array is used for command engine initialization