device

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package device is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Package device is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_proto_device_device_group_proto protoreflect.FileDescriptor
View Source
var File_proto_device_device_proto protoreflect.FileDescriptor

Functions

func RegisterDeviceGroupHandler

func RegisterDeviceGroupHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterDeviceGroupHandler registers the http handlers for service DeviceGroup to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterDeviceGroupHandlerClient

func RegisterDeviceGroupHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DeviceGroupClient) error

RegisterDeviceGroupHandlerClient registers the http handlers for service DeviceGroup to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "DeviceGroupClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "DeviceGroupClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "DeviceGroupClient" to call the correct interceptors.

func RegisterDeviceGroupHandlerFromEndpoint

func RegisterDeviceGroupHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterDeviceGroupHandlerFromEndpoint is same as RegisterDeviceGroupHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterDeviceGroupHandlerServer

func RegisterDeviceGroupHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DeviceGroupServer) error

RegisterDeviceGroupHandlerServer registers the http handlers for service DeviceGroup to "mux". UnaryRPC :call DeviceGroupServer 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 RegisterDeviceGroupHandlerFromEndpoint instead.

func RegisterDeviceGroupServer

func RegisterDeviceGroupServer(s *grpc.Server, srv DeviceGroupServer)

func RegisterDeviceHandler

func RegisterDeviceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterDeviceHandler registers the http handlers for service Device to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterDeviceHandlerClient

func RegisterDeviceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DeviceClient) error

RegisterDeviceHandlerClient registers the http handlers for service Device to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "DeviceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "DeviceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "DeviceClient" to call the correct interceptors.

func RegisterDeviceHandlerFromEndpoint

func RegisterDeviceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterDeviceHandlerFromEndpoint is same as RegisterDeviceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterDeviceHandlerServer

func RegisterDeviceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DeviceServer) error

RegisterDeviceHandlerServer registers the http handlers for service Device to "mux". UnaryRPC :call DeviceServer 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 RegisterDeviceHandlerFromEndpoint instead.

func RegisterDeviceServer

func RegisterDeviceServer(s *grpc.Server, srv DeviceServer)

Types

type AddDeviceRequest

type AddDeviceRequest struct {
	Name      string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`                             //设备名称
	Id        string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`                                 //设备唯一码
	GroupId   string `protobuf:"bytes,3,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"`        //组号
	ModelId   string `protobuf:"bytes,4,opt,name=model_id,json=modelId,proto3" json:"model_id,omitempty"`        //组号
	Com485    uint32 `protobuf:"varint,5,opt,name=com485,proto3" json:"com485,omitempty"`                        //485端口
	StationId uint32 `protobuf:"varint,6,opt,name=station_id,json=stationId,proto3" json:"station_id,omitempty"` //485站号
	Register  uint32 `protobuf:"varint,7,opt,name=register,proto3" json:"register,omitempty"`                    //寄存器位置
	Detail    string `protobuf:"bytes,8,opt,name=detail,proto3" json:"detail,omitempty"`                         //描述
	// contains filtered or unexported fields
}

func (*AddDeviceRequest) Descriptor deprecated

func (*AddDeviceRequest) Descriptor() ([]byte, []int)

Deprecated: Use AddDeviceRequest.ProtoReflect.Descriptor instead.

func (*AddDeviceRequest) GetCom485

func (x *AddDeviceRequest) GetCom485() uint32

func (*AddDeviceRequest) GetDetail

func (x *AddDeviceRequest) GetDetail() string

func (*AddDeviceRequest) GetGroupId

func (x *AddDeviceRequest) GetGroupId() string

func (*AddDeviceRequest) GetId

func (x *AddDeviceRequest) GetId() string

func (*AddDeviceRequest) GetModelId

func (x *AddDeviceRequest) GetModelId() string

func (*AddDeviceRequest) GetName

func (x *AddDeviceRequest) GetName() string

func (*AddDeviceRequest) GetRegister

func (x *AddDeviceRequest) GetRegister() uint32

func (*AddDeviceRequest) GetStationId

func (x *AddDeviceRequest) GetStationId() uint32

func (*AddDeviceRequest) ProtoMessage

