 }
 
 
+/*
+
+   {"event":"[type]", "data":{"msg":"OK", , , , }}
+
+   的なjsonを作る.
+ */
+String wrapEventJson(String type, String dataJson){
+  String body = stringJson("event", type)
+          + wrapDq("data") + ":" + dataJson;
+  return wrapBrace(body);
+}
+
+
 String switchTypeReturnJson(String msg, String refType){
   String body = stringJson("msg", msg) + ","
     + stringJson("type", refType);

    if(di_stream_info[i].interval_ms){
      if(di_stream_info[i].counter > di_stream_info[i].interval_ms){
        di_stream_info[i].counter = 0;
        Serial.println(diRead(i));
      }
    }
  }

}

String task(String msg){
  // 関数テーブルからタスクを決定する.

    if(ai_stream_info[i].interval_ms){
      if(ai_stream_info[i].counter > ai_stream_info[i].interval_ms){
        ai_stream_info[i].counter = 0;
        Serial.println(wrapEventJson("ai", aiRead(i)));
      }
    }
  }
