-
Notifications
You must be signed in to change notification settings - Fork 8
GPIO Profile
TakayukiHoshi1984 edited this page Mar 27, 2017
·
1 revision
| API | 機能概要 |
|---|---|
| GPIO Export API | 出力/入力の種類を設定する。 |
| GPIO Digital API GET | デジタルの入力。 |
| GPIO Digital API PUT | デジタルの出力。HIGHを出力。 |
| GPIO Digital API DELETE | デジタルの出力。LOWを出力。 |
| GPIO Digital API POST | デジタルの出力。HIGH, LOWいずれかを出力 |
| GPIO Analog API GET | アナログの入力。 |
| GPIO Analog API POST | アナログの出力。PWMで出力。 |
| GPIO Change Event API | 定期的な値の取得。 |
General Purpose Input/Output(汎用入出力)にアクセスする機能を提供するProfile。
WebGPIO Draft Specification
https://rawgit.com/browserobo/WebGPIO/master/index.html
| インターフェース名称 | Version | 種別 |
|---|---|---|
| GPIO Export API | 1.0.0 | 同期I/F |
出力/入力の種類を設定する。
| HTTPメソッド | URI |
|---|---|
| POST | /gotapi/gpio/export/pin番号 |
| 論理名 | 物理名 | データ型 | 省略 | 設定値 |
|---|---|---|---|---|
| サービスID | serviceId | string | - | 取得対象スマートデバイス |
| モード | mode | number | - | 設定するモード 0:デジタルIN, 1:デジタルOUT, 2:アナログIN, 3:アナログOUT |
| Content-Type | 形式 | HTTPステータス |
|---|---|---|
| application/json | JSON | 200 |
| 論理名 | 物理名 | データ型 | 省略 | 設定値 |
|---|---|---|---|---|
| 処理結果 | result | number | - | 0:正常応答 0以外:異常応答 |
POST http://localhost:4035/gotapi/gpio/export/1
| POSTデータ |
|---|
| servieId=localhost.dconnect.com&accessToken=xxxx&mode=1 |
{
"product":"Device Connect Manager",
"version":"x.x",
"result": 0,
}
| インターフェース名称 | Version | 種別 |
|---|---|---|
| GPIO Digital API GET | 1.0.0 | 同期I/F |
指定されたPINからデジタル値 HIGH(1)またはLOW(1)を入力。
| HTTPメソッド | URI |
|---|---|
| GET | /gotapi/gpio/digital/pin番号 |
| 論理名 | 物理名 | データ型 | 省略 | 設定値 |
|---|---|---|---|---|
| サービスID | serviceId | string | - | 取得対象スマートデバイス |
| Content-Type | 形式 | HTTPステータス |
|---|---|---|
| application/json | JSON | 200 |
| 論理名 | 物理名 | データ型 | 省略 | 設定値 |
|---|---|---|---|---|
| 処理結果 | result | number | - | 0:正常応答 0以外:異常応答 |
| 属性値 | value | number | - | PINの値、HIGH(1) or LOW(0)が返ってくる。 |
GET http://localhost:4035/gotapi/gpio/digital/1?servieId=localhost.deviceconnect.org&accessToken=xxxxx
{
"product":"Device Connect Manager",
"version":"x.x",
"result": 0,
"value": 1
}
| インターフェース名称 | Version | 種別 |
|---|---|---|
| GPIO Digital API PUT | 1.0.0 | 同期I/F |
指定されたPINにデジタル値のHIGH(1)を出力。
| HTTPメソッド | URI |
|---|---|
| PUT | /gotapi/gpio/digital/pin番号 |
| 論理名 | 物理名 | データ型 | 省略 | 設定値 |
|---|---|---|---|---|
| サービスID | serviceId | string | - | 取得対象スマートデバイス |
| Content-Type | 形式 | HTTPステータス |
|---|---|---|
| application/json | JSON | 200 |
| 論理名 | 物理名 | データ型 | 省略 | 設定値 |
|---|---|---|---|---|
| 処理結果 | result | number | - | 0:正常応答 0以外:異常応答 |
PUT http://localhost:4035/gotapi/gpio/digital/1
| PUTデータ |
|---|
| servieId=localhost.dconnect.com&accessToken=xxxx |
{
"product":"Device Connect Manager",
"version":"x.x",
"result": 0,
}
| インターフェース名称 | Version | 種別 |
|---|---|---|
| GPIO Digital API DELETE | 1.0.0 | 同期I/F |
指定されたPINにデジタル値のLOW(0)を出力。
| HTTPメソッド | URI |
|---|---|
| DELETE | /gotapi/gpio/digital/pin番号 |
| 論理名 | 物理名 | データ型 | 省略 | 設定値 |
|---|---|---|---|---|
| サービスID | serviceId | string | - | 取得対象スマートデバイス |
| API名 | api | string | - | gotapi |
| Content-Type | 形式 | HTTPステータス |
|---|---|---|
| application/json | JSON | 200 |
| 論理名 | 物理名 | データ型 | 省略 | 設定値 |
|---|---|---|---|---|
| 処理結果 | result | number | - | 0:正常応答 0以外:異常応答 |
DELETE http://localhost:4035/gotapi/gpio/digital/1?servieId=localhost.deviceconnect.org&accessToken=xxxxx
{
"product":"Device Connect Manager",
"version":"x.x",
"result": 0,
}
| インターフェース名称 | Version | 種別 |
|---|---|---|
| GPIO Digital API POST | 1.0.0 | 同期I/F |
指定されたPINにデジタル値のHIGH(1)またはLOW(0)を出力。
| HTTPメソッド | URI |
|---|---|
| POST | /gotapi/gpio/digital/pin番号 |
| 論理名 | 物理名 | データ型 | 省略 | 設定値 |
|---|---|---|---|---|
| サービスID | serviceId | string | - | 取得対象スマートデバイス |
| 値 | value | number | - | 出力する値 LOW(0), HIGH(1) |
| Content-Type | 形式 | HTTPステータス |
|---|---|---|
| application/json | JSON | 200 |
| 論理名 | 物理名 | データ型 | 省略 | 設定値 |
|---|---|---|---|---|
| 処理結果 | result | number | - | 0:正常応答 0以外:異常応答 |
POST http://localhost:4035/gotapi/gpio/digital/1
| POSTデータ |
|---|
| servieId=localhost.dconnect.com&accessToken=xxxx&value=1 |
{
"product":"Device Connect Manager",
"version":"x.x",
"result": 0,
}
| インターフェース名称 | Version | 種別 |
|---|---|---|
| GPIO Analog API GET | 1.0.0 | 同期I/F |
指定されたPINのアナログ値を入力。
| HTTPメソッド | URI |
|---|---|
| GET | /gotapi/gpio/analog/pin番号 |
| 論理名 | 物理名 | データ型 | 省略 | 設定値 |
|---|---|---|---|---|
| サービスID | serviceId | string | - | 取得対象スマートデバイス |
| Content-Type | 形式 | HTTPステータス |
|---|---|---|
| application/json | JSON | 200 |
| 論理名 | 物理名 | データ型 | 省略 | 設定値 |
|---|---|---|---|---|
| 処理結果 | result | number | - | 0:正常応答 0以外:異常応答 |
| 値 | value | number | - | 指定したPINのアナログ値 |
GET http://localhost:4035/gotapi/gpio/analog/1?servieId=localhost.deviceconnect.org&accessToken=xxxxx
{
"product":"Device Connect Manager",
"version":"x.x",
"result": 0,
"value": 1024,
}
| インターフェース名称 | Version | 種別 |
|---|---|---|
| GPIO Analog API GET | 1.0.0 | 同期I/F |
指定されたPINのアナログ値を出力。
| HTTPメソッド | URI |
|---|---|
| POST | /gotapi/gpio/analog/pin番号 |
| 論理名 | 物理名 | データ型 | 省略 | 設定値 |
|---|---|---|---|---|
| サービスID | serviceId | string | - | 取得対象スマートデバイス |
| 値 | value | number | - | 出力するアナログ値 |
| Content-Type | 形式 | HTTPステータス |
|---|---|---|
| application/json | JSON | 200 |
| 論理名 | 物理名 | データ型 | 省略 | 設定値 |
|---|---|---|---|---|
| 処理結果 | result | number | - | 0:正常応答 0以外:異常応答 |
POST http://localhost:4035/gotapi/gpio/analog/1
| POSTデータ |
|---|
| servieId=localhost.dconnect.com&accessToken=xxxx&value=144 |
{
"product":"Device Connect Manager",
"version":"x.x",
"result": 0,
}
| インターフェース名称 | Version | 種別 |
|---|---|---|
| GPIO Change Event API | 1.0.0 | 非同期I/F(イベントI/F) |
各PINで、入力状態のモードに設定されているPINの値を定期的に送信する。
| イベント名 | Content-Type |
|---|---|
| /gotapi/gpio/onchange | application/json |
<td>オブジェクト</td>
<td colspan="2" text-align="center">pins</td>
<td>object</td>
<td>-</td>
<td>各PINの配列</td>
| 論理名 | 物理名 | データ型 | 省略 | 設定値 | |
{
"product":"Device Connect Manager",
"version":"x.x",
"servieId": "device1.localhost.deviceconnect.org",
"profile" : "gpio",
"attribute" : "onchange",
"sessionKey" : "0a93ac0aade4e046ed63eb24d1172f5f35c88ca60daa901547c28d5827cb418a5de1d7c5f9e62405",
"pins" : {
"14": 1023,
"15": 111,
"16": 201,
"17": 0,
"18": 1014,
"19": 99,
}
}