Capsule API Example

Loading...
Searching...
No Matches
Typedefs | Enumerations | Functions
CDeviceLocator.h File Reference
`#include "CDefinesPrivate.h"`
`#include "CDeviceInfoList.h"`
`#include "CError.h"`

Go to the source code of this file.

## Typedefs
typedef enum clCDeviceLocator_FailReason | clCDeviceLocator_FailReason
| Device locator error.
typedef enum clCCapsule_LogLevel | clCCapsule_LogLevel
typedef void(* | clCDeviceLocator_DeviceListHandler) (clCDeviceLocator, clCDeviceInfoList, clCDeviceLocator_FailReason) NOEXCEPT
| Device callback for the list of device info.

## Enumerations
enum | clCDeviceLocator_FailReason { clCDeviceLocator_FailReason_OK = 0 , clCDeviceLocator_FailReason_BluetoothDisabled , clCDeviceLocator_FailReason_Unknown }
| Device locator error. More...
enum | clCCapsule_LogLevel { clCCapsule_LogLevel_Trace , clCCapsule_LogLevel_Debug , clCCapsule_LogLevel_Info , clCCapsule_LogLevel_Warn , clCCapsule_LogLevel_Err , clCCapsule_LogLevel_Critical , clCCapsule_LogLevel_Off }

## Functions
CL_DLL const char * | clCCapsule_GetVersionString () NOEXCEPT
CL_DLL void | clCCapsule_SetSingleThreaded (bool singleThreaded) NOEXCEPT
CL_DLL void | clCCapsule_SetLogLevel (clCCapsule_LogLevel logLevel) NOEXCEPT
CL_DLL clCCapsule_LogLevel | clCCapsule_GetLogLevel () NOEXCEPT
| CLC_CLASS_WN (DeviceLocatorPrivate, clCDeviceLocator)
| Device locator.
CL_DLL clCDeviceLocator | clCDeviceLocator_Create (clCError *error) NOEXCEPT
CL_DLL clCDeviceLocator | clCDeviceLocator_CreateWithLogDirectory (const char *logDirectory, clCError *error) NOEXCEPT
CL_DLL void | clCDeviceLocator_Update (clCDeviceLocator locator) NOEXCEPT
CL_DLL void | clCDeviceLocator_Destroy (clCDeviceLocator locator) NOEXCEPT
CL_DLL void | clCDeviceLocator_RequestDevices (clCDeviceLocator locator, clCDeviceType deviceType, int32_t searchTime, clCError *error) NOEXCEPT
| Find available devices. Search time is in seconds. Searches for available devices of chosen type. Non-blocking - OnDevices event is fired when timeout expires.
CL_DLL void | clCDeviceLocator_SetOnDeviceListEvent (clCDeviceLocator locator, clCDeviceLocator_DeviceListHandler handler) NOEXCEPT

## Typedef Documentation

## ◆ clCCapsule_LogLevel

typedef enum clCCapsule_LogLevel clCCapsule_LogLevel

## ◆ clCDeviceLocator_DeviceListHandler

typedef void(* clCDeviceLocator_DeviceListHandler) (clCDeviceLocator, clCDeviceInfoList, clCDeviceLocator_FailReason) NOEXCEPT

Device callback for the list of device info.

## ◆ clCDeviceLocator_FailReason

typedef enum clCDeviceLocator_FailReason clCDeviceLocator_FailReason

Device locator error.

## Enumeration Type Documentation

## ◆ clCCapsule_LogLevel

enum clCCapsule_LogLevel

Enumerator
clCCapsule_LogLevel_Trace |
clCCapsule_LogLevel_Debug |
clCCapsule_LogLevel_Info |
clCCapsule_LogLevel_Warn |
clCCapsule_LogLevel_Err |
clCCapsule_LogLevel_Critical |
clCCapsule_LogLevel_Off |

## ◆ clCDeviceLocator_FailReason

enum clCDeviceLocator_FailReason

Device locator error.

Enumerator
clCDeviceLocator_FailReason_OK | No error.
clCDeviceLocator_FailReason_BluetoothDisabled | Bluetooth adapter not found or disabled.
clCDeviceLocator_FailReason_Unknown | Unknown error.

## Function Documentation

## ◆ CLC_CLASS_WN()

CLC_CLASS_WN | ( | DeviceLocatorPrivate | ,
|  | clCDeviceLocator | )

Device locator.

## ◆ clCCapsule_GetLogLevel()

CL_DLL clCCapsule_LogLevel clCCapsule_GetLogLevel | ( |  | ) |

Get current filter log level of Capsule

Returns
  log level

## ◆ clCCapsule_GetVersionString()

CL_DLL const char * clCCapsule_GetVersionString | ( |  | ) |

## ◆ clCCapsule_SetLogLevel()

CL_DLL void clCCapsule_SetLogLevel | ( | clCCapsule_LogLevel | logLevel | ) |

Set log level to filter Capsule's log messages

## ◆ clCCapsule_SetSingleThreaded()

CL_DLL void clCCapsule_SetSingleThreaded | ( | bool | singleThreaded | ) |

By default Capsule API operates in multi threaded mode - event callbacks are fired in a background thread. Call this function once before working with Capsule to initiate single-thread mode. In order for Capsule to work in this mode, `clCDeviceLocator_Update` must be called periodically on the main thread. The event callbacks will be called inside `clCDeviceLocator_Update`.

## ◆ clCDeviceLocator_Create()

CL_DLL clCDeviceLocator clCDeviceLocator_Create | ( | clCError * | error | ) |

Create device locator. Log files will not be created

Parameters

  error | out error parameter

Returns
  device locator handle

## ◆ clCDeviceLocator_CreateWithLogDirectory()

CL_DLL clCDeviceLocator clCDeviceLocator_CreateWithLogDirectory | ( | const char * | logDirectory,
|  | clCError * | error )

Create device locator with directory to store log files of Capsule

Parameters

  error | out error parameter
  logDirectory | path to a folder where Capsule logs will be stored

Returns
  device locator handle

## ◆ clCDeviceLocator_Destroy()

CL_DLL void clCDeviceLocator_Destroy | ( | clCDeviceLocator | locator | ) |

Release device locator.

Parameters

  locator | device locator handle

## ◆ clCDeviceLocator_RequestDevices()

CL_DLL void clCDeviceLocator_RequestDevices | ( | clCDeviceLocator | locator,
|  | clCDeviceType | deviceType,
|  | int32_t | searchTime,
|  | clCError * | error )

Find available devices. Search time is in seconds. Searches for available devices of chosen type. Non-blocking - OnDevices event is fired when timeout expires.

Parameters

  locator | device locator handle
  deviceType | device type
  searchTime | search time in seconds
  error | out parameter for error

## ◆ clCDeviceLocator_SetOnDeviceListEvent()

CL_DLL void clCDeviceLocator_SetOnDeviceListEvent | ( | clCDeviceLocator | locator,
|  | clCDeviceLocator_DeviceListHandler | handler )

Subscribe for device list

Parameters

  locator | device locator handle

## ◆ clCDeviceLocator_Update()

CL_DLL void clCDeviceLocator_Update | ( | clCDeviceLocator | locator | ) |

This function should ONLY be called in single-threaded mode. In this mode it should be called periodically from the main thread to fire event callbacks.

Parameters

  locator | device locator handle