Documentation ¶
Index ¶
- Constants
- Variables
- func ChangeDevice(old *model.DeviceInfo, data *dm.DeviceInfo)
- func DBToRPCFmt(db interface{}) interface{}
- func GetFileName(in *dm.GetDeviceLogReq) bson.D
- func GetNullTime(time sql.NullTime) int64
- func UpdateProduct(old *model.ProductInfo, data *dm.ProductInfo)
- type AccessAuthLogic
- type GetDeviceDataLogic
- type GetDeviceInfoLogic
- type GetDeviceLogLogic
- type GetProductInfoLogic
- type LoginAuthLogic
- type ManageDeviceLogic
- func (l *ManageDeviceLogic) AddDevice(in *dm.ManageDeviceReq) (*dm.DeviceInfo, error)
- func (l *ManageDeviceLogic) CheckDevice(in *dm.ManageDeviceReq) (bool, error)
- func (l *ManageDeviceLogic) CheckProduct(in *dm.ManageDeviceReq) (bool, error)
- func (l *ManageDeviceLogic) DelDevice(in *dm.ManageDeviceReq) (*dm.DeviceInfo, error)
- func (l *ManageDeviceLogic) ManageDevice(in *dm.ManageDeviceReq) (*dm.DeviceInfo, error)
- func (l *ManageDeviceLogic) ModifyDevice(in *dm.ManageDeviceReq) (*dm.DeviceInfo, error)
- type ManageProductLogic
- func (l *ManageProductLogic) AddProduct(in *dm.ManageProductReq) (*dm.ProductInfo, error)
- func (l *ManageProductLogic) CheckProduct(in *dm.ManageProductReq) (bool, error)
- func (l *ManageProductLogic) DelProduct(in *dm.ManageProductReq) (*dm.ProductInfo, error)
- func (l *ManageProductLogic) InsertProduct(in *dm.ManageProductReq) *model.ProductInfo
- func (l *ManageProductLogic) ManageProduct(in *dm.ManageProductReq) (*dm.ProductInfo, error)
- func (l *ManageProductLogic) ModifyProduct(in *dm.ManageProductReq) (*dm.ProductInfo, error)
- type PwdInfo
- type SendActionLogic
- type SendPropertyLogic
Constants ¶
const ( Hmacsha256 = "hmacsha256" Hmacsha1 = "hmacsha1" )
Variables ¶
var TopicPub map[string][]string = map[string][]string{ "$thing": []string{"$thing/up/property/%s/%s", "$thing/up/event/%s/%s", "$thing/up/action/%s/%s", }, "$ota": []string{ "$ota/report/%s/%s", }, }
var TopicSub map[string][]string = map[string][]string{ "$thing": []string{ "$thing/down/property/%s/%s", "$thing/down/event/%s/%s", "$thing/down/action/%s/%s", }, "$ota": []string{ "$ota/update/%s/%s", "$broadcast/rxd/%s/%s", }, "$broadcast": []string{ "$broadcast/rxd/%s/%s", }, }
物理型topic: $thing/up/property/${productID}/${deviceName} 发布 属性上报 $thing/down/property/${productID}/${deviceName} 订阅 属性下发与属性上报响应 $thing/up/event/${productID}/${deviceName} 发布 事件上报 $thing/down/event/${productID}/${deviceName} 订阅 事件上报响应 $thing/up/action/${productID}/${deviceName} 发布 设备响应行为执行结果 $thing/down/action/${productID}/${deviceName} 订阅 应用调用设备行为 系统级topic: $ota/report/${productID}/${deviceName} 发布 固件升级消息上行 $ota/update/${productID}/${deviceName} 订阅 固件升级消息下行 $broadcast/rxd/${productID}/${deviceName} 订阅 广播消息下行 自定义topic: ${productID}/${deviceName}/control 订阅 编辑删除 ${productID}/${deviceName}/data 订阅和发布 编辑删除 ${productID}/${deviceName}/event 发布 ${productID}/${deviceName}/xxxxx 订阅和发布 //自定义 暂不做支持
key 为topic的第一个 value 为该key下的正则表达式
Functions ¶
func ChangeDevice ¶
func ChangeDevice(old *model.DeviceInfo, data *dm.DeviceInfo)
func DBToRPCFmt ¶
func DBToRPCFmt(db interface{}) interface{}
func GetFileName ¶
func GetFileName(in *dm.GetDeviceLogReq) bson.D
func GetNullTime ¶
func UpdateProduct ¶
func UpdateProduct(old *model.ProductInfo, data *dm.ProductInfo)
Types ¶
type AccessAuthLogic ¶
func NewAccessAuthLogic ¶
func NewAccessAuthLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AccessAuthLogic
func (*AccessAuthLogic) AccessAuth ¶
func (l *AccessAuthLogic) AccessAuth(in *dm.AccessAuthReq) (*dm.Response, error)
func (*AccessAuthLogic) CompareTopic ¶
func (l *AccessAuthLogic) CompareTopic(in *dm.AccessAuthReq) error
type GetDeviceDataLogic ¶
func NewGetDeviceDataLogic ¶
func NewGetDeviceDataLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDeviceDataLogic
func (*GetDeviceDataLogic) GetDeviceData ¶
func (l *GetDeviceDataLogic) GetDeviceData(in *dm.GetDeviceDataReq) (*dm.GetDeviceDataResp, error)
type GetDeviceInfoLogic ¶
func NewGetDeviceInfoLogic ¶
func NewGetDeviceInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDeviceInfoLogic
func (*GetDeviceInfoLogic) GetDeviceInfo ¶
func (l *GetDeviceInfoLogic) GetDeviceInfo(in *dm.GetDeviceInfoReq) (resp *dm.GetDeviceInfoResp, err error)
type GetDeviceLogLogic ¶
func NewGetDeviceLogLogic ¶
func NewGetDeviceLogLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDeviceLogLogic
func (*GetDeviceLogLogic) GetDeviceLog ¶
func (l *GetDeviceLogLogic) GetDeviceLog(in *dm.GetDeviceLogReq) (*dm.GetDeviceLogResp, error)
func (*GetDeviceLogLogic) HandleData ¶
func (l *GetDeviceLogLogic) HandleData(in *dm.GetDeviceLogReq) (*dm.GetDeviceLogResp, error)
type GetProductInfoLogic ¶
func NewGetProductInfoLogic ¶
func NewGetProductInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProductInfoLogic
func (*GetProductInfoLogic) GetProductInfo ¶
func (l *GetProductInfoLogic) GetProductInfo(in *dm.GetProductInfoReq) (resp *dm.GetProductInfoResp, err error)
type LoginAuthLogic ¶
func NewLoginAuthLogic ¶
func NewLoginAuthLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LoginAuthLogic
func (*LoginAuthLogic) CmpPwd ¶
func (l *LoginAuthLogic) CmpPwd(in *dm.LoginAuthReq) error
func (*LoginAuthLogic) GetPwdInfo ¶
func (l *LoginAuthLogic) GetPwdInfo(password string) (*PwdInfo, error)
func (*LoginAuthLogic) LoginAuth ¶
func (l *LoginAuthLogic) LoginAuth(in *dm.LoginAuthReq) (*dm.Response, error)
func (*LoginAuthLogic) UpdateLoginTime ¶
func (l *LoginAuthLogic) UpdateLoginTime()
type ManageDeviceLogic ¶
func NewManageDeviceLogic ¶
func NewManageDeviceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ManageDeviceLogic
func (*ManageDeviceLogic) AddDevice ¶
func (l *ManageDeviceLogic) AddDevice(in *dm.ManageDeviceReq) (*dm.DeviceInfo, error)
func (*ManageDeviceLogic) CheckDevice ¶
func (l *ManageDeviceLogic) CheckDevice(in *dm.ManageDeviceReq) (bool, error)
发现返回true 没有返回false
func (*ManageDeviceLogic) CheckProduct ¶
func (l *ManageDeviceLogic) CheckProduct(in *dm.ManageDeviceReq) (bool, error)
发现返回true 没有返回false
func (*ManageDeviceLogic) DelDevice ¶
func (l *ManageDeviceLogic) DelDevice(in *dm.ManageDeviceReq) (*dm.DeviceInfo, error)
func (*ManageDeviceLogic) ManageDevice ¶
func (l *ManageDeviceLogic) ManageDevice(in *dm.ManageDeviceReq) (*dm.DeviceInfo, error)
func (*ManageDeviceLogic) ModifyDevice ¶
func (l *ManageDeviceLogic) ModifyDevice(in *dm.ManageDeviceReq) (*dm.DeviceInfo, error)
type ManageProductLogic ¶
func NewManageProductLogic ¶
func NewManageProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ManageProductLogic
func (*ManageProductLogic) AddProduct ¶
func (l *ManageProductLogic) AddProduct(in *dm.ManageProductReq) (*dm.ProductInfo, error)
func (*ManageProductLogic) CheckProduct ¶
func (l *ManageProductLogic) CheckProduct(in *dm.ManageProductReq) (bool, error)
发现返回true 没有返回false
func (*ManageProductLogic) DelProduct ¶
func (l *ManageProductLogic) DelProduct(in *dm.ManageProductReq) (*dm.ProductInfo, error)
func (*ManageProductLogic) InsertProduct ¶
func (l *ManageProductLogic) InsertProduct(in *dm.ManageProductReq) *model.ProductInfo
根据用户的输入生成对应的数据库数据
func (*ManageProductLogic) ManageProduct ¶
func (l *ManageProductLogic) ManageProduct(in *dm.ManageProductReq) (*dm.ProductInfo, error)
func (*ManageProductLogic) ModifyProduct ¶
func (l *ManageProductLogic) ModifyProduct(in *dm.ManageProductReq) (*dm.ProductInfo, error)
type PwdInfo ¶
type PwdInfo struct { HmacHandle func(data string, secret []byte) string // contains filtered or unexported fields }
password 字段格式为: ${token};hmac 签名方法 其中 hmac 签名方法字段填写第三步用到的摘要算法,可选的值有 hmacsha256 和 hmacsha1。
type SendActionLogic ¶
func NewSendActionLogic ¶
func NewSendActionLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SendActionLogic
func (*SendActionLogic) SendAction ¶
func (l *SendActionLogic) SendAction(in *dm.SendActionReq) (*dm.SendActionResp, error)
type SendPropertyLogic ¶
func NewSendPropertyLogic ¶
func NewSendPropertyLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SendPropertyLogic
func (*SendPropertyLogic) SendProperty ¶
func (l *SendPropertyLogic) SendProperty(in *dm.SendPropertyReq) (*dm.SendPropertyResp, error)