-
Notifications
You must be signed in to change notification settings - Fork 1
/
onem2m.m.battery.json
136 lines (136 loc) · 4.99 KB
/
onem2m.m.battery.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
{
"id": "http://openinterconnect.org/onem2mmapping/schemas/onem2m.m.battery.json#",
"$schema": "http://json-schema.org/draft-04/schema#",
"description" : "Copyright (c) 2018 Open Connectivity Foundation, Inc. All rights reserved.",
"title": "Battery",
"definitions": {
"onem2m.m.battery": {
"type": "object",
"properties": {
"level": {
"type": "integer",
"description": "The rounded percentage of the current charging level of a battery in the range of [0, 100]",
"x-ocf-conversion": {
"x-ocf-alias": "oic.r.energy.battery",
"x-to-ocf": [
"oic.r.energy.battery.charge = level"
],
"x-from-ocf": [
"level = oic.r.energy.battery.charge"
]
}
},
"capacity": {
"type": "integer",
"description": "The total capacity of battery in mAh",
"x-ocf-conversion": {
"x-ocf-alias": "oic.r.energy.battery",
"x-to-ocf": [
"oic.r.energy.battery.capacity = capacity / 1000"
],
"x-from-ocf": [
"capacity = oic.r.energy.battery.capacity * 1000"
]
}
},
"charging": {
"type": "boolean",
"description": "The status of charging. 'True' indicates enabled, and ''False' indicates not enabled",
"x-ocf-conversion": {
"x-ocf-alias": "oic.r.energy.battery",
"x-to-ocf": [
"oic.r.energy.battery.charging = charging"
],
"x-from-ocf": [
"charging = oic.r.energy.battery.charging"
]
}
},
"discharging": {
"type": "boolean",
"description": "The status of discharging. 'True' indicates charging, and 'False' indicates not charging",
"x-ocf-conversion": {
"x-ocf-alias": "oic.r.energy.battery",
"x-to-ocf": [
"oic.r.energy.battery.discharging = discharging"
],
"x-from-ocf": [
"discharging = oic.r.energy.battery.discharging"
]
}
},
"lowBattery": {
"type": "boolean",
"description": "To indicate that the battery is on a low charge level",
"x-ocf-conversion": {
"x-ocf-alias": "oic.r.energy.battery",
"x-to-ocf": [
"oic.r.energy.battery.lowbattery = lowBattery"
],
"x-from-ocf": [
"lowBattery = oic.r.energy.battery.lowbattery"
]
}
},
"batteryThreshold": {
"type": "integer",
"description": "When a battery's 'level' is less than 'batteryThreshold' then 'lowBattery' is set to 'True'. This datapoint can be used to raise an alarm, depending on the implementation",
"x-ocf-conversion": {
"x-ocf-alias": "oic.r.energy.battery",
"x-to-ocf": [
"oic.r.energy.battery.batterythreshold = batteryThreshold"
],
"x-from-ocf": [
"batteryThreshold = oic.r.energy.battery.batterythreshold"
]
}
},
"electricEnergy": {
"type": "integer",
"description": "Rated electric energy. The unit of measure is ampere (A)",
"x-ocf-conversion": {
"x-ocf-alias": "oic.r.energy.battery",
"x-to-ocf": [
"oic.r.energy.electrical.current = electricEnergy"
],
"x-from-ocf": [
"electricEnergy = oic.r.energy.electrical.current"
]
}
},
"voltage": {
"type": "integer",
"description": "Rated voltage. The unit of measure is volts (V)",
"x-ocf-conversion": {
"x-ocf-alias": "oic.r.energy.battery",
"x-to-ocf": [
"oic.r.energy.electrical.voltage = voltage"
],
"x-from-ocf": [
"voltage = oic.r.energy.electrical.voltage"
]
}
},
"material": {
"type": "string",
"description": "The material of the cell (for example lithium ion, nickel and lead",
"x-ocf-conversion": {
"x-ocf-alias": "oic.r.energy.battery",
"x-to-ocf": [
"oic.r.batterymaterial.material = material",
"Direct translation is difficult as OCF has declared an enumeration of strings where oneM2M has a free-form string. Translation code will need to determine which oneM2M strings can be mapped to the OCF enumerated values in oic.r.batterymaterial"
],
"x-from-ocf": [
"material = oic.r.batterymaterial.material[INDEX]"
]
}
}
}
}
},
"type": "object",
"allOf": [
{"$ref": "#/definitions/onem2m.m.battery"}
],
"required": [ "level" ]
}