obnizのフォーラムは新しいシステムに移行しております。
新しいフォーラムはこちらになりますLogtta THがうまく受信できません
-
【実行した事】
①ユニ電子コネクトモードのサンプルコードを利用
②端末をコネクトモードに変更
③ローカルネームは「acm001」に変更している
④受信はOK
⑤実装ライブラリ(Obniz.getPartsClass("Logtta_TH"))のチェックでlogttaでは無いという判別をされている
⑥ローカルネームが「HT sensor」ではないとのエラーがでている(ここは想定内なので、チェックを外した)【何が起きているか】
①logttaとして認識されていないので、logtta_TH.getData(peripheral)の値が取れない【質問】
①認識されない原因
②advertise_data_rowsのデータとユニ電子から頂いたフォーマットの照合が出来ない(わからない)【補足】
①ビーコンモードでも受信はできている様子
②RAWフォーマットとの照合は不明【添付】
1--
BleRemotePeripheral {
_connectSetting: {},
discoverdOnRemote: true,
obnizBle: ObnizBLE {
_events: Events <[Object: null prototype] {}> {
'/response/ble/hci/read': [EE],
'/response/ble/error': [EE]
},
_eventsCount: 2,
timeout: 30000,
_eventHandlerQueue: {},
Obniz: Obniz {
_events: [Events <Complex prototype>],
_eventsCount: 1,
_lastDataReceivedAt: 1609918899407,
isNode: true,
id: '192.168.1.84',
socket: [WebSocket],
socket_local: null,
debugprint: false,
debugprintBinary: false,
debugs: [],
_onConnectCalled: true,
hw: 'encored',
firmware_ver: '3.4.3-beta.4',
connectionState: 'connected',
bufferdAmoundWarnBytes: 10000000,
_connectionRetryCount: 0,
options: [Object],
wscommand: [Function: WSCommand],
wscommands: [Array],
pongObservers: [],
_allComponentKeys: [Array],
util: [ObnizUtil],
onconnect: [AsyncFunction],
onclose: [AsyncFunction],
_hwDefinition: [Object],
_hw_peripherals: [Object],
io: [Directive],
logicAnalyzer: [LogicAnalyzer],
measure: [ObnizMeasure],
plugin: [Plugin],
io0: [PeripheralIO],
io25: [PeripheralIO],
io26: [PeripheralIO],
io27: [PeripheralIO],
uart0: [PeripheralUART],
uart1: [PeripheralUART],
spi0: [PeripheralSPI],
spi1: [PeripheralSPI],
i2c0: [PeripheralI2C],
pwm0: [PeripheralPWM],
pwm1: [PeripheralPWM],
pwm2: [PeripheralPWM],
pwm3: [PeripheralPWM],
pwm4: [PeripheralPWM],
pwm5: [PeripheralPWM],
ble: [Circular],
tcp0: [Tcp],
tcp1: [Tcp],
tcp2: [Tcp],
tcp3: [Tcp],
tcp4: [Tcp],
tcp5: [Tcp],
tcp6: [Tcp],
tcp7: [Tcp],
wifi: [WiFi],
_sendQueueTimer: null,
_nextPingTimeout: Timeout {
_idleTimeout: 60000,
_idlePrev: [TimersList],
_idleNext: [TimersList],
_idleStart: 2387,
_onTimeout: [Function: bound _startPingLoopInBackground],
_timerArgs: undefined,
_repeat: null,
_destroyed: false,
[Symbol(refed)]: true,
[Symbol(asyncId)]: 248,
[Symbol(triggerId)]: 243
},
_nextLoopTimeout: Timeout {
_idleTimeout: 100,
_idlePrev: [TimersList],
_idleNext: [TimersList],
_idleStart: 36121,
_onTimeout: [Function: bound _startLoopInBackground],
_timerArgs: undefined,
_repeat: null,
_destroyed: false,
[Symbol(refed)]: true,
[Symbol(asyncId)]: 1195,
[Symbol(triggerId)]: 1194
}
},
remotePeripherals: [
[BleRemotePeripheral], [BleRemotePeripheral],
[BleRemotePeripheral], [BleRemotePeripheral],
[BleRemotePeripheral], [BleRemotePeripheral],
[BleRemotePeripheral], [BleRemotePeripheral],
[BleRemotePeripheral], [BleRemotePeripheral],
[BleRemotePeripheral], [BleRemotePeripheral],
[BleRemotePeripheral], [BleRemotePeripheral],
[BleRemotePeripheral], [BleRemotePeripheral],
[BleRemotePeripheral], [BleRemotePeripheral],
[BleRemotePeripheral], [BleRemotePeripheral],
[BleRemotePeripheral], [BleRemotePeripheral],
[Circular]
],
_initialized: true,
debugHandler: [Function],
hci: ObnizBLEHci {
timeout: 90000,
_eventHandlerQueue: [Object],
Obniz: [Obniz],
onread: [Function: bound onSocketData]
},
service: [Function: BleService],
characteristic: [Function: BleCharacteristic],
descriptor: [Function: BleDescriptor],
_initializeWarning: true,
peripheral: BlePeripheral {
obnizBle: [Circular],
_services: [],
currentConnectedDeviceAddress: null
},
scan: BleScan {
state: 'started',
_delayNotifyTimers: [Array],
obnizBle: [Circular],
emitter: [EventEmitter],
scanTarget: [Object],
scanSettings: [Object],
scanedPeripherals: [Array],
_timeoutTimer: Timeout {
_idleTimeout: 10000,
_idlePrev: [Timeout],
_idleNext: [TimersList],
_idleStart: 27056,
_onTimeout: [AsyncFunction],
_timerArgs: undefined,
_repeat: null,
_destroyed: false,
[Symbol(refed)]: true,
[Symbol(asyncId)]: 946,
[Symbol(triggerId)]: 0
},
onfind: [AsyncFunction],
onfinish: [AsyncFunction]
},
advertisement: BleAdvertisement {
obnizBle: [Circular],
adv_data: [],
scan_resp: []
},
hciProtocol: Hci {
_events: [Events <Complex prototype>],
_eventsCount: 7,
_state: 'poweredOn',
_aclStreamObservers: {},
debugHandler: [Function],
_obnizHci: [ObnizBLEHci],
_socket: [Object],
_handleAclsInProgress: {},
_handleBuffers: {},
_aclOutQueue: [],
addressType: 'public',
address: '84:0d:8e:c1:61:a2',
_aclMtu: 251,
_aclMaxInProgress: 10
},
centralBindings: NobleBindings {
_events: [Events <Complex prototype>],
_eventsCount: 4,
debugHandler: [Function],
_hci: [Hci],
_gap: [Gap],
_state: 'poweredOn',
_addresses: [Object],
_addresseTypes: [Object],
_connectable: [Object],
_handles: {},
_gatts: {},
_aclStreams: {},
_signalings: {},
_connectPromises: [],
_scanServiceUuids: []
},
peripheralBindings: BlenoBindings {
_events: [Events <Complex prototype>],
_eventsCount: 4,
_state: 'poweredOn',
_advertising: false,
_hci: [Hci],
_gap: [Gap],
_gatt: [Gatt],
_address: null,
_handle: null,
_aclStream: null
}
},
address: 'f0ab5401087e',
connected: false,
device_type: 'ble',
address_type: 'public',
ble_event_type: 'connectable_advertisemnt',
rssi: -39,
scan_resp: [
2, 10, 254, 7, 9,
97, 99, 109, 48, 48,
49
],
localName: 'acm001',
iBeacon: null,
keys: [
'device_type',
'address_type',
'ble_event_type',
'rssi',
'adv_data',
'scan_resp'
],
_services: [],
emitter: EventEmitter {
_events: Events <[Object: null prototype] {}> {},
_eventsCount: 0
},
advertise_data_rows: [
[ 1, 6 ],
[
7, 172, 204, 29, 207, 236,
33, 251, 162, 181, 74, 233,
116, 32, 170, 192, 43
],
[ 25, 0, 3 ],
[ 10, 254 ],
[
9, 97, 99, 109,
48, 48, 49
]
],
adv_data: [
2, 1, 6, 17, 7, 172, 204, 29,
207, 236, 33, 251, 162, 181, 74, 233,
116, 32, 170, 192, 43, 3, 25, 0,
3
]
}
--2
BleRemotePeripheral {
_connectSetting: {},
discoverdOnRemote: true,
obnizBle: ObnizBLE {
_events: Events <[Object: null prototype] {}> {
'/response/ble/hci/read': [EE],
'/response/ble/error': [EE]
},
_eventsCount: 2,
timeout: 30000,
_eventHandlerQueue: {},
Obniz: Obniz {
_events: [Events <Complex prototype>],
_eventsCount: 1,
_lastDataReceivedAt: 1609817022697,
isNode: true,
id: '192.168.1.84',
socket: [WebSocket],
socket_local: null,
debugprint: false,
debugprintBinary: false,
debugs: [],
_onConnectCalled: true,
hw: 'encored',
firmware_ver: '3.4.3-beta.4',
connectionState: 'connected',
bufferdAmoundWarnBytes: 10000000,
_connectionRetryCount: 0,
options: [Object],
wscommand: [Function: WSCommand],
wscommands: [Array],
pongObservers: [],
_allComponentKeys: [Array],
util: [ObnizUtil],
onconnect: [AsyncFunction],
onclose: [AsyncFunction],
_hwDefinition: [Object],
_hw_peripherals: [Object],
io: [Directive],
logicAnalyzer: [LogicAnalyzer],
measure: [ObnizMeasure],
plugin: [Plugin],
io0: [PeripheralIO],
io25: [PeripheralIO],
io26: [PeripheralIO],
io27: [PeripheralIO],
uart0: [PeripheralUART],
uart1: [PeripheralUART],
spi0: [PeripheralSPI],
spi1: [PeripheralSPI],
i2c0: [PeripheralI2C],
pwm0: [PeripheralPWM],
pwm1: [PeripheralPWM],
pwm2: [PeripheralPWM],
pwm3: [PeripheralPWM],
pwm4: [PeripheralPWM],
pwm5: [PeripheralPWM],
ble: [Circular],
tcp0: [Tcp],
tcp1: [Tcp],
tcp2: [Tcp],
tcp3: [Tcp],
tcp4: [Tcp],
tcp5: [Tcp],
tcp6: [Tcp],
tcp7: [Tcp],
wifi: [WiFi],
_sendQueueTimer: null,
_nextPingTimeout: Timeout {
_idleTimeout: 60000,
_idlePrev: [TimersList],
_idleNext: [TimersList],
_idleStart: 2532,
_onTimeout: [Function: bound _startPingLoopInBackground],
_timerArgs: undefined,
_repeat: null,
_destroyed: false,
[Symbol(refed)]: true,
[Symbol(asyncId)]: 248,
[Symbol(triggerId)]: 243
},
_nextLoopTimeout: Timeout {
_idleTimeout: 1,
_idlePrev: [TimersList],
_idleNext: [TimersList],
_idleStart: 5600,
_onTimeout: [AsyncFunction],
_timerArgs: undefined,
_repeat: null,
_destroyed: false,
[Symbol(refed)]: true,
[Symbol(asyncId)]: 363,
[Symbol(triggerId)]: 362
}
},
remotePeripherals: [
[BleRemotePeripheral],
[BleRemotePeripheral],
[BleRemotePeripheral],
[BleRemotePeripheral],
[BleRemotePeripheral],
[BleRemotePeripheral],
[Circular]
],
_initialized: true,
debugHandler: [Function],
hci: ObnizBLEHci {
timeout: 90000,
_eventHandlerQueue: [Object],
Obniz: [Obniz],
onread: [Function: bound onSocketData]
},
service: [Function: BleService],
characteristic: [Function: BleCharacteristic],
descriptor: [Function: BleDescriptor],
_initializeWarning: true,
peripheral: BlePeripheral {
obnizBle: [Circular],
_services: [],
currentConnectedDeviceAddress: null
},
scan: BleScan {
state: 'started',
_delayNotifyTimers: [Array],
obnizBle: [Circular],
emitter: [EventEmitter],
scanTarget: [Object],
scanSettings: [Object],
scanedPeripherals: [Array],
_timeoutTimer: Timeout {
_idleTimeout: 10000,
_idlePrev: [Timeout],
_idleNext: [TimersList],
_idleStart: 4291,
_onTimeout: [AsyncFunction],
_timerArgs: undefined,
_repeat: null,
_destroyed: false,
[Symbol(refed)]: true,
[Symbol(asyncId)]: 327,
[Symbol(triggerId)]: 0
},
onfind: [AsyncFunction],
onfinish: [AsyncFunction]
},
advertisement: BleAdvertisement {
obnizBle: [Circular],
adv_data: [],
scan_resp: []
},
hciProtocol: Hci {
_events: [Events <Complex prototype>],
_eventsCount: 7,
_state: 'poweredOn',
_aclStreamObservers: {},
debugHandler: [Function],
_obnizHci: [ObnizBLEHci],
_socket: [Object],
_handleAclsInProgress: {},
_handleBuffers: {},
_aclOutQueue: [],
addressType: 'public',
address: '84:0d:8e:c1:61:a2',
_aclMtu: 251,
_aclMaxInProgress: 10
},
centralBindings: NobleBindings {
_events: [Events <Complex prototype>],
_eventsCount: 4,
debugHandler: [Function],
_hci: [Hci],
_gap: [Gap],
_state: 'poweredOn',
_addresses: [Object],
_addresseTypes: [Object],
_connectable: [Object],
_handles: {},
_gatts: {},
_aclStreams: {},
_signalings: {},
_connectPromises: [],
_scanServiceUuids: []
},
peripheralBindings: BlenoBindings {
_events: [Events <Complex prototype>],
_eventsCount: 4,
_state: 'poweredOn',
_advertising: false,
_hci: [Hci],
_gap: [Gap],
_gatt: [Gatt],
_address: null,
_handle: null,
_aclStream: null
}
},
address: 'f0ab5401087e',
connected: false,
device_type: 'ble',
address_type: 'public',
ble_event_type: 'non_connectable_advertising',
rssi: -42,
scan_resp: [],
localName: null,
iBeacon: null,
keys: [
'device_type',
'address_type',
'ble_event_type',
'rssi',
'adv_data',
'scan_resp'
],
_services: [],
emitter: EventEmitter {
_events: Events <[Object: null prototype] {}> {},
_eventsCount: 0
},
advertise_data_rows: [
[ 1, 4 ],
[
255, 16, 5, 3, 97, 64, 24, 96,
94, 0, 2, 0, 97, 99, 109, 48,
48, 49, 0, 0, 0, 0, 0, 0,
0, 0, 0
]
],
adv_data: [
2, 1, 4, 27, 255, 16, 5, 3, 97, ←「16, 5, 3」が設計資料の固定値に当たるのではないかと考えております。
64, 24, 96, 94, 0, 2, 0, 97, 99,
109, 48, 48, 49, 0, 0, 0, 0, 0,
0, 0, 0, 0
]
}
-
①認識されない原因
こちらですが、advertisementのlocal nameが"Logtta_TH"ではない場合、違うデバイスであると認識します。
https://github.com/obniz/obniz/blob/master/src/parts/Ble/LogttaTemp/index.ts#L32
②advertise_data_rowsのデータとユニ電子から頂いたフォーマットの照合が出来ない(わからない)
advertise_data_rowsは解析後の情報を入れておりますので、生データを見たい場合はadv_dataを参照ください。
2, 1, 4, 27, 255, 16, 5, 3, 97, .... は BLEの仕様で、(長さ 種類 データ1 データ2 ...) * n個並ぶと規定されています。
2, 1, 4 が 一つの意味を表し、 (データの長さが2なので 1 と4 の2バイト。1がデータの種類)
27, 255, 16, ... 0 でもう一つの意味になります。(データの長さが27なので 255...0までの27バイト。255がデータの種類)
詳しくはBLEの仕様書を参照ください。ですので、おそらく
「16, 5, 3」が設計資料の固定値に当たるのではないかと考えております。
こちらはあっていると思います。