Lines Matching refs:gattClient
61 2. 创建gattClient实例对象。
65 6. 断开连接,销毁gattClient实例。
77 gattClient: ble.GattClientDevice | undefined = undefined;
161 if (!this.gattClient) {
162 console.error(TAG, 'no gattClient');
166 … this.gattClient.on('BLEConnectionStateChange', (stateInfo: ble.BLEConnectionChangeState) => {
203 // 2.1 使用device构造gattClient,后续的交互都需要使用该实例
204 this.gattClient = ble.createGattClientDevice(peerDevice);
207 this.gattClient.connect(); // 2.3 发起连接
215 if (!this.gattClient) {
216 console.info(TAG, 'no gattClient');
221 this.gattClient.getServices().then((result: Array<ble.GattService>) => {
232 … if (!this.gattClient || this.connectState != constant.ProfileConnectionState.STATE_CONNECTED) {
233 console.error(TAG, 'no gattClient or not connected');
244 … this.gattClient.readCharacteristicValue(characteristic).then((outData: ble.BLECharacteristic) => {
254 … if (!this.gattClient || this.connectState != constant.ProfileConnectionState.STATE_CONNECTED) {
255 console.error(TAG, 'no gattClient or not connected');
266 … this.gattClient.writeCharacteristicValue(characteristic, ble.GattWriteType.WRITE, (err) => {
280 … if (!this.gattClient || this.connectState != constant.ProfileConnectionState.STATE_CONNECTED) {
281 console.error(TAG, 'no gattClient or not connected');
293 this.gattClient.readDescriptorValue(descriptor).then((outData: ble.BLEDescriptor) => {
303 … if (!this.gattClient || this.connectState != constant.ProfileConnectionState.STATE_CONNECTED) {
304 console.error(TAG, 'no gattClient or not connected');
319 this.gattClient.writeDescriptorValue(descriptor, (err) => {
333 … if (!this.gattClient || this.connectState != constant.ProfileConnectionState.STATE_CONNECTED) {
334 console.error(TAG, 'no gattClient or not connected');
340 this.gattClient.disconnect(); // 8.1 断开连接
341 … this.gattClient.off('BLEConnectionStateChange', (stateInfo: ble.BLEConnectionChangeState) => {
343 this.gattClient.close() // 8.2 如果不再使用此gattClient,则需要close
361 4. 当向gattServer写入特征值通知gattClient。
468 // 3. 订阅来自gattClient的读取特征值请求时调用
505 // 4. 订阅来自gattClient的写入特征值请求时调用
542 // 5. 订阅来自gattClient的读取描述符请求时调用
579 // 6. 订阅来自gattClient的写入描述符请求时调用