Documentation ¶
Overview ¶
Package cq_decode is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterDecodeHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterDecodeHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DecodeClient) error
- func RegisterDecodeHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterDecodeHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DecodeServer) error
- func RegisterDecodeServer(s *grpc.Server, srv DecodeServer)
- type DecodeClient
- type DecodeServer
- type Decode_GetStateClient
- type Decode_GetStateServer
- type Output
- type SetOutRequest
- func (*SetOutRequest) Descriptor() ([]byte, []int)deprecated
- func (x *SetOutRequest) GetId() string
- func (x *SetOutRequest) GetOutputs() []*Output
- func (*SetOutRequest) ProtoMessage()
- func (x *SetOutRequest) ProtoReflect() protoreflect.Message
- func (x *SetOutRequest) Reset()
- func (x *SetOutRequest) String() string
- type SetOutResponse
- type StateRequest
- type StateResponse
- func (*StateResponse) Descriptor() ([]byte, []int)deprecated
- func (x *StateResponse) GetId() string
- func (x *StateResponse) GetOutputs() []*Output
- func (x *StateResponse) GetVolt() float32
- func (*StateResponse) ProtoMessage()
- func (x *StateResponse) ProtoReflect() protoreflect.Message
- func (x *StateResponse) Reset()
- func (x *StateResponse) String() string
- type UnimplementedDecodeServer
Constants ¶
This section is empty.
Variables ¶
var File_proto_cq_decode_cq_decode_proto protoreflect.FileDescriptor
Functions ¶
func RegisterDecodeHandler ¶
RegisterDecodeHandler registers the http handlers for service Decode to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterDecodeHandlerClient ¶
func RegisterDecodeHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DecodeClient) error
RegisterDecodeHandlerClient registers the http handlers for service Decode to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "DecodeClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "DecodeClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "DecodeClient" to call the correct interceptors.
func RegisterDecodeHandlerFromEndpoint ¶
func RegisterDecodeHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterDecodeHandlerFromEndpoint is same as RegisterDecodeHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterDecodeHandlerServer ¶
func RegisterDecodeHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DecodeServer) error
RegisterDecodeHandlerServer registers the http handlers for service Decode to "mux". UnaryRPC :call DecodeServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterDecodeHandlerFromEndpoint instead.
func RegisterDecodeServer ¶
func RegisterDecodeServer(s *grpc.Server, srv DecodeServer)
Types ¶
type DecodeClient ¶
type DecodeClient interface { //设置解码器输出 SetOut(ctx context.Context, in *SetOutRequest, opts ...grpc.CallOption) (*SetOutResponse, error) //解码器状态获取 GetState(ctx context.Context, in *StateRequest, opts ...grpc.CallOption) (Decode_GetStateClient, error) }
DecodeClient is the client API for Decode service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewDecodeClient ¶
func NewDecodeClient(cc grpc.ClientConnInterface) DecodeClient
type DecodeServer ¶
type DecodeServer interface { //设置解码器输出 SetOut(context.Context, *SetOutRequest) (*SetOutResponse, error) //解码器状态获取 GetState(*StateRequest, Decode_GetStateServer) error }
DecodeServer is the server API for Decode service.
type Decode_GetStateClient ¶
type Decode_GetStateClient interface { Recv() (*StateResponse, error) grpc.ClientStream }
type Decode_GetStateServer ¶
type Decode_GetStateServer interface { Send(*StateResponse) error grpc.ServerStream }
type Output ¶
type Output struct { Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Value uint32 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` // contains filtered or unexported fields }
func (*Output) Descriptor
deprecated
func (*Output) ProtoMessage ¶
func (*Output) ProtoMessage()
func (*Output) ProtoReflect ¶
func (x *Output) ProtoReflect() protoreflect.Message
type SetOutRequest ¶
type SetOutRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` //4个字节高两位是通讯口端口号,低2位为485站号 Outputs []*Output `protobuf:"bytes,2,rep,name=outputs,proto3" json:"outputs,omitempty"` // contains filtered or unexported fields }
设置电磁阀输出请求
func (*SetOutRequest) Descriptor
deprecated
func (*SetOutRequest) Descriptor() ([]byte, []int)
Deprecated: Use SetOutRequest.ProtoReflect.Descriptor instead.
func (*SetOutRequest) GetId ¶
func (x *SetOutRequest) GetId() string
func (*SetOutRequest) GetOutputs ¶
func (x *SetOutRequest) GetOutputs() []*Output
func (*SetOutRequest) ProtoMessage ¶
func (*SetOutRequest) ProtoMessage()
func (*SetOutRequest) ProtoReflect ¶
func (x *SetOutRequest) ProtoReflect() protoreflect.Message
func (*SetOutRequest) Reset ¶
func (x *SetOutRequest) Reset()
func (*SetOutRequest) String ¶
func (x *SetOutRequest) String() string
type SetOutResponse ¶
type SetOutResponse struct {
// contains filtered or unexported fields
}
设置电磁阀输出响应
func (*SetOutResponse) Descriptor
deprecated
func (*SetOutResponse) Descriptor() ([]byte, []int)
Deprecated: Use SetOutResponse.ProtoReflect.Descriptor instead.
func (*SetOutResponse) ProtoMessage ¶
func (*SetOutResponse) ProtoMessage()
func (*SetOutResponse) ProtoReflect ¶
func (x *SetOutResponse) ProtoReflect() protoreflect.Message
func (*SetOutResponse) Reset ¶
func (x *SetOutResponse) Reset()
func (*SetOutResponse) String ¶
func (x *SetOutResponse) String() string
type StateRequest ¶
type StateRequest struct {
// contains filtered or unexported fields
}
电磁阀状态获取请求
func (*StateRequest) Descriptor
deprecated
func (*StateRequest) Descriptor() ([]byte, []int)
Deprecated: Use StateRequest.ProtoReflect.Descriptor instead.
func (*StateRequest) ProtoMessage ¶
func (*StateRequest) ProtoMessage()
func (*StateRequest) ProtoReflect ¶
func (x *StateRequest) ProtoReflect() protoreflect.Message
func (*StateRequest) Reset ¶
func (x *StateRequest) Reset()
func (*StateRequest) String ¶
func (x *StateRequest) String() string
type StateResponse ¶
type StateResponse struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` //4个字节高两位是通讯口端口号,低2位为485站号 Outputs []*Output `protobuf:"bytes,2,rep,name=outputs,proto3" json:"outputs,omitempty"` Volt float32 `protobuf:"fixed32,3,opt,name=volt,proto3" json:"volt,omitempty"` //电压值 // contains filtered or unexported fields }
电磁阀状态获取返回
func (*StateResponse) Descriptor
deprecated
func (*StateResponse) Descriptor() ([]byte, []int)
Deprecated: Use StateResponse.ProtoReflect.Descriptor instead.
func (*StateResponse) GetId ¶
func (x *StateResponse) GetId() string
func (*StateResponse) GetOutputs ¶
func (x *StateResponse) GetOutputs() []*Output
func (*StateResponse) GetVolt ¶
func (x *StateResponse) GetVolt() float32
func (*StateResponse) ProtoMessage ¶
func (*StateResponse) ProtoMessage()
func (*StateResponse) ProtoReflect ¶
func (x *StateResponse) ProtoReflect() protoreflect.Message
func (*StateResponse) Reset ¶
func (x *StateResponse) Reset()
func (*StateResponse) String ¶
func (x *StateResponse) String() string
type UnimplementedDecodeServer ¶
type UnimplementedDecodeServer struct { }
UnimplementedDecodeServer can be embedded to have forward compatible implementations.
func (*UnimplementedDecodeServer) GetState ¶
func (*UnimplementedDecodeServer) GetState(*StateRequest, Decode_GetStateServer) error
func (*UnimplementedDecodeServer) SetOut ¶
func (*UnimplementedDecodeServer) SetOut(context.Context, *SetOutRequest) (*SetOutResponse, error)