Commit 8c23a7a 1 parent a683fb7 commit 8c23a7a Copy full SHA for 8c23a7a
File tree 2 files changed +8
-3
lines changed
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ type DatapointValue interface {
17
17
Unpack (data []byte ) error
18
18
}
19
19
20
- // DatapointMeta gives meta information about a datapoint type .
20
+ // DatapointMeta gives meta information about a datapoint.
21
21
type DatapointMeta interface {
22
22
// Unit returns the unit of this datapoint type or empty string if it doesn't have a unit.
23
23
Unit () string
Original file line number Diff line number Diff line change 1
1
// Copyright 2020 Sven Rebhan.
2
- // Copyright 2022 Martin Müller.
2
+ // Copyright 2024 Martin Müller.
3
3
// Licensed under the MIT license which can be found in the LICENSE file.
4
4
5
5
package dpt
@@ -29,6 +29,9 @@ var dptTypes = map[string]Datapoint{
29
29
"1.017" : new (DPT_1017 ),
30
30
"1.018" : new (DPT_1018 ),
31
31
"1.019" : new (DPT_1019 ),
32
+ "1.021" : new (DPT_1021 ),
33
+ "1.022" : new (DPT_1022 ),
34
+ "1.023" : new (DPT_1023 ),
32
35
"1.024" : new (DPT_1024 ),
33
36
"1.100" : new (DPT_1100 ),
34
37
@@ -255,10 +258,12 @@ func ListSupportedTypes() []string {
255
258
return keys
256
259
}
257
260
258
- // Produce returns an uninitialized instance of the given datapoint name, e.g. "1.001".
261
+ // Produce returns an uninitialized instance, given the exact datapoint name.
262
+ // It returns a DPT_1001 for "1.001".
259
263
func Produce (name string ) (d Datapoint , ok bool ) {
260
264
// Lookup the given type and return a datapoint of that type.
261
265
x , ok := dptTypes [name ]
266
+
262
267
if ok {
263
268
d_type := reflect .TypeOf (x ).Elem ()
264
269
d = reflect .New (d_type ).Interface ().(Datapoint )
You can’t perform that action at this time.
0 commit comments