CubeLightChar
Hierarchy
↳ CubeLightChar
Implements
Index
Constructors
Properties
Methods
Constructors
constructor
+ new CubeLightChar(service: BluetoothRemoteGATTService): CubeLightChar
Inherited from CubeChar.constructor
Defined in cube/char/char.ts:19
Parameters:
| Name | Type |
|---|---|
service | BluetoothRemoteGATTService |
Returns: CubeLightChar
Properties
Protected characteristic
• characteristic: BluetoothRemoteGATTCharacteristic
Inherited from CubeChar.characteristic
Defined in cube/char/char.ts:10
Protected errStrInProgress
• errStrInProgress: string = "GATT operation already in progress."
Inherited from CubeChar.errStrInProgress
Defined in cube/char/char.ts:12
Readonly uuid
• uuid: string = "10b20103-5b3b-4571-9508-cf3efcd7bbae"
Defined in cube/char/lightChar.ts:4
Methods
prepare
▸ prepare(): Promise‹string | Error›
Implementation of CubeCharIF
Inherited from CubeChar.prepare
Defined in cube/char/char.ts:30
Prepare for using characteristic function.
Returns: Promise‹string | Error›
Promise. resolve handler says that methods are available in this class.
readValue
▸ readValue(): Promise‹DataView›
Implementation of CubeCharIF
Inherited from CubeChar.readValue
Defined in cube/char/char.ts:110
Read value from remote GATT Characteristics.
Returns: Promise‹DataView›
Promise. resolve handler include data.
setFrameRate
▸ setFrameRate(fps: number): void
Implementation of CubeCharIF
Inherited from CubeChar.setFrameRate
Defined in cube/char/char.ts:134
Set framerate.
Parameters:
| Name | Type |
|---|---|
fps | number |
Returns: void
turnLightOff
▸ turnLightOff(): void
Defined in cube/char/lightChar.ts:17
Turn the light off.
Returns: void
turnLightOnRGB
▸ turnLightOnRGB(r: number, g: number, b: number, duration: number): void
Defined in cube/char/lightChar.ts:30
Turn the light on with specified RGB and duration(optional) values.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
r | number | - | Red value. 0-255. |
g | number | - | Green value. 0-255. |
b | number | - | Blue value. 0-255. |
duration | number | 0 | Light up duration in msec. 0-2550 ( 0: Eternally ). |
Returns: void
turnLightOnRGBA
▸ turnLightOnRGBA(r: number, g: number, b: number, a: number, duration: number): void
Defined in cube/char/lightChar.ts:43
Turn the light on with specified RGB, Alpha and duration(optional) values.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
r | number | - | Red value. 0-255. |
g | number | - | Green value. 0-255. |
b | number | - | Blue value. 0-255. |
a | number | - | Alpha( = Brightness ) value. 0-255. |
duration | number | 0 | Light up duration in msec. 0-2550( 0: Eternally ). |
Returns: void
writeValue
▸ writeValue(buf: ArrayBuffer): Promise‹string | Error›
Implementation of CubeCharIF
Inherited from CubeChar.writeValue
Defined in cube/char/char.ts:55
Write value to remote GATT Characteristics.
Parameters:
| Name | Type | Description |
|---|---|---|
buf | ArrayBuffer | data buffer including command for Cube. |
Returns: Promise‹string | Error›
Promise. resolve handler says that write command executed correctly.
writeValueCore
▸ writeValueCore(buf: ArrayBuffer, countRetry: number): Promise‹string | Error›
Inherited from CubeChar.writeValueCore
Defined in cube/char/char.ts:78
Write value to remote GATT Characteristics. Core function.
Parameters:
| Name | Type | Description |
|---|---|---|
buf | ArrayBuffer | data buffer including command for Cube. |
countRetry | number | Counter for retry. |
Returns: Promise‹string | Error›
Promise. resolve handler says that write command executed correctly.