config.go 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package protocol
  2. // 网关配置
  3. type MqttConfig struct {
  4. Server string `json:"server"`
  5. User string `json:"user"`
  6. Password string `json:"password"`
  7. Timeout uint `json:"timeout"`
  8. }
  9. type RedisConfig struct {
  10. Server string `json:"server"`
  11. Password string `json:"password"`
  12. }
  13. type EdgeConfig struct {
  14. Mqtt MqttConfig `json:"mqtt"`
  15. Redis RedisConfig `json:"redis"`
  16. }
  17. type CloudConfig struct {
  18. Mqtt MqttConfig `json:"mqtt"`
  19. }
  20. type AppConfig struct {
  21. Name string `json:"name"` //应用名称
  22. Tenant string `json:"tenant"` //租户ID
  23. GID string `json:"gid"` //网关ID
  24. SN string `json:"sn"` //序列号
  25. Upgrade bool `json:"upgrade"` //需要升级
  26. UpdateUrl string `json:"updateurl"` //更新服务URL
  27. NtpServer string `json:"ntpserver"` //NTP服务器地址
  28. Edge EdgeConfig `json:"edge"` //边缘端配置
  29. Cloud CloudConfig `json:"cloud"` //云端配置
  30. }
  31. // --------------------------------------------------------
  32. // 串口配置
  33. type SerialConfig struct {
  34. Serial map[uint8]*SerialPort `json:"serial"`
  35. }
  36. type SerialPort struct {
  37. Code uint8 `json:"code"` //key串口编号,上层应用使用,网关下唯一
  38. Interface string `json:"interface"` //串口物理位置,方便维修
  39. Address string `json:"address"` //串口地址
  40. BaudRate int `json:"baudrate"`
  41. DataBits uint8 `json:"databits"`
  42. StopBits uint `json:"stopbits"`
  43. Parity string `json:"parity"`
  44. Timeout uint `json:"timeout"` //毫秒
  45. ProtocolType uint8 `json:"protocoltype"` //0:modbus-rtu;1:长和单灯集控zigbee
  46. }
  47. // 设备配置
  48. type DevInfo struct {
  49. Code uint8 `json:"code"` //串口编号,上层应用使用,网关下唯一
  50. DevID uint8 `json:"devid"` //从设备地址,配置时设定,串口下唯一
  51. DevCode string `json:"devcode"` //设备编码,应用层使用
  52. TID uint16 `json:"tid"` //模型ID
  53. Name string `json:"name"` //从设备名称
  54. SendCloud int `json:"sendcloud"` //毫秒
  55. WaitTime uint `json:"waittime"` //发送后等待多久
  56. ProtocolType uint8 `json:"protocoltype"` //0:modbus-rtu;1:长和单灯集控zigbee;2:裕明485单灯控制器协议
  57. DevType uint8 `json:"devtype"` //设备类型,1-灯控类设备 2-环境监测类设备 3-裕明485单灯控制器 4-液位计 5-路面状况传感器
  58. Height float64 `json:"height"` //离地高度,液位计适用
  59. }
  60. type MapDevConfig struct {
  61. Rtu []DevInfo `json:"dev"`
  62. }
  63. // 摄象机和一键报警(带摄象机功能)的配置
  64. type OnvifDev struct {
  65. Code string `json:"code"`
  66. SN string `json:"sn"`
  67. IP string `json:"ip"`
  68. Name string `json:"name"`
  69. Brand string `json:"brand"`
  70. Model string `json:"model"`
  71. DevType int `json:"devtype"` //3摄象机,4一键报警(带视频)
  72. User string `json:"user"`
  73. Password string `json:"password"`
  74. RtmpServer string `json:"rtmpserver"`
  75. WebServer string `json:"webserver"`
  76. Event string `json:"event"`
  77. Gb28181 bool `json:"gb28181"` //国标28181
  78. }
  79. // 抓拍单元配置
  80. type ITSDev struct {
  81. Code string `json:"code"`
  82. ID string `json:"id"`
  83. TollgateID string `json:"tollgateid"`
  84. Name string `json:"name"`
  85. Brand string `json:"brand"`
  86. Model string `json:"model"`
  87. DevType int `json:"devtype"` //5 抓拍单元
  88. User string `json:"user"`
  89. Password string `json:"password"`
  90. IP string `json:"ip"`
  91. Port uint16 `json:"port"`
  92. }
  93. type ITSDevConfig struct {
  94. IPAddr string `json:"ipaddr"`
  95. SuggestSpeed uint8 `json:"suggestspeed"`
  96. Duration int `json:"duration"`
  97. EnvID string `json:"envid"`
  98. DefProvince string `json:"defprovince"`
  99. DefCity string `json:"defcity"`
  100. RemotePub uint8 `json:"remotepub"`
  101. RemoteSub string `json:"remotesub"`
  102. Its []ITSDev `json:"dev"`
  103. }