微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

客户端特征配置描述符 0x81 配置不正确

如何解决客户端特征配置描述符 0x81 配置不正确

我无法写入 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,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 是 0x81 的 HEX,标题错误信息的说明可以在葡萄糖服务的官方蓝牙文档中找到: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 表示我想获取商店记录的总数。 但我总是收到上面提到的错误消息。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。