main.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package main
  2. import (
  3. "fmt"
  4. "github.com/yuguorong/go/log"
  5. "os"
  6. "github.com/ammeter/api"
  7. "github.com/ammeter/config"
  8. "github.com/ammeter/platform"
  9. )
  10. //Port 端口
  11. const (
  12. REQ_AMGW_URL = "/platform/dev/get-4G-gateway-list"
  13. REQ_AMMETER_URL = "/platform/dev/get-ammeter-list"
  14. REQ_AIR_URL = "/platform/dev/get-sair-list"
  15. GATEWAY_VERSION = "2.0.1.0"
  16. )
  17. func init() {
  18. }
  19. func main() {
  20. if len(os.Args) > 1 {
  21. inputParam := os.Args[1]
  22. switch inputParam {
  23. case "info":
  24. fmt.Println(GATEWAY_VERSION)
  25. os.Exit(0)
  26. }
  27. }
  28. log.Info("***************************************************")
  29. log.Infof(" ammeter start. version:%s ", GATEWAY_VERSION)
  30. log.Info("***************************************************")
  31. //config.GetSysConfig().SetValue("Bus/DtuServer/Port", DEF_FTP_PORT)
  32. config.GetSysConfig().SetValue("GatwayVersion", GATEWAY_VERSION)
  33. log.Info("process start...")
  34. p := platform.PaPlatform{}
  35. p.SetGatewayUrl("/platform/dev/get-4G-gateway-list")
  36. p.SetModel("ammeter", REQ_AMMETER_URL)
  37. p.SetModel("SA10", REQ_AIR_URL)
  38. p.SaveModel()
  39. api.RestServerStart()
  40. platform.StartServer()
  41. }