Browse Source

aidex send aaps

kot 3 months ago
parent
commit
81b3068544
1 changed files with 35 additions and 5 deletions
  1. 35 5
      docs/weitai-watch.md

+ 35 - 5
docs/weitai-watch.md

@@ -1,7 +1,11 @@
-# 微泰手表 -> AAPS
+# 微泰手表对接AAPS
 *v1.0*
 
-## 示例:
+| 时间      | 内容 | 版本 | 修订人 |
+| --------- | ---- | ---- | ------ |
+| 2024-1-22 | 创建 | 1.0  | kot    |
+
+## Aidex Send AAPS 示例:
 
 ```java
 Intent intent = new Intent();
@@ -13,8 +17,6 @@ intent.putExtra("trend", bgTrend)
 Context.sendBroadcast(intent);
 ```
 
-`data:JSON 字符串`
-
 - ACTION
     - 类型:String 常量
     - 区分大小写
@@ -35,4 +37,32 @@ Context.sendBroadcast(intent);
          - 1:缓慢上升,箭头斜向上
          - 0:平稳,箭头平指
          - -1:缓慢下降,箭头斜向下
-         - -2:较快下降,箭头向下
+         - -2:较快下降,箭头向下
+
+## AAPS Receiver Aidex 示例:
+
+```java
+private BroadcastReceiver receiver = new BroadcastReceiver() {
+    @Override
+    public void onReceive(context: Context, intent: Intent) {
+        int bg=getIntExtra("bg",0);
+        int time=getLongExtra("glucoseTime",0);
+        int trend=getIntExtra("trend",0);
+
+        //do samething
+    }
+};
+
+// 订阅
+IntentFilter filter=new IntentFile();
+filter.addAction("com.microtechmd.cgm.EXTRA_BG");
+context.registerReceiver(receiver,filter);
+
+// 取消订阅
+context.unregisterReceiver(receiver);
+```
+
+### 注意
+
+* Aidex 无效数据,bg=0。
+* 断连历史数据不会发送,只发送最新。