func (*AddDeviceRequest) ProtoMessage()

func (*AddDeviceRequest) ProtoReflect

func (x *AddDeviceRequest) ProtoReflect() protoreflect.Message

func (*AddDeviceRequest) Reset

func (x *AddDeviceRequest) Reset()

func (*AddDeviceRequest) String

func (x *AddDeviceRequest) String() string

type AddDeviceResponse

type AddDeviceResponse struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` //设备名称
	Id   string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`     //设备模型唯一码
	// contains filtered or unexported fields
}

func (*AddDeviceResponse) Descriptor deprecated

func (*AddDeviceResponse) Descriptor() ([]byte, []int)

Deprecated: Use AddDeviceResponse.ProtoReflect.Descriptor instead.

func (*AddDeviceResponse) GetId

func (x *AddDeviceResponse) GetId() string

func (*AddDeviceResponse) GetName

func (x *AddDeviceResponse) GetName() string

func (*AddDeviceResponse) ProtoMessage

func (*AddDeviceResponse) ProtoMessage()

func (*AddDeviceResponse) ProtoReflect

func (x *AddDeviceResponse) ProtoReflect() protoreflect.Message

func (*AddDeviceResponse) Reset

func (x *AddDeviceResponse) Reset()

func (*AddDeviceResponse) String

func (x *AddDeviceResponse) String() string

type AddGroupRequest

type AddGroupRequest struct {
	Name   string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Detail string `protobuf:"bytes,2,opt,name=detail,proto3" json:"detail,omitempty"`
	// contains filtered or unexported fields
}

func (*AddGroupRequest) Descriptor deprecated

func (*AddGroupRequest) Descriptor() ([]byte, []int)

Deprecated: Use AddGroupRequest.ProtoReflect.Descriptor instead.

func (*AddGroupRequest) GetDetail

func (x *AddGroupRequest) GetDetail() string

func (*AddGroupRequest) GetName

func (x *AddGroupRequest) GetName() string

func (*AddGroupRequest) ProtoMessage

func (*AddGroupRequest) ProtoMessage()

func (*AddGroupRequest) ProtoReflect

func (x *AddGroupRequest) ProtoReflect() protoreflect.Message

func (*AddGroupRequest) Reset

func (x *AddGroupRequest) Reset()

func (*AddGroupRequest) String

func (x *AddGroupRequest) String() string

type DeleteDeviceRequest

