-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.go
35 lines (28 loc) · 932 Bytes
/
main.go
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
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
package main
import (
"cosim-demo-app/libcosim"
"cosim-demo-app/server"
"cosim-demo-app/structs"
)
func main() {
libcosim.SetupLogging()
sim := libcosim.CreateEmptySimulation()
// Creating a command channel
cmd := make(chan []string, 10)
state := make(chan structs.JsonResponse, 10)
simulationStatus := structs.SimulationStatus{
Loaded: false,
Status: "stopped",
Trends: []structs.Trend{},
LibVersion: libcosim.Version(),
}
// Passing the channel to the go routine
go libcosim.StateUpdateLoop(state, &simulationStatus, &sim)
go libcosim.CommandLoop(state, &sim, cmd, &simulationStatus)
//Passing the channel to the server
server.Server(cmd, state, &simulationStatus, &sim)
close(cmd)
}