saas-smartAi通信协议标准库
gongshangguo
2022-03-02 6c31643efa07274245b6fe4ef95f39c1460f4b70
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: aiot_business.proto
 
package aiot
 
import (
    fmt "fmt"
    proto "github.com/golang/protobuf/proto"
    math "math"
)
 
import (
    context "context"
    client "github.com/micro/go-micro/client"
    server "github.com/micro/go-micro/server"
)
 
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
 
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
 
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ client.Option
var _ server.Option
 
// Client API for AiotService service
 
type AiotService interface {
    GetBusiness(ctx context.Context, in *BusinessReq, opts ...client.CallOption) (*BusinessReply, error)
    SendAiotReq(ctx context.Context, in *Protocol, opts ...client.CallOption) (*Protocol, error)
}
 
type aiotService struct {
    c    client.Client
    name string
}
 
func NewAiotService(name string, c client.Client) AiotService {
    if c == nil {
        c = client.NewClient()
    }
    if len(name) == 0 {
        name = "aiot"
    }
    return &aiotService{
        c:    c,
        name: name,
    }
}
 
func (c *aiotService) GetBusiness(ctx context.Context, in *BusinessReq, opts ...client.CallOption) (*BusinessReply, error) {
    req := c.c.NewRequest(c.name, "AiotService.GetBusiness", in)
    out := new(BusinessReply)
    err := c.c.Call(ctx, req, out, opts...)
    if err != nil {
        return nil, err
    }
    return out, nil
}
 
func (c *aiotService) SendAiotReq(ctx context.Context, in *Protocol, opts ...client.CallOption) (*Protocol, error) {
    req := c.c.NewRequest(c.name, "AiotService.SendAiotReq", in)
    out := new(Protocol)
    err := c.c.Call(ctx, req, out, opts...)
    if err != nil {
        return nil, err
    }
    return out, nil
}
 
// Server API for AiotService service
 
type AiotServiceHandler interface {
    GetBusiness(context.Context, *BusinessReq, *BusinessReply) error
    SendAiotReq(context.Context, *Protocol, *Protocol) error
}
 
func RegisterAiotServiceHandler(s server.Server, hdlr AiotServiceHandler, opts ...server.HandlerOption) error {
    type aiotService interface {
        GetBusiness(ctx context.Context, in *BusinessReq, out *BusinessReply) error
        SendAiotReq(ctx context.Context, in *Protocol, out *Protocol) error
    }
    type AiotService struct {
        aiotService
    }
    h := &aiotServiceHandler{hdlr}
    return s.Handle(s.NewHandler(&AiotService{h}, opts...))
}
 
type aiotServiceHandler struct {
    AiotServiceHandler
}
 
func (h *aiotServiceHandler) GetBusiness(ctx context.Context, in *BusinessReq, out *BusinessReply) error {
    return h.AiotServiceHandler.GetBusiness(ctx, in, out)
}
 
func (h *aiotServiceHandler) SendAiotReq(ctx context.Context, in *Protocol, out *Protocol) error {
    return h.AiotServiceHandler.SendAiotReq(ctx, in, out)
}