Browse Source

添加aaps 广播

kot 4 months ago
parent
commit
8dd8ae0e3e

+ 4 - 3
README.md

@@ -1,5 +1,6 @@
 # 对接文档
 
-- [儿童手表数据对接-硅基动感](./docs/wear/sgtc/%E5%84%BF%E7%AB%A5%E6%89%8B%E8%A1%A8%E8%A1%A8%E7%9B%98%E6%95%B0%E6%8D%AE%E5%AF%B9%E6%8E%A5.md)
-- [AAPS 接入 硅基动感科研版](./docs/aps/cgms/sisensing/%E7%A1%85%E5%9F%BA%E5%8A%A8%E6%84%9F%E7%A7%91%E7%A0%94%E7%89%88.md)
-* [微泰手表接入](./docs/weitai-watch.md)
+* [儿童手表数据对接-硅基动感](./docs/wear/sgtc/%E5%84%BF%E7%AB%A5%E6%89%8B%E8%A1%A8%E8%A1%A8%E7%9B%98%E6%95%B0%E6%8D%AE%E5%AF%B9%E6%8E%A5.md)
+* [AAPS 接入 硅基动感科研版](./docs/aps/cgms/sisensing/%E7%A1%85%E5%9F%BA%E5%8A%A8%E6%84%9F%E7%A7%91%E7%A0%94%E7%89%88.md)
+* [微泰手表接入](./docs/weitai-watch.md)
+* [翰思维尔手表](./docs/wear/翰思维尔/catalog.md)

+ 4 - 0
docs/wear/翰思维尔/catalog.md

@@ -0,0 +1,4 @@
+# AAPS & 翰思维尔
+
+* [发送广播](./发送广播.md)
+* [接收广播](./接收广播.md)

+ 41 - 0
docs/wear/翰思维尔/data.md

@@ -0,0 +1,41 @@
+# 数据包
+
+## 数据包示例
+
+```json
+{
+    "mode":"close",
+    "iob":"10.12U",
+    "cob":"30g",
+    "br":"T 0.00 U/H"
+}
+```
+**注:**`每次广播数据必定是完整的数据格式。`
+
+## 数据包字段
+
+* mode:运行模式
+  * 类型:String,枚举。
+  * 值:
+    * close:闭环模式。
+    * open: 开环模式。
+    * lgs: 低血糖维持模式。
+    * undefined: 未定义。
+
+<br/>
+
+* iob:体内残留活性胰岛素
+  * 类型:String
+  * 值:
+
+<br/>
+
+* cob: 活性碳水化合物
+  * 类型:String
+  * 值:
+
+<br/>
+
+* br:基础速率
+  * 类型:String
+  * 值:

+ 21 - 0
docs/wear/翰思维尔/发送广播.md

@@ -0,0 +1,21 @@
+# AAPS & 翰思维尔 发送广播
+
+## 示例:
+
+```java
+Intent intent = new Intent();
+intent.setAction(Action);
+intent.setClassName(PackageName,ClassName)
+intent.putExtra("data",data);
+Context.sendBroadcast(intent);
+```
+
+## 参数:
+
+* Action 
+  * 类型:String ,常量。
+  * 值:aaps.diy.actions.Info
+
+* data
+  * 类型:String ,json字符串。
+  * 值:[具体点击连接查看](./data.md)

+ 33 - 0
docs/wear/翰思维尔/接收广播.md

@@ -0,0 +1,33 @@
+# AAPS & 翰思维尔 接收广播
+
+## 示例:
+
+```java
+//创建广播接收
+BroadcastReceiver receiver=new BroadcastReceiver(){
+
+    @Override
+    public void onReceive(Context context,Intent data){
+       @NotNull String json=data.getString("data")
+       // foo
+    }
+}
+
+// 订阅广播
+IntentFilter intentFilter=IntentFilter();
+intentFilter.addAction(action)
+context.registerReceiver(receiver, intentFilter)
+
+// 注销订阅
+context.unregisterReceiver(receiver)
+```
+
+## 参数
+
+* action
+  * 类型:String,常量。
+  * 值:aaps.diy.actions.Info
+
+* data
+  * 类型:String,json字符串。
+  * 值:[点击查看具体](./data.md)