Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
z2m
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xAAL
Code
Go
z2m
Commits
136b12a1
Commit
136b12a1
authored
8 months ago
by
KERDREUX Jerome
Browse files
Options
Downloads
Patches
Plain Diff
Switch to enum
parent
0e2ff75b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
z2m.go
+20
-16
20 additions, 16 deletions
z2m.go
with
20 additions
and
16 deletions
z2m.go
+
20
−
16
View file @
136b12a1
...
...
@@ -13,6 +13,18 @@ import (
"gitlab.imt-atlantique.fr/xaal/code/go/core/xaal"
)
const
(
AccessLevelR
AccessLevel
=
1
AccessLevelW
AccessLevel
=
2
AccessLevelRW
AccessLevel
=
3
AccessLevelRN
AccessLevel
=
5
AccessLevelRWN
AccessLevel
=
7
)
type
(
AccessLevel
int
)
var
ignoredTopics
=
[]
string
{
mqttTopic
+
"/bridge/groups"
,
mqttTopic
+
"/bridge/definitions"
,
...
...
@@ -63,20 +75,12 @@ func (bDev *BridgeDevice) SetTopic() string {
return
bDev
.
GetTopic
()
+
"/set"
}
func
getAccessType
(
level
int
)
string
{
switch
level
{
case
1
:
return
"R"
case
2
:
return
"W"
case
3
:
return
"RW"
case
5
:
return
"RN"
case
7
:
return
"RWN"
func
(
l
AccessLevel
)
String
()
string
{
return
[
...
]
string
{
"R"
,
"W"
,
"RW"
,
"RN"
,
"RWN"
}[
l
]
}
return
""
func
(
l
AccessLevel
)
EnumIndex
()
int
{
return
int
(
l
)
}
func
(
bDev
*
BridgeDevice
)
dump
()
{
...
...
@@ -102,11 +106,11 @@ func (bDev *BridgeDevice) dump() {
features
:=
""
if
len
(
expose
.
Features
)
>
0
{
for
_
,
feature
:=
range
expose
.
Features
{
features
+=
fmt
.
Sprintf
(
"- %s[%s]-%s-(%s){%s}
\n
"
,
feature
.
Name
,
feature
.
Type
,
get
Access
Type
(
feature
.
Access
),
feature
.
Unit
,
feature
.
Property
)
features
+=
fmt
.
Sprintf
(
"- %s[%s]-%s-(%s){%s}
\n
"
,
feature
.
Name
,
feature
.
Type
,
Access
Level
(
feature
.
Access
),
feature
.
Unit
,
feature
.
Property
)
}
features
=
strings
.
TrimSuffix
(
features
,
"
\n
"
)
}
expTab
.
AppendRow
(
table
.
Row
{
expose
.
Name
,
expose
.
Type
,
get
Access
Type
(
expose
.
Access
),
expose
.
Unit
,
values
,
features
})
expTab
.
AppendRow
(
table
.
Row
{
expose
.
Name
,
expose
.
Type
,
Access
Level
(
expose
.
Access
),
expose
.
Unit
,
values
,
features
})
}
fmt
.
Println
(
expTab
.
Render
())
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment