main.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package main
  2. import (
  3. "net"
  4. "github.com/yuguorong/go/log"
  5. "github.com/ammeter/api"
  6. "github.com/ammeter/config"
  7. "github.com/ammeter/platform"
  8. )
  9. //Port 端口
  10. const (
  11. REQ_AMGW_URL = "/platform/dev/get-4G-gateway-list"
  12. REQ_AMMETER_URL = "/platform/dev/get-ammeter-list"
  13. REQ_AIR_URL = "/platform/dev/get-sair-list"
  14. DEF_FTP_PORT = 10010
  15. GATEWAY_VERSION = "2.0.0.1"
  16. )
  17. var Port string
  18. var maxConnCount = 100
  19. var connclientSize = 0
  20. var connlist map[string]net.Conn
  21. var deviceList map[string][]string
  22. func init() {
  23. connlist = make(map[string]net.Conn)
  24. deviceList = map[string][]string{
  25. "9521003872": {"2108", "05420005", "05420003", "05420002"}, //6f
  26. "9521003712": {"2108", "05420001"}, //1F
  27. "9521003534": {"2108", "05420006"}, //-1F
  28. "9521003697": {"2108", "05420004"}, //5c
  29. }
  30. }
  31. func main() {
  32. config.GetSysConfig().SetValue("Bus/DtuServer/Port", DEF_FTP_PORT)
  33. config.GetSysConfig().SetValue("GatwayVersion", GATEWAY_VERSION)
  34. log.Info("process start...")
  35. p := platform.PaPlatform{}
  36. p.SetGatewayUrl("/platform/dev/get-4G-gateway-list")
  37. p.SetModel("ammeter", REQ_AMMETER_URL)
  38. p.SetModel("SA10", REQ_AIR_URL)
  39. p.SaveModel()
  40. api.RestServerStart()
  41. platform.StartServer()
  42. }