Skip to main content

CubeSoundChar

Hierarchy

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

+ new CubeSoundChar(service: BluetoothRemoteGATTService): CubeSoundChar

Inherited from CubeChar.constructor

Defined in cube/char/char.ts:19

Parameters:

NameType
serviceBluetoothRemoteGATTService

Returns: CubeSoundChar

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 = "10b20104-5b3b-4571-9508-cf3efcd7bbae"

Overrides CubeChar.uuid

Defined in cube/char/soundChar.ts:4


Static seId

seId: object = { enter: 0, selected: 1, cancel: 2, cursor: 3, matIn: 4, matOut: 5, get1: 6, get2: 7, get3: 8, effect1: 9, effect2: 10, } as const

Defined in cube/char/soundChar.ts:17

Sound Effect IDs.

Type declaration:

  • cancel: 2 = 2

  • cursor: 3 = 3

  • effect1: 9 = 9

  • effect2: 10 = 10

  • enter: 0 = 0

  • get1: 6 = 6

  • get2: 7 = 7

  • get3: 8 = 8

  • matIn: 4 = 4

  • matOut: 5 = 5

  • selected: 1 = 1

Methods

playMelody

playMelody(melody: object[]): void

Defined in cube/char/soundChar.ts:88

Play melody specified wiht MIDI note sequence.

Parameters:

NameTypeDescription
melodyobject[]An array composed of some combinations of note and duration values. Use like below. playMelody( [ { note: 0x50, duration: 0x1E }, { note: 0x52, duration: 0x1E }, { note: 0x54, duration: 0x1E } ] ); Refer to the instruction of playSingleNote() for note/duration.

Returns: void


playSE

playSE(idSE: number): void

Defined in cube/char/soundChar.ts:36

Play pre-installed sound effect.

Parameters:

NameTypeDescription
idSEnumberSounde effect index value. Please make use of static seId.xxx properties in this class.

Returns: void


playSingleNote

playSingleNote(note: number, duration: number): void

Defined in cube/char/soundChar.ts:53

Play single MIDI note.

Parameters:

NameTypeDefaultDescription
notenumber-MIDI note number 0-128. 128 is a special value for no-sound. Refer toio™Core Cube Spec: Note number and note name.
durationnumber30Sound duration in msec. 0-2550( 0: Eternally ).

Returns: void


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:

NameType
fpsnumber

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:

NameTypeDescription
bufArrayBufferdata 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:

NameTypeDescription
bufArrayBufferdata buffer including command for Cube.
countRetrynumberCounter for retry.

Returns: Promise‹string | Error›

Promise. resolve handler says that write command executed correctly.