[101] | 1 | /*
|
---|
| 2 | * TOPPERS ECHONET Lite Communication Middleware
|
---|
| 3 | *
|
---|
| 4 | * Copyright (C) 2015 Cores Co., Ltd. Japan
|
---|
| 5 | *
|
---|
| 6 | * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
|
---|
| 7 | * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
|
---|
| 8 | * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
|
---|
| 9 | * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
|
---|
| 10 | * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
|
---|
| 11 | * スコード中に含まれていること.
|
---|
| 12 | * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
|
---|
| 13 | * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
|
---|
| 14 | * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
|
---|
| 15 | * の無保証規定を掲載すること.
|
---|
| 16 | * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
|
---|
| 17 | * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
|
---|
| 18 | * と.
|
---|
| 19 | * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
|
---|
| 20 | * 作権表示,この利用条件および下記の無保証規定を掲載すること.
|
---|
| 21 | * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
|
---|
| 22 | * 報告すること.
|
---|
| 23 | * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
|
---|
| 24 | * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
|
---|
| 25 | * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
|
---|
| 26 | * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
|
---|
| 27 | * 免責すること.
|
---|
| 28 | *
|
---|
| 29 | * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
|
---|
| 30 | * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
|
---|
| 31 | * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
|
---|
| 32 | * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
|
---|
| 33 | * の責任を負わない.
|
---|
| 34 | *
|
---|
| 35 | * @(#) $Id: JsonData.cs 101 2015-06-02 15:37:23Z coas-nagasima $
|
---|
| 36 | */
|
---|
| 37 |
|
---|
| 38 | using System;
|
---|
| 39 | using System.Collections.Generic;
|
---|
| 40 | using System.Text;
|
---|
| 41 |
|
---|
| 42 | namespace ctrlui
|
---|
| 43 | {
|
---|
| 44 | public class JsonClassGroupInfo
|
---|
| 45 | {
|
---|
| 46 | public byte classGroupCode;
|
---|
| 47 | public string description;
|
---|
| 48 | public string define;
|
---|
| 49 | public JsonClassInfo[] classes;
|
---|
| 50 |
|
---|
| 51 | public JsonClassGroupInfo(dynamic p)
|
---|
| 52 | {
|
---|
| 53 | classGroupCode = p.classGroupCode;
|
---|
| 54 | description = p.description;
|
---|
| 55 | define = p.define;
|
---|
| 56 | }
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | /// <summary>
|
---|
| 60 | /// クラスの情報
|
---|
| 61 | /// </summary>
|
---|
| 62 | public class JsonClassInfo
|
---|
| 63 | {
|
---|
| 64 | /// <summary>
|
---|
| 65 | /// クラスの番号
|
---|
| 66 | /// </summary>
|
---|
| 67 | public byte classCode;
|
---|
| 68 | /// <summary>
|
---|
| 69 | /// 説明
|
---|
| 70 | /// </summary>
|
---|
| 71 | public string description;
|
---|
| 72 | /// <summary>
|
---|
| 73 | /// 定義名
|
---|
| 74 | /// </summary>
|
---|
| 75 | public string name;
|
---|
| 76 | /// <summary>
|
---|
| 77 | /// 定義名
|
---|
| 78 | /// </summary>
|
---|
| 79 | public string define;
|
---|
| 80 | /// <summary>
|
---|
| 81 | /// タイプ
|
---|
| 82 | /// </summary>
|
---|
| 83 | public string type;
|
---|
| 84 | /// <summary>
|
---|
| 85 | /// クラスグループ
|
---|
| 86 | /// </summary>
|
---|
| 87 | public JsonClassGroupInfo classGroup;
|
---|
| 88 | /// <summary>
|
---|
| 89 | /// プロパティの配列
|
---|
| 90 | /// </summary>
|
---|
| 91 | public JsonPropertyInfo[] properties;
|
---|
| 92 |
|
---|
| 93 | public JsonClassInfo(dynamic p)
|
---|
| 94 | {
|
---|
| 95 | classCode = p.classCode;
|
---|
| 96 | description = p.description;
|
---|
| 97 | name = p.name;
|
---|
| 98 | define = p.define;
|
---|
| 99 | type = p.type;
|
---|
| 100 | classGroup = p.classGroup;
|
---|
| 101 | properties = p.properties;
|
---|
| 102 | }
|
---|
| 103 | }
|
---|
| 104 |
|
---|
| 105 | public class JsonNodeInfo : JsonObjectInfo
|
---|
| 106 | {
|
---|
| 107 | public List<JsonObjectInfo> objects;
|
---|
| 108 |
|
---|
| 109 | public JsonNodeInfo(JsonClassInfo type, string identifer, string attribute)
|
---|
| 110 | : base(type, identifer)
|
---|
| 111 | {
|
---|
| 112 | this.attribute = attribute;
|
---|
| 113 | this.objects = new List<JsonObjectInfo>();
|
---|
| 114 | }
|
---|
| 115 | }
|
---|
| 116 |
|
---|
| 117 | public class JsonObjectInfo
|
---|
| 118 | {
|
---|
| 119 | public JsonClassInfo type;
|
---|
| 120 | public JsonNodeInfo parent;
|
---|
| 121 | public string identifer;
|
---|
| 122 | public byte instatceCode;
|
---|
| 123 | public string attribute;
|
---|
| 124 | public List<JsonPropertyInfo> properties;
|
---|
| 125 |
|
---|
| 126 | public JsonObjectInfo(JsonClassInfo type, string identifer)
|
---|
| 127 | {
|
---|
| 128 | this.type = type;
|
---|
| 129 | this.identifer = identifer;
|
---|
| 130 | this.instatceCode = 1;
|
---|
| 131 | this.attribute = "device";
|
---|
| 132 | this.properties = new List<JsonPropertyInfo>();
|
---|
| 133 | }
|
---|
| 134 |
|
---|
| 135 | public JsonPropertyInfo FindProperty(byte epc)
|
---|
| 136 | {
|
---|
| 137 | foreach (var item in this.properties) {
|
---|
| 138 | if (item.propertyCode == epc)
|
---|
| 139 | return item;
|
---|
| 140 | }
|
---|
| 141 | return null;
|
---|
| 142 | }
|
---|
| 143 | }
|
---|
| 144 |
|
---|
| 145 | public class JsonFieldInfo
|
---|
| 146 | {
|
---|
| 147 | public string description;
|
---|
| 148 | public string valueDescription;
|
---|
| 149 | public string unitDescription;
|
---|
| 150 | public string initialValue;
|
---|
| 151 | public string type;
|
---|
| 152 | public string identifer;
|
---|
| 153 | public bool primitive;
|
---|
| 154 | public bool isArray;
|
---|
| 155 | public int arrayCount;
|
---|
| 156 | public int size;
|
---|
| 157 | public List<JsonFieldInfo> fields;
|
---|
| 158 | }
|
---|
| 159 |
|
---|
| 160 | public class JsonPropertyInfo : JsonFieldInfo
|
---|
| 161 | {
|
---|
| 162 | public JsonObjectInfo classInfo;
|
---|
| 163 | public byte propertyCode;
|
---|
| 164 | public List<string> access;
|
---|
| 165 | public List<string> required;
|
---|
| 166 |
|
---|
| 167 | public JsonPropertyInfo()
|
---|
| 168 | {
|
---|
| 169 | }
|
---|
| 170 |
|
---|
| 171 | public JsonPropertyInfo(dynamic p)
|
---|
| 172 | {
|
---|
| 173 | classInfo = p.classInfo;
|
---|
| 174 | propertyCode = p.propertyCode;
|
---|
| 175 | access = p.access;
|
---|
| 176 | required = p.required;
|
---|
| 177 | description = p.description;
|
---|
| 178 | valueDescription = p.valueDescription;
|
---|
| 179 | unitDescription = p.unitDescription;
|
---|
| 180 | initialValue = p.initialValue;
|
---|
| 181 | type = p.type;
|
---|
| 182 | identifer = p.identifer;
|
---|
| 183 | primitive = p.primitive;
|
---|
| 184 | isArray = p.isArray;
|
---|
| 185 | arrayCount = p.arrayCount;
|
---|
| 186 | size = p.size;
|
---|
| 187 | fields = p.fields;
|
---|
| 188 | }
|
---|
| 189 | }
|
---|
| 190 |
|
---|
| 191 | public class JsonSkeltonResult
|
---|
| 192 | {
|
---|
| 193 | public string macro;
|
---|
| 194 | public string declare;
|
---|
| 195 | public string predefine;
|
---|
| 196 | public string types;
|
---|
| 197 | public string funcs;
|
---|
| 198 | public string instance;
|
---|
| 199 | public string define;
|
---|
| 200 | public string config;
|
---|
| 201 | }
|
---|
| 202 | }
|
---|