device.go 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. AliasName string `json:"aliasName"`
  14. }
  15. type DeviceInfo struct {
  16. gorm.Model
  17. Type string `gorm:"type type:varchar(2) not null comment '分类:0脑电;1心电'"`
  18. Mac string `gorm:"mac type:varchar(20) not null comment 'Mac 地址'"`
  19. Name string `gorm:"name type:varchar(50) not null comment '名称'"`
  20. AliasName string `gorm:"aliasName type:varchar(50) comment '别名'"`
  21. }
  22. type DeviceConnParam struct {
  23. Chip string `json:"chip" binding:"required" ` //芯片 0/1
  24. AddrType string `json:"addrType" binding:"required"` //地址类型 public/random
  25. Mac string `json:"mac" binding:"required"` //设备Mac地址
  26. FilterName string `json:"filterName" binding:"required"` // 0 脑电 1 心电
  27. }
  28. type DeviceScannedFromGateway struct {
  29. Bdaddrs []Bdaddrs
  30. ChipId int64
  31. EvtType int64
  32. Name string
  33. Rssi int64
  34. adData string
  35. }
  36. type Bdaddrs struct {
  37. Bdaddr string `json:"bdaddr"`
  38. BdaddrType string `json:"bdaddrType"`
  39. }
  40. type DeviceScanned struct {
  41. MAC string
  42. Name string
  43. Rssi int64
  44. BdadrType string //地址类型
  45. Chip int64
  46. DeviceType string
  47. }
  48. type DeviceDataReceived struct {
  49. Value string `json:"value"`
  50. Handle int64 `json:"handle"`
  51. Mac string `json:"id"`
  52. DataType string `json:"dataType"`
  53. AliasName string `json:"aliasName"`
  54. }
  55. type ConnectedDevice struct {
  56. MAC string
  57. Name string
  58. DeviceType string
  59. State string
  60. }
  61. type ConnectDevice struct {
  62. Mac string `json:"mac"`
  63. Ai string `json:"ai"`
  64. At string `json:"at"`
  65. }