Main Content

descriptor

Bluetooth Low Energy 周辺デバイス上の記述子へのアクセス

R2019b 以降

説明

descriptor オブジェクトは、Bluetooth® Low Energy 周辺デバイスの記述子を表します。オブジェクトの Attributes プロパティで読み取りまたは書き込みがサポートされている場合は、read を使用してデータを読み取り、あるいは write を使用してデータを書き込むことができます。

作成

説明

d = descriptor(c,descriptorName) は、名前によって指定される記述子を表すオブジェクトを作成します。descriptorName は、characteristic オブジェクト cDescriptors プロパティを表示することによって特定します。

d = descriptor(c,descriptorUUID) は、UUID によって指定される記述子を表すオブジェクトを作成します。descriptorUUID は、characteristic オブジェクト cDescriptors プロパティを表示することによって特定します。

入力引数

すべて展開する

Bluetooth Low Energy 周辺デバイスの特性。characteristic オブジェクトとして指定します。

記述子名。文字ベクトルまたは string スカラーとして指定します。descriptorName は、characteristic オブジェクトの Descriptors テーブルで特定します。DescriptorName 列に有効な値がリストされます。

例: d = descriptor(c,"Client Characteristic Configuration") は、特性 c の "Client Characteristic Configuration" 記述子を表すオブジェクトを作成します。

データ型: char | string

記述子 UUID。文字ベクトルまたは string スカラーとして指定します。descriptorUUID は、characteristic オブジェクトの Descriptors テーブルで特定します。DescriptorUUID 列に有効な値がリストされます。

例: d = descriptor(c,"2902") は、特性 c の UUID "2902" をもつ記述子を表すオブジェクトを作成します。

データ型: char | string

プロパティ

すべて展開する

この プロパティ は読み取り専用です。

記述子名。string スカラーとして返されます。

データ型: string

この プロパティ は読み取り専用です。

記述子 UUID。string スカラーとして返されます。この値は各記述子に固有です。

データ型: string

この プロパティ は読み取り専用です。

読み取りおよび書き込みの権限を記述する記述子の属性。string 配列として返されます。取り得る値は以下のとおりです。

説明
"Read"記述子は read を使用して読み取り可能
"Write"記述子は write を使用して書き込み可能

データ型: string

オブジェクト関数

readBluetooth Low Energy 周辺デバイス上で特性または記述子のデータを読み取る
writeBluetooth Low Energy 周辺デバイス上の特性または記述子にデータを書き込む

すべて折りたたむ

近くにある Bluetooth Low Energy 周辺デバイスへの接続を作成します。

b = ble("Thingy")
b = 
  ble with properties:

               Name: "Thingy"
            Address: "F2DF635320F6"
          Connected: 1
           Services: [9×2 table]
    Characteristics: [38×5 table]

Show services and characteristics

"Temperature" 特性を表す characteristic オブジェクトを作成します。

c = characteristic(b,"Weather Station Service","Temperature")
c = 
  Characteristic with properties:

             Name: "Temperature"
             UUID: "EF680201-9B35-4933-9B10-52FFA9740042"
       Attributes: "Notify"
      Descriptors: [1x3 table]
 DataAvailableFcn: []

Show descriptors

特性の記述子をリストします。

c.Descriptors
ans=1×3 table
               DescriptorName                DescriptorUUID     Attributes 
    _____________________________________    ______________    ____________

    "Client Characteristic Configuration"        "2902"        {1×2 string}

"Client Characteristic Configuration" を表す descriptor オブジェクトを作成します。

d = descriptor(c,"Client Characteristic Configuration")
d = 
  Descriptor with properties:

          Name: "Client Characteristic Configuration"
          UUID: "2902"
    Attributes: ["Read"    "Write"]

あるいは、名前の代わりに UUID を使用してオブジェクトを作成することもできます。

d = descriptor(c,"2902")
d = 
  Descriptor with properties:

          Name: "Client Characteristic Configuration"
          UUID: "2902"
    Attributes: ["Read"    "Write"]

このオブジェクトは "Client Characteristic Configuration" 記述子を表します。これは ReadWrite の両方の属性をもっているため、readまたはwriteを使用できます。

バージョン履歴

R2019b で導入