device.go 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. package gateway
  2. import "gorm.io/gorm"
  3. type DeviceScanParam struct {
  4. Chip string `json:"chip"` //芯片 0和1
  5. FilterName string `json:"filterName"` // 0 脑电 1 心电
  6. FilterRssi string `json:"filterRssi"` //信号强度
  7. FilterMac string `json:"filterMac"` //过滤Mac地址,以","分割,如 61-Dg-89-22-39-3b,80-kD-0E-40-57-8A
  8. FilterType string `json:"filterType"` //1表示扫描数据库中已存在的设备
  9. }
  10. type DeviceAddParam struct {
  11. Type string `json:"type" binding:"required" `
  12. Mac string `json:"mac" binding:"required" `
  13. }
  14. type DeviceInfo struct {
  15. gorm.Model
  16. Type string `gorm:"type type:varchar(2) not null comment '分类:0脑电;1心电'"`
  17. Mac string `gorm:"mac type:varchar(20) not null comment 'Mac 地址'"`
  18. Name string `gorm:"name type:varchar(50) not null comment '名称'"`
  19. }
  20. type DeviceConnParam struct {
  21. Chip string `json:"chip" binding:"required" ` //芯片 0/1
  22. AddrType string `json:"addrType" binding:"required"` //地址类型 public/random
  23. Mac string `json:"mac" binding:"required"` //设备Mac地址
  24. FilterName string `json:"filterName" binding:"required"` // 0 脑电 1 心电
  25. }
  26. type DeviceScannedFromGateway struct {
  27. Bdaddrs []Bdaddrs
  28. ChipId int64
  29. EvtType int64
  30. Name string
  31. Rssi int64
  32. adData string
  33. }
  34. type Bdaddrs struct {
  35. Bdaddr string `json:"bdaddr"`
  36. BdaddrType string `json:"bdaddrType"`
  37. }
  38. type DeviceScanned struct {
  39. MAC string
  40. Name string
  41. Rssi int64
  42. BdadrType string //地址类型
  43. Chip int64
  44. DeviceType string
  45. }
  46. type DeviceDataReceived struct {
  47. Value string `json:"value"`
  48. Handle int64 `json:"handle"`
  49. Mac string `json:"id"`
  50. DataType string `json:"dataType"`
  51. }
  52. type ConnectedDevice struct {
  53. MAC string
  54. Name string
  55. DeviceType string
  56. State string
  57. }
  58. type ConnectDevice struct {
  59. Mac string `json:"mac"`
  60. Ai string `json:"ai"`
  61. At string `json:"at"`
  62. }