【问题标题】:Client Characteristic Configuration descriptor 0x81 improperly configured客户端特征配置描述符 0x81 配置不正确
【发布时间】:2021-04-21 11:19:08
【问题描述】:

我无法写入 RACP 记录以在葡萄糖设备上启动适当的程序,我不知道出了什么问题:

Bluetooth powered on.
Device Contour7802H6798544 found, try to connect...
Connected to Contour7802H6798544
*******************************************************
Service: <CBService: 0x14566740, isPrimary = YES, UUID = Glucose>
<CBCharacteristic: 0x1466fdc0, UUID = 2A18, properties = 0x10, value = (null), notifying = NO>
... has notify
<CBCharacteristic: 0x1465bb00, UUID = 2A52, properties = 0x28, value = (null), notifying = NO>
... has write
*******************************************************
Characteristic's value subscribed
Subscribed. Notification has begun for: 2A18
Optional(Error Domain=CBATTErrorDomain Code=129 "Unknown ATT error." UserInfo={NSLocalizedDescription=Unknown ATT error.})

129 是 HEX 格式的 0x81,标题中错误信息的说明可以在 Glucose Service 的蓝牙官方文档中找到:https://github.com/www378660084/BluetoothProfile/blob/master/GLS_SPEC_V10.pdf

我将操作码和操作数写入 0x2a52 如下:

  let data = Data([0x04,0x01]);
  peripheral.writeValue(data , for: racp?, type: .withResponse);

这是特性的说明:

<?xml version="1.0" encoding="utf-8"?>
<!-- Created with Liquid XML Studio Designer Edition 9.1.10.3537 (http://www.liquid-technologies.com) -->
<!--Copyright 2011 Bluetooth SIG, Inc. All rights reserved.-->
<Characteristic xsi:noNamespaceSchemaLocation="http://schemas.bluetooth.org/Documents/characteristic.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="Record Access Control Point"
type="org.bluetooth.characteristic.record_access_control_point"
uuid="2A52" last-modified="2011-12-6" approved="Yes">
  <InformativeText>
    <Summary>This control point is used with a service to provide
    basic management functionality for the Glucose Sensor patient
    record database. This enables functions including counting
    records, transmitting records and clearing records based on
    filter criterion. The filter criterion in the Operand field is
    defined by the service that references this characteristic as
    is the format of a record (which may be comprised of one or
    more characteristics) and the sequence of transferred
    records.</Summary>
  </InformativeText>
  <Value>
    <Field name="Op Code">
      <Requirement>Mandatory</Requirement>
      <Format>uint8</Format>
      <Enumerations>
        <Enumeration key="0"
        value="Reserved for future use (Operator:N/A)" />
        <Enumeration key="1"
        value="Report stored records (Operator: Value from Operator Table)" />
        <Enumeration key="2"
        value="Delete stored records (Operator: Value from Operator Table)" />
        <Enumeration key="3"
        value="Abort operation (Operator: Null 'value of 0x00 from Operator Table')" />
        <Enumeration key="4"
        value="Report number of stored records (Operator: Value from Operator Table)" />
        <Enumeration key="5"
        value="Number of stored records response (Operator: Null 'value of 0x00 from Operator Table')" />
        <Enumeration key="6"
        value="Response Code (Operator: Null 'value of 0x00 from Operator Table')" />
        <ReservedForFutureUse start="7" end="255" />
      </Enumerations>
    </Field>
    <Field name="Operator">
      <Requirement>Mandatory</Requirement>
      <Format>uint8</Format>
      <Enumerations>
        <Enumeration key="0" value="Null" />
        <Enumeration key="1" value="All records" />
        <Enumeration key="2" value="Less than or equal to" />
        <Enumeration key="3" value="Greater than or equal to" />
        <Enumeration key="4" value="Within range of (inclusive)" />
        <Enumeration key="5"
        value="First record(i.e. oldest record)" />
        <Enumeration key="6"
        value="Last record (i.e. most recent record)" />
        <ReservedForFutureUse start="7" end="255" />
      </Enumerations>
    </Field>
    <Field name="Operand">
      <InformativeText>The operands correspond to the Op Code
      values (Keys 0 to 255) defined in the Op Code Field
      above</InformativeText>
      <Requirement>Mandatory</Requirement>
      <Format>variable</Format>
      <Enumerations>
        <InformativeText>Op Code / Operand Value
        Correspondence</InformativeText>
        <Enumeration key="0" value="N/A" />
        <Enumeration key="1"
        value="Filter parameters (as appropriate to Operator and Service)" />
        <Enumeration key="2"
        value="Filter parameters (as appropriate to Operator and Service)" />
        <Enumeration key="3" value="Not included" />
        <Enumeration key="4"
        value="Filter parameters (as appropriate to Operator and Service)" />
        <Enumeration key="5"
        value="Number of Records (Field size defined per service)" />
        <Enumeration key="6"
        value="Request Op Code, Response Code Value" />
        <ReservedForFutureUse start="7" end="255" />
      </Enumerations>
      <AdditionalValues>
        <InformativeText>Response Code Values</InformativeText>
        <Enumeration key="0" value="Reserved For Future Use"
        description="N/A" />
        <Enumeration key="1" value="Success"
        description="Normal response for successful operation" />
        <Enumeration key="2" value="Op Code not supported"
        description="Normal response if unsupported Op Code is received" />
        <Enumeration key="3" value="Invalid Operator"
        description="Normal response if Operator received does not meet the requirements of the service (e.g. Null was expected)" />
        <Enumeration key="4" value="Operator not supported"
        description="Normal response if unsupported Operator is received" />
        <Enumeration key="5" value="Invalid Operand"
        description="Normal response if Operand received does not meet the requirements of the service" />
        <Enumeration key="6" value="No records found"
        description="Normal response if request to report stored records or request to delete stored records resulted in no records meeting criteria." />
        <Enumeration key="7" value="Abort unsuccessful"
        description="Normal response if request for Abort cannot be completed" />
        <Enumeration key="8" value="Procedure not completed"
        description="Normal response if unable to complete a procedure for any reason" />
        <Enumeration key="9" value="Operand not supported"
        description="Normal response if unsupported Operand is received" />
        <ReservedForFutureUse start="10" end="255" />
      </AdditionalValues>
    </Field>
  </Value>
  <Note>The fields in the above table are in the order of LSO to
  MSO. Where LSO = Least Significant Octet and MSO = Most
  Significant Octet.</Note>
</Characteristic>

0x04 0x01 表示我要获取店铺记录总数。 但我总是收到上面提到的错误消息。

【问题讨论】:

  • 你能显示更多代码吗?你如何处理特征的发现?您是否确认racp 不是nilguardif let 可能比展开内联更好。

标签: swift bluetooth bluetooth-lowenergy core-bluetooth


【解决方案1】:

我曾经遇到过同样的问题,但在检查了规范后我发现了这个:

确保客户端配置 RACAP Charac 用于指示 通过在与 RACAP 相关的客户端配置描述符上写入“0x0200”

来自section 3.4 of the specification

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-06-02
    • 2013-01-22
    • 2013-01-01
    • 2016-06-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-21
    • 2017-03-12
    相关资源
    最近更新 更多