BLEMeshJS
API

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 docs dev, build, and types:check runs regenerate these pages automatically.

Package overview

FieldValue
Package@blemeshjs/sdk
Entry pointpackages/sdk/src/index.ts
Source treepackages/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

ExportKindSummary
ClassInstanceType aliasNo description yet.
CompositeLoggerClassNo description yet.
ConnectionStatusType aliasNo description yet.
ConsoleLoggerClassNo description yet.
CoreMeshNetworkManagerClassNo description yet.
createProxyFunctionNo description yet.
DiscoveredProxyPeripheralType aliasNo description yet.
DiscoveredUnprovisionedPeripheralType aliasNo description yet.
ElementType aliasNo description yet.
GenericOnOffVariableNo description yet.
InternalElementClassNo description yet.
InternalModelClassNo description yet.
InternalNodeClassNo description yet.
keysOfFunctionNo description yet.
loggerVariableNo description yet.
MeshNetworkManagerClassNo description yet.
MeshNetworkManagerErrorClassNo description yet.
ModelType aliasNo description yet.
ModelExtensionType aliasNo description yet.
NetworkConnectionClassNo description yet.
NetworkConnectionEventsType aliasNo description yet.
networkIdentityFunctionNo description yet.
NewKeyType aliasNo description yet.
NodeType aliasNo description yet.
NodeErrorClassNo description yet.
NodeEventsType aliasNo description yet.
nodeIdentityFunctionNo description yet.
ProvisioningManagerClassNo description yet.
ProvisionScanOptionsType aliasNo description yet.
ProxyScanOptionsType aliasNo description yet.
ScanErrorClassNo description yet.
ScanOptionsType aliasNo 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 unknown

Constructors

NameSignatureDescription
constructorCompositeLogger(handlers: LoggerHandler[]): CompositeLogger;No description yet.

Methods

NameSignatureDescription
loglog(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 unknown

Constructors

NameSignatureDescription
constructorConsoleLogger(minLevel: LogLevel): ConsoleLogger;No description yet.

Methods

NameSignatureDescription
loglog(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 unknown

Constructors

NameSignatureDescription
constructorCoreMeshNetworkManager(storage: Storage, MeshDataClass: MeshDataCtor<MeshData>, MeshNetworkClass: MeshNetworkCtor<MeshNetwork>): CoreMeshNetworkManager;No description yet.

Properties

NameTypeDescription
$instanceCoreMeshNetworkManagerNo description yet.
localProvisionerNodeunknownNo description yet.
nodesunknownNo description yet.
instanceunknownNo description yet.

Methods

NameSignatureDescription
initializeinitialize(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

NameTypeDescription
deviceGattBearerNo description yet.
rssiInt32No description yet.

DiscoveredUnprovisionedPeripheral

Kind: Type alias

Source: packages/sdk/src/types/scan.ts#L12

type DiscoveredUnprovisionedPeripheral = unknown;

Properties

NameTypeDescription
bearerProvisioningBearer[]No description yet.
deviceUnprovisionedDeviceNo description yet.
rssinumber[]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 InternalElement

Properties

NameTypeDescription
modelsunknownNo description yet.

Methods

NameSignatureDescription
toProxytoProxy(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 InternalModel

Methods

NameSignatureDescription
bindApplicationKeybindApplicationKey(applicationKey: ApplicationKey): Promise<void>;No description yet.
unbindApplicationKeyunbindApplicationKey(applicationKey: ApplicationKey): Promise<void>;No description yet.
useuse<T>(ext: ModelExtension<T>): T;No description yet.
toProxytoProxy(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

NameTypeDescription
applicationKeysWithKnownToNetworkKeysunknownNo description yet.
applicationKeysWithUnknownNetworkKeysunknownNo description yet.
availableApplicationKeysunknownNo description yet.
availableNetworkKeysunknownNo description yet.
elementsunknownNo description yet.

Methods

NameSignatureDescription
addApplicationKeyaddApplicationKey(applicationKey: ApplicationKey): Promise<void>;No description yet.
addNetworkKeyaddNetworkKey(networkKey: NetworkKey): Promise<void>;No description yet.
discoverdiscover(): Promise<void>;No description yet.
getCompositionDatagetCompositionData(): Promise<void>;No description yet.
getTtlgetTtl(): Promise<void>;No description yet.
readAppKeysreadAppKeys(): Promise<void>;No description yet.
readApplicationKeysBoundToNetworkKeyreadApplicationKeysBoundToNetworkKey(networkKey: NetworkKey): Promise<void>;No description yet.
removeApplicationKeyremoveApplicationKey(applicationKey: ApplicationKey): Promise<void>;No description yet.
removeNetworkKeyremoveNetworkKey(networkKey: NetworkKey): Promise<void>;No description yet.
resetreset(): Promise<void>;No description yet.
toProxytoProxy(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 MeshNetworkManager

Constructors

NameSignatureDescription
constructorMeshNetworkManager(): MeshNetworkManager;No description yet.

Properties

NameTypeDescription
$centralManagerCBCentralManagerNo description yet.
$connectionNetworkConnectionNo description yet.
$coreMeshNetworkManagerCoreMeshNetworkManagerNo description yet.
provisionProvisioningManagerNo description yet.
$instanceunknownNo description yet.
allNodesunknownNo description yet.
applicationKeysunknownNo description yet.
configuredNodesunknownNo description yet.
connectionunknownNo description yet.
groupsunknownNo description yet.
isNetworkCreatedunknownNo description yet.
loggerunknownNo description yet.
meshNetworkunknownNo description yet.
networkKeyExistsunknownNo description yet.
networkKeysunknownNo description yet.
nextAvailableApplicationKeyIndexunknownNo description yet.
nextAvailableGroupAddressunknownNo description yet.
nextAvailableNetworkKeyIndexunknownNo description yet.
notConfiguredNodesunknownNo description yet.
provisionerNodeunknownNo description yet.
provisionersunknownNo description yet.
provisionersNodesunknownNo description yet.
instanceunknownNo description yet.

Methods

NameSignatureDescription
addApplicationKeyaddApplicationKey(key: NewKey): Promise<void>;No description yet.
addApplicationKeysaddApplicationKeys(numberOfKeys: number): Promise<void>;No description yet.
addGroupaddGroup(_args: any): Promise<void>;No description yet.
addNetworkKeyaddNetworkKey(key: NewKey): Promise<void>;No description yet.
createNewMeshNetworkcreateNewMeshNetwork(): Promise<MeshNetwork>;No description yet.
exportexport(): Promise<Data>;No description yet.
getElementgetElement(nodeUuid: string, elementIndex: number): InternalElement & Pick<$Element, never> & Pick<$Element, string> | undefined;No description yet.
getGroupgetGroup(_groupAddress: string): any;No description yet.
getModelgetModel(nodeUuid: string, elementIndex: number, modelId: number): InternalModel & Pick<$Model, never> & Pick<$Model, string> | undefined;No description yet.
getNodegetNode(uuid: string): any;No description yet.
initinit(centralManager: CBCentralManager, storage: Storage): void;No description yet.
meshNetworkDidChangemeshNetworkDidChange(): void;No description yet.
removeApplicationKeyremoveApplicationKey(key: Key): Promise<void>;No description yet.
removeGroupremoveGroup(_group: any): Promise<void>;No description yet.
removeNetworkKeyremoveNetworkKey(key: Key): Promise<void>;No description yet.
resetreset(): Promise<void>;No description yet.
setupsetup(): Promise<void>;No description yet.
updateMeshNetworkupdateMeshNetwork(__namedParameters: { meshName?: string }): any;No description yet.
getInstancegetInstance<T>(this: T): ClassInstance<T>;No description yet.

MeshNetworkManagerError

Kind: Class

Source: packages/sdk/src/types/mesh-network-manager.ts#L1

class MeshNetworkManagerError extends Error

Constructors

NameSignatureDescription
constructorMeshNetworkManagerError(message: string): MeshNetworkManagerError;No description yet.

Properties

NameTypeDescription
causeunknownNo description yet.
messagestringNo description yet.
namestringNo description yet.
stackstringNo description yet.
SaveErrorMeshNetworkManagerErrorNo description yet.
stackTraceLimitnumberThe 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

NameSignatureDescription
captureStackTracecaptureStackTrace(targetObject: object, constructorOpt?: Function): void;No description yet.
isErrorisError(error: unknown): error is Error;No description yet.
prepareStackTraceprepareStackTrace(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 any

Constructors

NameSignatureDescription
constructorNetworkConnection($coreMeshNetworkManager: CoreMeshNetworkManager): NetworkConnection;No description yet.

Properties

NameTypeDescription
isOpenbooleanA flag set to true when any of the underlying bearers is open.
meshNetworkMeshNetworkThe Mesh Network for this connection.
proxiesMap<string, GattBearer>The list of connected GATT Proxies.
maxConnectionsnumberMaximum 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.
bleReadyunknownNo description yet.
bleStateunknownNo description yet.
centralManagerunknownNo description yet.
isConnectionAutomaticunknownNo description yet.
isStartedunknownNo description yet.
loggerunknownNo description yet.
nameunknownNo description yet.
statusunknownNo description yet.
supportedPduTypesunknownNo description yet.

Methods

NameSignatureDescription
closeclose(): void | Error;No description yet.
connectconnect(proxy: DiscoveredProxyPeripheral): Promise<void>;No description yet.
openopen(): void;No description yet.
scanscan(options: ScanOptions): void;No description yet.
sendsend(data: Data, type: PduType): Promise<void>;No description yet.
stopScanstopScan(): void;No description yet.
useuse(bearer: GattBearer): void;No description yet.
toto(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

NameTypeDescription
ble:error(error: Error) => voidNo description yet.
ble:state-change(state: CBCentralManagerState) => voidNo description yet.
connection:status(status: ConnectionStatus) => voidNo description yet.
scan:new-proxy(discoveredPeripheral: DiscoveredProxyPeripheral) => voidNo 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 Error

Constructors

NameSignatureDescription
constructorNodeError(message: string): NodeError;No description yet.

Properties

NameTypeDescription
causeunknownNo description yet.
messagestringNo description yet.
namestringNo description yet.
stackstringNo description yet.
NodeResetNodeErrorNo description yet.
stackTraceLimitnumberThe 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

NameSignatureDescription
captureStackTracecaptureStackTrace(targetObject: object, constructorOpt?: Function): void;No description yet.
isErrorisError(error: unknown): error is Error;No description yet.
prepareStackTraceprepareStackTrace(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

NameTypeDescription
node:reset() => voidNo 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

NameSignatureDescription
constructorProvisioningManager(): ProvisioningManager;No description yet.

Properties

NameTypeDescription
centralManagerCBCentralManagerThe Bluetooth Central Manager used for provisioning scans. Must be set before calling scan() or connect().
canProvisionDeviceunknownNo description yet.
capabilitiesReceivedunknownNo description yet.
deviceunknownNo description yet.
isAddressValidunknownNo description yet.
isDeviceSupportedunknownNo description yet.
networkKeyunknownNo description yet.
provisionerAvailableunknownNo description yet.
stateunknownNo description yet.
unicastAddressunknownNo description yet.

Methods

NameSignatureDescription
connectconnect(peripheral: DiscoveredUnprovisionedPeripheral): void;No description yet.
disconnectdisconnect(): void;No description yet.
identifyidentify(attentionTimer: number): void;No description yet.
quickquick(peripheral: DiscoveredUnprovisionedPeripheral): Promise<void>;No description yet.
scanscan(options: ScanOptions): void;No description yet.
startstart(): void;No description yet.
stopScanstopScan(): 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 Error

Constructors

NameSignatureDescription
constructorScanError(message: string): ScanError;No description yet.

Properties

NameTypeDescription
causeunknownNo description yet.
messagestringNo description yet.
namestringNo description yet.
stackstringNo description yet.
BleUnavailableScanErrorNo description yet.
BleUnreadyScanErrorNo description yet.
ScanTimeoutScanErrorNo description yet.
stackTraceLimitnumberThe 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.
UserCancelledScanErrorNo description yet.

Methods

NameSignatureDescription
captureStackTracecaptureStackTrace(targetObject: object, constructorOpt?: Function): void;No description yet.
isErrorisError(error: unknown): error is Error;No description yet.
prepareStackTraceprepareStackTrace(err: Error, stackTraces: CallSite[]): any;No description yet.

ScanOptions

Kind: Type alias

Source: packages/sdk/src/types/scan.ts#L4

type ScanOptions = unknown;

Properties

NameTypeDescription
notifyOnWaitingForAdvertisementsbooleanNo description yet.
timeoutnumberNo description yet.

On this page