type DeleteDeviceRequest struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` //设备模型唯一码
	// contains filtered or unexported fields
}

删除硬件模型

func (*DeleteDeviceRequest) Descriptor deprecated

func (*DeleteDeviceRequest) Descriptor() ([]byte, []int)

Deprecated: Use DeleteDeviceRequest.ProtoReflect.Descriptor instead.

func (*DeleteDeviceRequest) GetId

func (x *DeleteDeviceRequest) GetId() string

func (*DeleteDeviceRequest) ProtoMessage

func (*DeleteDeviceRequest) ProtoMessage()

func (*DeleteDeviceRequest) ProtoReflect

func (x *DeleteDeviceRequest) ProtoReflect() protoreflect.Message

func (*DeleteDeviceRequest) Reset

func (x *DeleteDeviceRequest) Reset()

func (*DeleteDeviceRequest) String

func (x *DeleteDeviceRequest) String() string

type DeleteDeviceResponse

type DeleteDeviceResponse struct {
	// contains filtered or unexported fields
}

func (*DeleteDeviceResponse) Descriptor deprecated

func (*DeleteDeviceResponse) Descriptor() ([]byte, []int)

Deprecated: Use DeleteDeviceResponse.ProtoReflect.Descriptor instead.

func (*DeleteDeviceResponse) ProtoMessage

func (*DeleteDeviceResponse) ProtoMessage()

func (*DeleteDeviceResponse) ProtoReflect

func (x *DeleteDeviceResponse) ProtoReflect() protoreflect.Message

func (*DeleteDeviceResponse) Reset

func (x *DeleteDeviceResponse) Reset()

func (*DeleteDeviceResponse) String

func (x *DeleteDeviceResponse) String() string

type DeleteGroupRequest

type DeleteGroupRequest struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteGroupRequest) Descriptor deprecated

func (*DeleteGroupRequest) Descriptor() ([]byte, []int)

Deprecated: Use DeleteGroupRequest.ProtoReflect.Descriptor instead.

func (*DeleteGroupRequest) GetId

func (x *DeleteGroupRequest) GetId() string

func (*DeleteGroupRequest) ProtoMessage

func (*DeleteGroupRequest) ProtoMessage()

func (*DeleteGroupRequest) ProtoReflect

func (x *DeleteGroupRequest) ProtoReflect() protoreflect.Message

func (*DeleteGroupRequest) Reset

func (x *DeleteGroupRequest) Reset()

func (*DeleteGroupRequest) String

func (x *DeleteGroupRequest) String() string

type DeleteGroupResponse

type DeleteGroupResponse struct {
	// contains filtered or unexported fields
}

func (*DeleteGroupResponse) Descriptor deprecated

func (*DeleteGroupResponse) Descriptor() ([]byte, []int)

Deprecated: Use DeleteGroupResponse.ProtoReflect.Descriptor instead.

func (*DeleteGroupResponse) ProtoMessage

func (*DeleteGroupResponse) ProtoMessage()

func (*DeleteGroupResponse) ProtoReflect

func (x *DeleteGroupResponse) ProtoReflect() protoreflect.Message

func (*DeleteGroupResponse) Reset

func (x *DeleteGroupResponse) Reset()

func (*DeleteGroupResponse) String

func (x *DeleteGroupResponse) String() string

type DeviceClient

type DeviceClient interface {
	AddDevice(ctx context.Context, in *AddDeviceRequest, opts ...grpc.CallOption) (*AddDeviceResponse, error)
	DeleteDevice(ctx context.Context, in *DeleteDeviceRequest, opts ...grpc.CallOption) (*DeleteDeviceResponse, error)
	ListDevice(ctx context.Context, in *ListDeviceRequest, opts ...grpc.CallOption) (*ListDeviceResponse, error)
	UpdateDevice(ctx context.Context, in *Device_Struct, opts ...grpc.CallOption) (*Device_Struct, error)
}

DeviceClient is the client API for Device service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewDeviceClient

func NewDeviceClient(cc grpc.ClientConnInterface) DeviceClient

type DeviceGroupClient

type DeviceGroupClient interface {
	AddGroup(ctx context.Context, in *AddGroupRequest, opts ...grpc.CallOption) (*Group, error)
	DeleteGroup(ctx context.Context, in *DeleteGroupRequest, opts ...grpc.CallOption) (*DeleteGroupResponse, error)
	ListGroup(ctx context.Context, in *ListGroupRequest, opts ...grpc.CallOption) (*ListGroupResponse, error)
	UpdateGroup(ctx context.Context, in *Group, opts ...grpc.CallOption) (*Group, error)
}

DeviceGroupClient is the client API for DeviceGroup service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

type DeviceGroupServer

type DeviceGroupServer interface {
	AddGroup(context.Context, *AddGroupRequest) (*Group, error)
	DeleteGroup(context.Context, *DeleteGroupRequest) (*DeleteGroupResponse, error)
	ListGroup(context.Context, *ListGroupRequest) (*ListGroupResponse, error)
	UpdateGroup(context.Context, *Group) (*Group, error)
}

DeviceGroupServer is the server API for DeviceGroup service.

type DeviceServer

DeviceServer is the server API for Device service.

type Device_Struct

type Device_Struct struct {
	Name       string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`                                //设备名称
	Id         string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`                                    //设备唯一码
	GroupName  string `protobuf:"bytes,3,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"`     //模型名称
	GroupId    string `protobuf:"bytes,4,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"`           //组号
	ModelName  string `protobuf:"bytes,5,opt,name=model_name,json=modelName,proto3" json:"model_name,omitempty"`     //模型名称
	ModelId    string `protobuf:"bytes,6,opt,name=model_id,json=modelId,proto3" json:"model_id,omitempty"`           //组号
	Com485     uint32 `protobuf:"varint,7,opt,name=com485,proto3" json:"com485,omitempty"`                           //485端口
	StationId  uint32 `protobuf:"varint,8,opt,name=station_id,json=stationId,proto3" json:"station_id,omitempty"`    //485站号
	Register   uint32 `protobuf:"varint,9,opt,name=register,proto3" json:"register,omitempty"`                       //寄存器位置
	Detail     string `protobuf:"bytes,10,opt,name=detail,proto3" json:"detail,omitempty"`                           //描述
	CreateTime string `protobuf:"bytes,11,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` //创建时间
	// contains filtered or unexported fields
}

