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
93ee66bf
Commit
93ee66bf
authored
8 months ago
by
KERDREUX Jerome
Browse files
Options
Downloads
Patches
Plain Diff
Get ride of the engine global variable
parent
af81c797
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
devices.go
+1
-1
1 addition, 1 deletion
devices.go
gateway.go
+6
-2
6 additions, 2 deletions
gateway.go
main.go
+2
-5
2 additions, 5 deletions
main.go
with
9 additions
and
8 deletions
devices.go
+
1
−
1
View file @
93ee66bf
...
...
@@ -46,7 +46,7 @@ func newDevices(bDevice *BridgeDevice) {
setupDevice
(
dev
,
bDevice
)
dev
.
Dump
()
bDevice
.
XAALDevice
=
append
(
bDevice
.
XAALDevice
,
dev
)
eng
.
AddDevice
(
dev
)
GetGW
()
.
engine
.
AddDevice
(
dev
)
}
}
}
This diff is collapsed.
Click to expand it.
gateway.go
+
6
−
2
View file @
93ee66bf
...
...
@@ -4,15 +4,19 @@ import (
"sync"
"gitlab.imt-atlantique.fr/xaal/code/go/core/uuid"
"gitlab.imt-atlantique.fr/xaal/code/go/core/xaal"
)
type
gateway
struct
{
engine
*
xaal
.
Engine
devices
[]
*
BridgeDevice
baseAddr
uuid
.
UUID
}
var
instance
*
gateway
var
once
sync
.
Once
var
(
instance
*
gateway
once
sync
.
Once
)
func
GetGW
()
*
gateway
{
once
.
Do
(
func
()
{
...
...
This diff is collapsed.
Click to expand it.
main.go
+
2
−
5
View file @
93ee66bf
...
...
@@ -7,10 +7,6 @@ import (
"gitlab.imt-atlantique.fr/xaal/code/go/core/xaal"
)
var
(
eng
*
xaal
.
Engine
)
func
main
()
{
mqttBroker
:=
flag
.
String
(
"broker"
,
""
,
"The MQTT broker URL"
)
flag
.
Parse
()
...
...
@@ -24,7 +20,8 @@ func main() {
// client.Publish("zigbee2mqtt/0x70b3d52b600f89d3/set", 0, false, `{"state": "toggle"}`)
xaal
.
SetupLogger
()
eng
=
xaal
.
NewEngine
()
eng
:=
xaal
.
NewEngine
()
GetGW
()
.
engine
=
eng
eng
.
Run
()
client
.
Disconnect
(
250
)
}
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