SDK Package
High-level mesh manager, model extensions, and shared SDK types used across runtimes.
This page is auto-generated from packages/sdk/src/** and the public exports exposed by @blemeshjs/sdk.
Update TSDoc comments in source, then run
yarn workspace docs api:generate. Normal docsdev,build, andtypes:checkruns regenerate these pages automatically.
Package overview
| Field | Value |
|---|---|
| Package | @blemeshjs/sdk |
| Entry point | packages/sdk/src/index.ts |
| Source tree | packages/sdk/src/** |
Package notes
This package also re-exports symbols from @blemeshjs/utils. This page focuses on the runtime-specific exports declared in packages/sdk/src/**.
Export map
| Export | Kind | Summary |
|---|---|---|
| ClassInstance | Type alias | No description yet. |
| CompositeLogger | Class | No description yet. |
| ConnectionStatus | Type alias | No description yet. |
| ConsoleLogger | Class | No description yet. |
| CoreMeshNetworkManager | Class | No description yet. |
| createProxy | Function | No description yet. |
| DiscoveredProxyPeripheral | Type alias | No description yet. |
| DiscoveredUnprovisionedPeripheral | Type alias | No description yet. |
| Element | Type alias | No description yet. |
| GenericOnOff | Variable | No description yet. |
| InternalElement | Class | No description yet. |
| InternalModel | Class | No description yet. |
| InternalNode | Class | No description yet. |
| keysOf | Function | No description yet. |
| logger | Variable | No description yet. |
| MeshNetworkManager | Class | No description yet. |
| MeshNetworkManagerError | Class | No description yet. |
| Model | Type alias | No description yet. |
| ModelExtension | Type alias | No description yet. |
| NetworkConnection | Class | No description yet. |
| NetworkConnectionEvents | Type alias | No description yet. |
| networkIdentity | Function | No description yet. |
| NewKey | Type alias | No description yet. |
| Node | Type alias | No description yet. |
| NodeError | Class | No description yet. |
| NodeEvents | Type alias | No description yet. |
| nodeIdentity | Function | No description yet. |
| ProvisioningManager | Class | No description yet. |
| ProvisionScanOptions | Type alias | No description yet. |
| ProxyScanOptions | Type alias | No description yet. |
| ScanError | Class | No description yet. |
| ScanOptions | Type alias | No description yet. |
Exported API
ClassInstance
Kind: Type alias
Source: packages/sdk/src/types/index.ts#L9
type ClassInstance<T> = T extends { prototype: infer R } ? R : never;CompositeLogger
Kind: Class
Source: packages/sdk/src/types/logger.ts#L54
class CompositeLogger extends unknownConstructors
| Name | Signature | Description |
|---|---|---|
constructor | CompositeLogger(handlers: LoggerHandler[]): CompositeLogger; | No description yet. |
Methods
| Name | Signature | Description |
|---|---|---|
log | log(message: string, category: LogCategory, level: LogLevel): void; | No description yet. |
ConnectionStatus
Kind: Type alias
Source: packages/sdk/src/mesh-network/network-connection.ts#L29
type ConnectionStatus = "waiting-for-advertisements" | "connecting" | "discovering-services" | "initializing" | "connected" | "disconnected";ConsoleLogger
Kind: Class
Source: packages/sdk/src/types/logger.ts#L3
class ConsoleLogger extends unknownConstructors
| Name | Signature | Description |
|---|---|---|
constructor | ConsoleLogger(minLevel: LogLevel): ConsoleLogger; | No description yet. |
Methods
| Name | Signature | Description |
|---|---|---|
log | log(message: string, category: LogCategory, level: LogLevel): void; | No description yet. |
CoreMeshNetworkManager
Kind: Class
Source: packages/sdk/src/mesh-network/core-mesh-network-manager.ts#L13
class CoreMeshNetworkManager extends unknownConstructors
| Name | Signature | Description |
|---|---|---|
constructor | CoreMeshNetworkManager(storage: Storage, MeshDataClass: MeshDataCtor<MeshData>, MeshNetworkClass: MeshNetworkCtor<MeshNetwork>): CoreMeshNetworkManager; | No description yet. |
Properties
| Name | Type | Description |
|---|---|---|
$instance | CoreMeshNetworkManager | No description yet. |
localProvisionerNode | unknown | No description yet. |
nodes | unknown | No description yet. |
instance | unknown | No description yet. |
Methods
| Name | Signature | Description |
|---|---|---|
initialize | initialize(storage: Storage): CoreMeshNetworkManager; | No description yet. |
createProxy
Kind: Function
Source: packages/sdk/src/types/proxy.ts#L2
function createProxy<TInternal, TPublic, TAllowedMethods, TAllowedProps>(node: TInternal, api: TPublic, allowedMethods: TAllowedMethods, allowedProps: TAllowedProps): TPublic & Pick<TInternal, TAllowedMethods[number]> & Pick<TInternal, TAllowedProps[number]>;DiscoveredProxyPeripheral
Kind: Type alias
Source: packages/sdk/src/types/scan.ts#L18
type DiscoveredProxyPeripheral = unknown;Properties
| Name | Type | Description |
|---|---|---|
device | GattBearer | No description yet. |
rssi | Int32 | No description yet. |
DiscoveredUnprovisionedPeripheral
Kind: Type alias
Source: packages/sdk/src/types/scan.ts#L12
type DiscoveredUnprovisionedPeripheral = unknown;Properties
| Name | Type | Description |
|---|---|---|
bearer | ProvisioningBearer[] | No description yet. |
device | UnprovisionedDevice | No description yet. |
rssi | number[] | No description yet. |
Element
Kind: Type alias
Source: packages/sdk/src/mesh-models/element.ts#L7
type Element = ReturnType<typeof toProxy>;GenericOnOff
Kind: Variable
Source: packages/sdk/src/model-extensions/generic-on-off.ts#L7
const GenericOnOff: (model: Model, coreMeshNetworkManager: CoreMeshNetworkManager) => { remainingTime: any; state: boolean | undefined; targetState: boolean | undefined; get: any; set: any; toDelay: any; toTransitionTime: any } & { key: string };InternalElement
Kind: Class
Source: packages/sdk/src/mesh-models/element.ts#L8
class InternalElementProperties
| Name | Type | Description |
|---|---|---|
models | unknown | No description yet. |
Methods
| Name | Signature | Description |
|---|---|---|
toProxy | toProxy(element: $Element, coreMeshNetworkManager: CoreMeshNetworkManager): InternalElement & Pick<$Element, never> & Pick<$Element, string>; | No description yet. |
InternalModel
Kind: Class
Source: packages/sdk/src/mesh-models/model.ts#L18
class InternalModelMethods
| Name | Signature | Description |
|---|---|---|
bindApplicationKey | bindApplicationKey(applicationKey: ApplicationKey): Promise<void>; | No description yet. |
unbindApplicationKey | unbindApplicationKey(applicationKey: ApplicationKey): Promise<void>; | No description yet. |
use | use<T>(ext: ModelExtension<T>): T; | No description yet. |
toProxy | toProxy(model: $Model, coreMeshNetworkManager: CoreMeshNetworkManager): InternalModel & Pick<$Model, never> & Pick<$Model, string>; | No description yet. |
InternalNode
Kind: Class
Source: packages/sdk/src/mesh-models/node.ts#L37
class InternalNode extends unknown<NodeEvents>Properties
| Name | Type | Description |
|---|---|---|
applicationKeysWithKnownToNetworkKeys | unknown | No description yet. |
applicationKeysWithUnknownNetworkKeys | unknown | No description yet. |
availableApplicationKeys | unknown | No description yet. |
availableNetworkKeys | unknown | No description yet. |
elements | unknown | No description yet. |
Methods
| Name | Signature | Description |
|---|---|---|
addApplicationKey | addApplicationKey(applicationKey: ApplicationKey): Promise<void>; | No description yet. |
addNetworkKey | addNetworkKey(networkKey: NetworkKey): Promise<void>; | No description yet. |
discover | discover(): Promise<void>; | No description yet. |
getCompositionData | getCompositionData(): Promise<void>; | No description yet. |
getTtl | getTtl(): Promise<void>; | No description yet. |
readAppKeys | readAppKeys(): Promise<void>; | No description yet. |
readApplicationKeysBoundToNetworkKey | readApplicationKeysBoundToNetworkKey(networkKey: NetworkKey): Promise<void>; | No description yet. |
removeApplicationKey | removeApplicationKey(applicationKey: ApplicationKey): Promise<void>; | No description yet. |
removeNetworkKey | removeNetworkKey(networkKey: NetworkKey): Promise<void>; | No description yet. |
reset | reset(): Promise<void>; | No description yet. |
toProxy | toProxy(node: $Node, coreMeshNetworkManager: CoreMeshNetworkManager): InternalNode & Pick<$Node, never> & Pick<$Node, string>; | No description yet. |
keysOf
Kind: Function
Source: packages/sdk/src/types/proxy.ts#L44
function keysOf<T>(): (keys: K) => K;logger
Kind: Variable
Source: packages/sdk/src/types/logger.ts#L66
const logger: CompositeLogger;MeshNetworkManager
Kind: Class
Source: packages/sdk/src/mesh-network/mesh-network-manager.ts#L38
class MeshNetworkManagerConstructors
| Name | Signature | Description |
|---|---|---|
constructor | MeshNetworkManager(): MeshNetworkManager; | No description yet. |
Properties
| Name | Type | Description |
|---|---|---|
$centralManager | CBCentralManager | No description yet. |
$connection | NetworkConnection | No description yet. |
$coreMeshNetworkManager | CoreMeshNetworkManager | No description yet. |
provision | ProvisioningManager | No description yet. |
$instance | unknown | No description yet. |
allNodes | unknown | No description yet. |
applicationKeys | unknown | No description yet. |
configuredNodes | unknown | No description yet. |
connection | unknown | No description yet. |
groups | unknown | No description yet. |
isNetworkCreated | unknown | No description yet. |
logger | unknown | No description yet. |
meshNetwork | unknown | No description yet. |
networkKeyExists | unknown | No description yet. |
networkKeys | unknown | No description yet. |
nextAvailableApplicationKeyIndex | unknown | No description yet. |
nextAvailableGroupAddress | unknown | No description yet. |
nextAvailableNetworkKeyIndex | unknown | No description yet. |
notConfiguredNodes | unknown | No description yet. |
provisionerNode | unknown | No description yet. |
provisioners | unknown | No description yet. |
provisionersNodes | unknown | No description yet. |
instance | unknown | No description yet. |
Methods
| Name | Signature | Description |
|---|---|---|
addApplicationKey | addApplicationKey(key: NewKey): Promise<void>; | No description yet. |
addApplicationKeys | addApplicationKeys(numberOfKeys: number): Promise<void>; | No description yet. |
addGroup | addGroup(_args: any): Promise<void>; | No description yet. |
addNetworkKey | addNetworkKey(key: NewKey): Promise<void>; | No description yet. |
createNewMeshNetwork | createNewMeshNetwork(): Promise<MeshNetwork>; | No description yet. |
export | export(): Promise<Data>; | No description yet. |
getElement | getElement(nodeUuid: string, elementIndex: number): InternalElement & Pick<$Element, never> & Pick<$Element, string> | undefined; | No description yet. |
getGroup | getGroup(_groupAddress: string): any; | No description yet. |
getModel | getModel(nodeUuid: string, elementIndex: number, modelId: number): InternalModel & Pick<$Model, never> & Pick<$Model, string> | undefined; | No description yet. |
getNode | getNode(uuid: string): any; | No description yet. |
init | init(centralManager: CBCentralManager, storage: Storage): void; | No description yet. |
meshNetworkDidChange | meshNetworkDidChange(): void; | No description yet. |
removeApplicationKey | removeApplicationKey(key: Key): Promise<void>; | No description yet. |
removeGroup | removeGroup(_group: any): Promise<void>; | No description yet. |
removeNetworkKey | removeNetworkKey(key: Key): Promise<void>; | No description yet. |
reset | reset(): Promise<void>; | No description yet. |
setup | setup(): Promise<void>; | No description yet. |
updateMeshNetwork | updateMeshNetwork(__namedParameters: { meshName?: string }): any; | No description yet. |
getInstance | getInstance<T>(this: T): ClassInstance<T>; | No description yet. |
MeshNetworkManagerError
Kind: Class
Source: packages/sdk/src/types/mesh-network-manager.ts#L1
class MeshNetworkManagerError extends ErrorConstructors
| Name | Signature | Description |
|---|---|---|
constructor | MeshNetworkManagerError(message: string): MeshNetworkManagerError; | No description yet. |
Properties
| Name | Type | Description |
|---|---|---|
cause | unknown | No description yet. |
message | string | No description yet. |
name | string | No description yet. |
stack | string | No description yet. |
SaveError | MeshNetworkManagerError | No description yet. |
stackTraceLimit | number | The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. |
Methods
| Name | Signature | Description |
|---|---|---|
captureStackTrace | captureStackTrace(targetObject: object, constructorOpt?: Function): void; | No description yet. |
isError | isError(error: unknown): error is Error; | No description yet. |
prepareStackTrace | prepareStackTrace(err: Error, stackTraces: CallSite[]): any; | No description yet. |
Model
Kind: Type alias
Source: packages/sdk/src/mesh-models/model.ts#L16
type Model = ReturnType<typeof toProxy>;ModelExtension
Kind: Type alias
Source: packages/sdk/src/types/model.ts#L4
type ModelExtension<T> = (model: Model, coreMeshNetworkManager: CoreMeshNetworkManager) => T & { key: string };NetworkConnection
Kind: Class
Source: packages/sdk/src/mesh-network/network-connection.ts#L178
class NetworkConnection extends anyConstructors
| Name | Signature | Description |
|---|---|---|
constructor | NetworkConnection($coreMeshNetworkManager: CoreMeshNetworkManager): NetworkConnection; | No description yet. |
Properties
| Name | Type | Description |
|---|---|---|
isOpen | boolean | A flag set to true when any of the underlying bearers is open. |
meshNetwork | MeshNetwork | The Mesh Network for this connection. |
proxies | Map<string, GattBearer> | The list of connected GATT Proxies. |
maxConnections | number | Maximum number of connections that NetworkConnection can handle. NOTE: In BLEMeshJS app this value is set to 1 due to UI limitations. When applying in 3rd party app, higher values should work. |
bleReady | unknown | No description yet. |
bleState | unknown | No description yet. |
centralManager | unknown | No description yet. |
isConnectionAutomatic | unknown | No description yet. |
isStarted | unknown | No description yet. |
logger | unknown | No description yet. |
name | unknown | No description yet. |
status | unknown | No description yet. |
supportedPduTypes | unknown | No description yet. |
Methods
| Name | Signature | Description |
|---|---|---|
close | close(): void | Error; | No description yet. |
connect | connect(proxy: DiscoveredProxyPeripheral): Promise<void>; | No description yet. |
open | open(): void; | No description yet. |
scan | scan(options: ScanOptions): void; | No description yet. |
send | send(data: Data, type: PduType): Promise<void>; | No description yet. |
stopScan | stopScan(): void; | No description yet. |
use | use(bearer: GattBearer): void; | No description yet. |
to | to(meshNetwork: MeshNetwork, centralManager: CBCentralManager, coreMeshNetworkManager: CoreMeshNetworkManager): NetworkConnection; | No description yet. |
NetworkConnectionEvents
Kind: Type alias
Source: packages/sdk/src/mesh-network/network-connection.ts#L37
type NetworkConnectionEvents = unknown;Properties
| Name | Type | Description |
|---|---|---|
ble:error | (error: Error) => void | No description yet. |
ble:state-change | (state: CBCentralManagerState) => void | No description yet. |
connection:status | (status: ConnectionStatus) => void | No description yet. |
scan:new-proxy | (discoveredPeripheral: DiscoveredProxyPeripheral) => void | No description yet. |
networkIdentity
Kind: Function
Source: packages/sdk/src/mesh-network/helpers.ts#L22
function networkIdentity(advertisementData: Record<string, unknown>): any;NewKey
Kind: Type alias
Source: packages/sdk/src/types/key.ts#L3
type NewKey = Pick<Key, "key" | "name" | "index">;Node
Kind: Type alias
Source: packages/sdk/src/mesh-models/node.ts#L35
type Node = ReturnType<typeof toProxy>;NodeError
Kind: Class
Source: packages/sdk/src/types/node.ts#L1
class NodeError extends ErrorConstructors
| Name | Signature | Description |
|---|---|---|
constructor | NodeError(message: string): NodeError; | No description yet. |
Properties
| Name | Type | Description |
|---|---|---|
cause | unknown | No description yet. |
message | string | No description yet. |
name | string | No description yet. |
stack | string | No description yet. |
NodeReset | NodeError | No description yet. |
stackTraceLimit | number | The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. |
Methods
| Name | Signature | Description |
|---|---|---|
captureStackTrace | captureStackTrace(targetObject: object, constructorOpt?: Function): void; | No description yet. |
isError | isError(error: unknown): error is Error; | No description yet. |
prepareStackTrace | prepareStackTrace(err: Error, stackTraces: CallSite[]): any; | No description yet. |
NodeEvents
Kind: Type alias
Source: packages/sdk/src/mesh-models/node.ts#L31
type NodeEvents = unknown;Properties
| Name | Type | Description |
|---|---|---|
node:reset | () => void | No description yet. |
nodeIdentity
Kind: Function
Source: packages/sdk/src/mesh-network/helpers.ts#L15
function nodeIdentity(advertisementData: Record<string, unknown>): any;ProvisioningManager
Kind: Class
Source: packages/sdk/src/mesh-network/provision.ts#L114
class ProvisioningManager extends unknown<RNProvisionEvents>Constructors
| Name | Signature | Description |
|---|---|---|
constructor | ProvisioningManager(): ProvisioningManager; | No description yet. |
Properties
| Name | Type | Description |
|---|---|---|
centralManager | CBCentralManager | The Bluetooth Central Manager used for provisioning scans. Must be set before calling scan() or connect(). |
canProvisionDevice | unknown | No description yet. |
capabilitiesReceived | unknown | No description yet. |
device | unknown | No description yet. |
isAddressValid | unknown | No description yet. |
isDeviceSupported | unknown | No description yet. |
networkKey | unknown | No description yet. |
provisionerAvailable | unknown | No description yet. |
state | unknown | No description yet. |
unicastAddress | unknown | No description yet. |
Methods
| Name | Signature | Description |
|---|---|---|
connect | connect(peripheral: DiscoveredUnprovisionedPeripheral): void; | No description yet. |
disconnect | disconnect(): void; | No description yet. |
identify | identify(attentionTimer: number): void; | No description yet. |
quick | quick(peripheral: DiscoveredUnprovisionedPeripheral): Promise<void>; | No description yet. |
scan | scan(options: ScanOptions): void; | No description yet. |
start | start(): void; | No description yet. |
stopScan | stopScan(): void; | No description yet. |
ProvisionScanOptions
Kind: Type alias
Source: packages/sdk/src/types/scan.ts#L10
type ProvisionScanOptions = ScanOptions;ProxyScanOptions
Kind: Type alias
Source: packages/sdk/src/types/scan.ts#L9
type ProxyScanOptions = ScanOptions;ScanError
Kind: Class
Source: packages/sdk/src/types/scan.ts#L23
class ScanError extends ErrorConstructors
| Name | Signature | Description |
|---|---|---|
constructor | ScanError(message: string): ScanError; | No description yet. |
Properties
| Name | Type | Description |
|---|---|---|
cause | unknown | No description yet. |
message | string | No description yet. |
name | string | No description yet. |
stack | string | No description yet. |
BleUnavailable | ScanError | No description yet. |
BleUnready | ScanError | No description yet. |
ScanTimeout | ScanError | No description yet. |
stackTraceLimit | number | The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. |
UserCancelled | ScanError | No description yet. |
Methods
| Name | Signature | Description |
|---|---|---|
captureStackTrace | captureStackTrace(targetObject: object, constructorOpt?: Function): void; | No description yet. |
isError | isError(error: unknown): error is Error; | No description yet. |
prepareStackTrace | prepareStackTrace(err: Error, stackTraces: CallSite[]): any; | No description yet. |
ScanOptions
Kind: Type alias
Source: packages/sdk/src/types/scan.ts#L4
type ScanOptions = unknown;Properties
| Name | Type | Description |
|---|---|---|
notifyOnWaitingForAdvertisements | boolean | No description yet. |
timeout | number | No description yet. |