-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
71 lines (56 loc) · 1.59 KB
/
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
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
package main
import (
"fmt"
"goyo.in/gpstracker/network"
// import "goyo.in/gpstracker/network"
// import "goyo.in/gpstracker/crc16"
restservice "goyo.in/gpstracker/conf"
)
func main() {
//Start TCP server
en := network.TCPServer{Host: "0.0.0.0", Port: "6969", Timeout: 3000}
err := en.Open()
if err != nil {
fmt.Println("Error accepting: ", err.Error())
}
//Start Rest API & Socket.io server
restservice.RestfulAPIServiceInit("HTTP")
//compute crc
// data := crc16.HexStringToCrcHexString("05130100")
// //fmt.Println(Hex2Bin([]byte("154C")))
// fmt.Println(data)
// fmt.Println(hexToBin("154C","%016b"))
// fmt.Println([]byte("154C"))
// u := models.User{}
// query := func(c *mgo.Collection) error {
// fn := c.Find(nil).All(&u)
// return fn
// }
// err := withCollection("trps",query)
// if err != nil {
// // TODO: Do something about the error
// } else {
// fmt.Println("Results All: ", u)
// }
//var results []mongomodel.User
// session := mongo.GetSession();
// c := session.DB("goyosch").C("trps")
// err := c.Find(nil).All(&results)
// if err != nil {
// // TODO: Do something about the error
// } else {
// fmt.Println("Results All: ", results)
// }
// query := func(c *mgo.Collection) error {
// fn := c.Find(nil).All(&results)
// return fn
// }
// withCollection("trps", query)
// fmt.Println("Results All: ", results)
}
// func withCollection(collection string, s func(*mgo.Collection) error) error {
// session := mongo.GetSession()
// defer session.Close()
// c := session.DB("goyosch").C(collection)
// return s(c)
// }