func (*Device_Struct) Descriptor deprecated

func (*Device_Struct) Descriptor() ([]byte, []int)

Deprecated: Use Device_Struct.ProtoReflect.Descriptor instead.

func (*Device_Struct) GetCom485

func (x *Device_Struct) GetCom485() uint32

func (*Device_Struct) GetCreateTime

func (x *Device_Struct) GetCreateTime() string

func (*Device_Struct) GetDetail

func (x *Device_Struct) GetDetail() string

func (*Device_Struct) GetGroupId

func (x *Device_Struct) GetGroupId() string

func (*Device_Struct) GetGroupName

func (x *Device_Struct) GetGroupName() string

func (*Device_Struct) GetId

func (x *Device_Struct) GetId() string

func (*Device_Struct) GetModelId

func (x *Device_Struct) GetModelId() string

func (*Device_Struct) GetModelName

func (x *Device_Struct) GetModelName() string

func (*Device_Struct) GetName

func (x *Device_Struct) GetName() string

func (*Device_Struct) GetRegister

func (x *Device_Struct) GetRegister() uint32

func (*Device_Struct) GetStationId

func (x *Device_Struct) GetStationId() uint32

func (*Device_Struct) ProtoMessage

func (*Device_Struct) ProtoMessage()

func (*Device_Struct) ProtoReflect

func (x *Device_Struct) ProtoReflect() protoreflect.Message

func (*Device_Struct) Reset

func (x *Device_Struct) Reset()

func (*Device_Struct) String

func (x *Device_Struct) String() string

type Group

type Group struct {
	Id         string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name       string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Detail     string `protobuf:"bytes,3,opt,name=detail,proto3" json:"detail,omitempty"`
	CreateTime string `protobuf:"bytes,4,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
	// contains filtered or unexported fields
}

func (*Group) Descriptor deprecated

func (*Group) Descriptor() ([]byte, []int)

Deprecated: Use Group.ProtoReflect.Descriptor instead.

func (*Group) GetCreateTime

func (x *Group) GetCreateTime() string

func (*Group) GetDetail

func (x *Group) GetDetail() string

func (*Group) GetId

func (x *Group) GetId() string

func (*Group) GetName

func (x *Group) GetName() string

func (*Group) ProtoMessage

func (*Group) ProtoMessage()

func (*Group) ProtoReflect

func (x *Group) ProtoReflect() protoreflect.Message

func (*Group) Reset

func (x *Group) Reset()

func (*Group) String

func (x *Group) String() string

type ListDeviceRequest

type ListDeviceRequest struct {
	PageNum  uint32 `protobuf:"varint,1,opt,name=page_num,json=pageNum,proto3" json:"page_num,omitempty"`
	PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
	// contains filtered or unexported fields
}

当不传page_num和page_size或等于0相当查询全部

func (*ListDeviceRequest) Descriptor deprecated

func (*ListDeviceRequest) Descriptor() ([]byte, []int)

Deprecated: Use ListDeviceRequest.ProtoReflect.Descriptor instead.

func (*ListDeviceRequest) GetPageNum

func (x *ListDeviceRequest) GetPageNum() uint32

func (*ListDeviceRequest) GetPageSize

func (x *ListDeviceRequest) GetPageSize() uint32

func (*ListDeviceRequest) ProtoMessage

func (*ListDeviceRequest) ProtoMessage()

func (*ListDeviceRequest) ProtoReflect

func (x *ListDeviceRequest) ProtoReflect() protoreflect.Message

func (*ListDeviceRequest) Reset

func (x *ListDeviceRequest) Reset()

func (*ListDeviceRequest) String

func (x *ListDeviceRequest) String() string

type ListDeviceResponse

type ListDeviceResponse struct {
	Total  uint32           `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
	Device []*Device_Struct `protobuf:"bytes,2,rep,name=device,proto3" json:"device,omitempty"`
	// contains filtered or unexported fields
}

