| | |
| | | type AiotService interface { |
| | | // 发送指向单个设备的请求 |
| | | SendToNode(ctx context.Context, in *NodeReq, opts ...client.CallOption) (*BusinessReply, error) |
| | | // 直接发送tcp请求 |
| | | SendAiotReq(ctx context.Context, in *Protocol, opts ...client.CallOption) (*BusinessReply, error) |
| | | // 直接发送同步tcp请求 |
| | | SendAiotSyncReq(ctx context.Context, in *Protocol, opts ...client.CallOption) (*BusinessReply, error) |
| | | // 直接发送异步tcp请求 |
| | | SendAiotAsyncReq(ctx context.Context, in *Protocol, opts ...client.CallOption) (*BusinessReply, error) |
| | | // 发送群组请求 |
| | | SendToCluster(ctx context.Context, in *ClusterReq, opts ...client.CallOption) (*BusinessReply, error) |
| | | // 向多个设备同时发起相同参数请求 |
| | |
| | | return out, nil |
| | | } |
| | | |
| | | func (c *aiotService) SendAiotReq(ctx context.Context, in *Protocol, opts ...client.CallOption) (*BusinessReply, error) { |
| | | req := c.c.NewRequest(c.name, "AiotService.SendAiotReq", in) |
| | | func (c *aiotService) SendAiotSyncReq(ctx context.Context, in *Protocol, opts ...client.CallOption) (*BusinessReply, error) { |
| | | req := c.c.NewRequest(c.name, "AiotService.SendAiotSyncReq", in) |
| | | out := new(BusinessReply) |
| | | err := c.c.Call(ctx, req, out, opts...) |
| | | if err != nil { |
| | | return nil, err |
| | | } |
| | | return out, nil |
| | | } |
| | | |
| | | func (c *aiotService) SendAiotAsyncReq(ctx context.Context, in *Protocol, opts ...client.CallOption) (*BusinessReply, error) { |
| | | req := c.c.NewRequest(c.name, "AiotService.SendAiotAsyncReq", in) |
| | | out := new(BusinessReply) |
| | | err := c.c.Call(ctx, req, out, opts...) |
| | | if err != nil { |
| | |
| | | type AiotServiceHandler interface { |
| | | // 发送指向单个设备的请求 |
| | | SendToNode(context.Context, *NodeReq, *BusinessReply) error |
| | | // 直接发送tcp请求 |
| | | SendAiotReq(context.Context, *Protocol, *BusinessReply) error |
| | | // 直接发送同步tcp请求 |
| | | SendAiotSyncReq(context.Context, *Protocol, *BusinessReply) error |
| | | // 直接发送异步tcp请求 |
| | | SendAiotAsyncReq(context.Context, *Protocol, *BusinessReply) error |
| | | // 发送群组请求 |
| | | SendToCluster(context.Context, *ClusterReq, *BusinessReply) error |
| | | // 向多个设备同时发起相同参数请求 |
| | |
| | | func RegisterAiotServiceHandler(s server.Server, hdlr AiotServiceHandler, opts ...server.HandlerOption) error { |
| | | type aiotService interface { |
| | | SendToNode(ctx context.Context, in *NodeReq, out *BusinessReply) error |
| | | SendAiotReq(ctx context.Context, in *Protocol, out *BusinessReply) error |
| | | SendAiotSyncReq(ctx context.Context, in *Protocol, out *BusinessReply) error |
| | | SendAiotAsyncReq(ctx context.Context, in *Protocol, out *BusinessReply) error |
| | | SendToCluster(ctx context.Context, in *ClusterReq, out *BusinessReply) error |
| | | SendToNodes(ctx context.Context, in *NodesReq, out *BusinessReply) error |
| | | } |
| | |
| | | return h.AiotServiceHandler.SendToNode(ctx, in, out) |
| | | } |
| | | |
| | | func (h *aiotServiceHandler) SendAiotReq(ctx context.Context, in *Protocol, out *BusinessReply) error { |
| | | return h.AiotServiceHandler.SendAiotReq(ctx, in, out) |
| | | func (h *aiotServiceHandler) SendAiotSyncReq(ctx context.Context, in *Protocol, out *BusinessReply) error { |
| | | return h.AiotServiceHandler.SendAiotSyncReq(ctx, in, out) |
| | | } |
| | | |
| | | func (h *aiotServiceHandler) SendAiotAsyncReq(ctx context.Context, in *Protocol, out *BusinessReply) error { |
| | | return h.AiotServiceHandler.SendAiotAsyncReq(ctx, in, out) |
| | | } |
| | | |
| | | func (h *aiotServiceHandler) SendToCluster(ctx context.Context, in *ClusterReq, out *BusinessReply) error { |