protocol.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package protocal
  2. type Protocol string
  3. // MQTT mqtt接入协议
  4. const MQTT Protocol = "mqtt"
  5. type DevReport struct {
  6. Action string `json:"action"`
  7. MsgId int64 `json:"msgId"`
  8. SubDeviceId string `json:"subDeviceId"`
  9. DeviceCode string `json:"deviceCode"`
  10. TimeStamp int64 `json:"timeStamp"`
  11. Data *Data `json:"data"`
  12. }
  13. type Data struct {
  14. Cmd string `json:"cmd"`
  15. Params interface{} `json:"params"`
  16. }
  17. type CloudSend struct {
  18. Action string `json:"action"`
  19. DeviceCode string `json:"deviceCode"`
  20. SubDeviceId string `json:"subDeviceId"`
  21. MsgId int `json:"msgId"`
  22. Timestamp int `json:"timestamp"`
  23. Data *Data `json:"data"`
  24. }
  25. // DevLogin 子设备上线
  26. type DevLogin struct {
  27. Action string `json:"action"`
  28. MsgId int `json:"msgId"`
  29. DeviceCode string `json:"deviceCode"`
  30. SubDeviceId string `json:"subDeviceId"`
  31. Timestamp int64 `json:"timestamp"`
  32. }
  33. // DevLogout 子设备下线
  34. type DevLogout struct {
  35. Action string `json:"action"`
  36. MsgId int `json:"msgId"`
  37. DeviceCode string `json:"deviceCode"`
  38. SubDeviceId string `json:"subDeviceId"`
  39. Timestamp int64 `json:"timestamp"`
  40. }