func (*ListDeviceResponse) Descriptor deprecated

func (*ListDeviceResponse) Descriptor() ([]byte, []int)

Deprecated: Use ListDeviceResponse.ProtoReflect.Descriptor instead.

func (*ListDeviceResponse) GetDevice

func (x *ListDeviceResponse) GetDevice() []*Device_Struct

func (*ListDeviceResponse) GetTotal

func (x *ListDeviceResponse) GetTotal() uint32

func (*ListDeviceResponse) ProtoMessage

func (*ListDeviceResponse) ProtoMessage()

func (*ListDeviceResponse) ProtoReflect

func (x *ListDeviceResponse) ProtoReflect() protoreflect.Message

func (*ListDeviceResponse) Reset

func (x *ListDeviceResponse) Reset()

func (*ListDeviceResponse) String

func (x *ListDeviceResponse) String() string

type ListGroupRequest

type ListGroupRequest struct {
	PageNum  uint32 `protobuf:"varint,1,opt,name=page_num,json=pageNum,proto3" json:"page_num,omitempty"`
	PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
	// contains filtered or unexported fields
}

当不传page_num和page_size或等于0相当查询全部

func (*ListGroupRequest) Descriptor deprecated

func (*ListGroupRequest) Descriptor() ([]byte, []int)

Deprecated: Use ListGroupRequest.ProtoReflect.Descriptor instead.

func (*ListGroupRequest) GetPageNum

func (x *ListGroupRequest) GetPageNum() uint32

func (*ListGroupRequest) GetPageSize

func (x *ListGroupRequest) GetPageSize() uint32

func (*ListGroupRequest) ProtoMessage

func (*ListGroupRequest) ProtoMessage()

func (*ListGroupRequest) ProtoReflect

func (x *ListGroupRequest) ProtoReflect() protoreflect.Message

func (*ListGroupRequest) Reset

func (x *ListGroupRequest) Reset()

func (*ListGroupRequest) String

func (x *ListGroupRequest) String() string

type ListGroupResponse

type ListGroupResponse struct {
	Total uint32   `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
	Group []*Group `protobuf:"bytes,2,rep,name=group,proto3" json:"group,omitempty"`
	// contains filtered or unexported fields
}

func (*ListGroupResponse) Descriptor deprecated

func (*ListGroupResponse) Descriptor() ([]byte, []int)

Deprecated: Use ListGroupResponse.ProtoReflect.Descriptor instead.

func (*ListGroupResponse) GetGroup

func (x *ListGroupResponse) GetGroup() []*Group

func (*ListGroupResponse) GetTotal

func (x *ListGroupResponse) GetTotal() uint32

func (*ListGroupResponse) ProtoMessage

func (*ListGroupResponse) ProtoMessage()

func (*ListGroupResponse) ProtoReflect

func (x *ListGroupResponse) ProtoReflect() protoreflect.Message

func (*ListGroupResponse) Reset

func (x *ListGroupResponse) Reset()

func (*ListGroupResponse) String

func (x *ListGroupResponse) String() string

type UnimplementedDeviceGroupServer

type UnimplementedDeviceGroupServer struct {
}

UnimplementedDeviceGroupServer can be embedded to have forward compatible implementations.

func (*UnimplementedDeviceGroupServer) AddGroup

func (*UnimplementedDeviceGroupServer) DeleteGroup

func (*UnimplementedDeviceGroupServer) ListGroup

func (*UnimplementedDeviceGroupServer) UpdateGroup

type UnimplementedDeviceServer

type UnimplementedDeviceServer struct {
}

UnimplementedDeviceServer can be embedded to have forward compatible implementations.

func (*UnimplementedDeviceServer) AddDevice

func (*UnimplementedDeviceServer) DeleteDevice

func (*UnimplementedDeviceServer) ListDevice

func (*UnimplementedDeviceServer) UpdateDevice

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL