Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterGocanServer(s grpc.ServiceRegistrar, srv GocanServer)
- type AdapterCapabilities
- func (*AdapterCapabilities) Descriptor() ([]byte, []int)deprecated
- func (x *AdapterCapabilities) GetHSCAN() bool
- func (x *AdapterCapabilities) GetKLine() bool
- func (x *AdapterCapabilities) GetSWCAN() bool
- func (*AdapterCapabilities) ProtoMessage()
- func (x *AdapterCapabilities) ProtoReflect() protoreflect.Message
- func (x *AdapterCapabilities) Reset()
- func (x *AdapterCapabilities) String() string
- type AdapterInfo
- func (*AdapterInfo) Descriptor() ([]byte, []int)deprecated
- func (x *AdapterInfo) GetCapabilities() *AdapterCapabilities
- func (x *AdapterInfo) GetDescription() string
- func (x *AdapterInfo) GetName() string
- func (x *AdapterInfo) GetRequireSerialPort() bool
- func (*AdapterInfo) ProtoMessage()
- func (x *AdapterInfo) ProtoReflect() protoreflect.Message
- func (x *AdapterInfo) Reset()
- func (x *AdapterInfo) String() string
- type Adapters
- type CANFrame
- func (*CANFrame) Descriptor() ([]byte, []int)deprecated
- func (x *CANFrame) GetData() []byte
- func (x *CANFrame) GetFrameType() CANFrameTypeEnum
- func (x *CANFrame) GetId() uint32
- func (x *CANFrame) GetResponses() uint32
- func (*CANFrame) ProtoMessage()
- func (x *CANFrame) ProtoReflect() protoreflect.Message
- func (x *CANFrame) Reset()
- func (x *CANFrame) String() string
- type CANFrameTypeEnum
- func (CANFrameTypeEnum) Descriptor() protoreflect.EnumDescriptor
- func (x CANFrameTypeEnum) Enum() *CANFrameTypeEnum
- func (CANFrameTypeEnum) EnumDescriptor() ([]byte, []int)deprecated
- func (x CANFrameTypeEnum) Number() protoreflect.EnumNumber
- func (x CANFrameTypeEnum) String() string
- func (CANFrameTypeEnum) Type() protoreflect.EnumType
- type Command
- type CommandResponse
- type Event
- type EventLevel
- type GocanClient
- type GocanServer
- type Gocan_StreamClient
- type Gocan_StreamServer
- type SerialPort
- type SerialPorts
- type StreamMessage
- func (*StreamMessage) Descriptor() ([]byte, []int)deprecated
- func (x *StreamMessage) GetEvent() *Event
- func (x *StreamMessage) GetFrame() *CANFrame
- func (x *StreamMessage) GetPayload() isStreamMessage_Payload
- func (*StreamMessage) ProtoMessage()
- func (x *StreamMessage) ProtoReflect() protoreflect.Message
- func (x *StreamMessage) Reset()
- func (x *StreamMessage) String() string
- type StreamMessage_Event
- type StreamMessage_Frame
- type UnimplementedGocanServer
- func (UnimplementedGocanServer) GetAdapters(context.Context, *emptypb.Empty) (*Adapters, error)
- func (UnimplementedGocanServer) GetSerialPorts(context.Context, *emptypb.Empty) (*SerialPorts, error)
- func (UnimplementedGocanServer) SendCommand(context.Context, *Command) (*CommandResponse, error)
- func (UnimplementedGocanServer) Stream(grpc.BidiStreamingServer[CANFrame, StreamMessage]) error
- type UnsafeGocanServer
Constants ¶
const ( Gocan_SendCommand_FullMethodName = "/Gocan/SendCommand" Gocan_GetSerialPorts_FullMethodName = "/Gocan/GetSerialPorts" Gocan_GetAdapters_FullMethodName = "/Gocan/GetAdapters" Gocan_Stream_FullMethodName = "/Gocan/Stream" )
Variables ¶
var ( CANFrameTypeEnum_name = map[int32]string{ 0: "Incoming", 1: "Outgoing", 2: "OutgoingResponseRequired", } CANFrameTypeEnum_value = map[string]int32{ "Incoming": 0, "Outgoing": 1, "OutgoingResponseRequired": 2, } )
Enum value maps for CANFrameTypeEnum.
var ( EventLevel_name = map[int32]string{ 0: "EVENT_DEBUG", 1: "EVENT_INFO", 2: "EVENT_WARN", 3: "EVENT_ERROR", 4: "EVENT_FATAL", } EventLevel_value = map[string]int32{ "EVENT_DEBUG": 0, "EVENT_INFO": 1, "EVENT_WARN": 2, "EVENT_ERROR": 3, "EVENT_FATAL": 4, } )
Enum value maps for EventLevel.
var File_proto_server_proto protoreflect.FileDescriptor
var Gocan_ServiceDesc = grpc.ServiceDesc{ ServiceName: "Gocan", HandlerType: (*GocanServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "SendCommand", Handler: _Gocan_SendCommand_Handler, }, { MethodName: "GetSerialPorts", Handler: _Gocan_GetSerialPorts_Handler, }, { MethodName: "GetAdapters", Handler: _Gocan_GetAdapters_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "Stream", Handler: _Gocan_Stream_Handler, ServerStreams: true, ClientStreams: true, }, }, Metadata: "proto/server.proto", }
Gocan_ServiceDesc is the grpc.ServiceDesc for Gocan service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterGocanServer ¶
func RegisterGocanServer(s grpc.ServiceRegistrar, srv GocanServer)
Types ¶
type AdapterCapabilities ¶
type AdapterCapabilities struct {
HSCAN bool `protobuf:"varint,1,opt,name=HSCAN,proto3" json:"HSCAN,omitempty"`
SWCAN bool `protobuf:"varint,2,opt,name=SWCAN,proto3" json:"SWCAN,omitempty"`
KLine bool `protobuf:"varint,3,opt,name=KLine,proto3" json:"KLine,omitempty"`
// contains filtered or unexported fields
}
func (*AdapterCapabilities) Descriptor
deprecated
func (*AdapterCapabilities) Descriptor() ([]byte, []int)
Deprecated: Use AdapterCapabilities.ProtoReflect.Descriptor instead.
func (*AdapterCapabilities) GetHSCAN ¶
func (x *AdapterCapabilities) GetHSCAN() bool
func (*AdapterCapabilities) GetKLine ¶
func (x *AdapterCapabilities) GetKLine() bool
func (*AdapterCapabilities) GetSWCAN ¶
func (x *AdapterCapabilities) GetSWCAN() bool
func (*AdapterCapabilities) ProtoMessage ¶
func (*AdapterCapabilities) ProtoMessage()
func (*AdapterCapabilities) ProtoReflect ¶
func (x *AdapterCapabilities) ProtoReflect() protoreflect.Message
func (*AdapterCapabilities) Reset ¶
func (x *AdapterCapabilities) Reset()
func (*AdapterCapabilities) String ¶
func (x *AdapterCapabilities) String() string
type AdapterInfo ¶
type AdapterInfo struct {
Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"`
Description string `protobuf:"bytes,2,opt,name=Description,proto3" json:"Description,omitempty"`
Capabilities *AdapterCapabilities `protobuf:"bytes,3,opt,name=Capabilities,proto3" json:"Capabilities,omitempty"`
RequireSerialPort bool `protobuf:"varint,4,opt,name=RequireSerialPort,proto3" json:"RequireSerialPort,omitempty"`
// contains filtered or unexported fields
}
func (*AdapterInfo) Descriptor
deprecated
func (*AdapterInfo) Descriptor() ([]byte, []int)
Deprecated: Use AdapterInfo.ProtoReflect.Descriptor instead.
func (*AdapterInfo) GetCapabilities ¶
func (x *AdapterInfo) GetCapabilities() *AdapterCapabilities
func (*AdapterInfo) GetDescription ¶
func (x *AdapterInfo) GetDescription() string
func (*AdapterInfo) GetName ¶
func (x *AdapterInfo) GetName() string
func (*AdapterInfo) GetRequireSerialPort ¶
func (x *AdapterInfo) GetRequireSerialPort() bool
func (*AdapterInfo) ProtoMessage ¶
func (*AdapterInfo) ProtoMessage()
func (*AdapterInfo) ProtoReflect ¶
func (x *AdapterInfo) ProtoReflect() protoreflect.Message
func (*AdapterInfo) Reset ¶
func (x *AdapterInfo) Reset()
func (*AdapterInfo) String ¶
func (x *AdapterInfo) String() string
type Adapters ¶
type Adapters struct {
Adapters []*AdapterInfo `protobuf:"bytes,1,rep,name=adapters,proto3" json:"adapters,omitempty"`
// contains filtered or unexported fields
}
func (*Adapters) Descriptor
deprecated
func (*Adapters) GetAdapters ¶
func (x *Adapters) GetAdapters() []*AdapterInfo
func (*Adapters) ProtoMessage ¶
func (*Adapters) ProtoMessage()
func (*Adapters) ProtoReflect ¶
func (x *Adapters) ProtoReflect() protoreflect.Message
type CANFrame ¶
type CANFrame struct {
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
FrameType CANFrameTypeEnum `protobuf:"varint,3,opt,name=frame_type,json=frameType,proto3,enum=CANFrameTypeEnum" json:"frame_type,omitempty"`
Responses uint32 `protobuf:"varint,4,opt,name=responses,proto3" json:"responses,omitempty"`
// contains filtered or unexported fields
}
CANFrame is the flat representation of a single CAN frame. Frame-type and response-count are inlined (previously a nested CANFrameType message) so the hot streaming path allocates a single message with scalar (value) fields.
func (*CANFrame) Descriptor
deprecated
func (*CANFrame) GetFrameType ¶
func (x *CANFrame) GetFrameType() CANFrameTypeEnum
func (*CANFrame) GetResponses ¶ added in v1.4.1
func (*CANFrame) ProtoMessage ¶
func (*CANFrame) ProtoMessage()
func (*CANFrame) ProtoReflect ¶
func (x *CANFrame) ProtoReflect() protoreflect.Message
type CANFrameTypeEnum ¶
type CANFrameTypeEnum int32
const ( CANFrameTypeEnum_Incoming CANFrameTypeEnum = 0 CANFrameTypeEnum_Outgoing CANFrameTypeEnum = 1 CANFrameTypeEnum_OutgoingResponseRequired CANFrameTypeEnum = 2 )
func (CANFrameTypeEnum) Descriptor ¶
func (CANFrameTypeEnum) Descriptor() protoreflect.EnumDescriptor
func (CANFrameTypeEnum) Enum ¶
func (x CANFrameTypeEnum) Enum() *CANFrameTypeEnum
func (CANFrameTypeEnum) EnumDescriptor
deprecated
func (CANFrameTypeEnum) EnumDescriptor() ([]byte, []int)
Deprecated: Use CANFrameTypeEnum.Descriptor instead.
func (CANFrameTypeEnum) Number ¶
func (x CANFrameTypeEnum) Number() protoreflect.EnumNumber
func (CANFrameTypeEnum) String ¶
func (x CANFrameTypeEnum) String() string
func (CANFrameTypeEnum) Type ¶
func (CANFrameTypeEnum) Type() protoreflect.EnumType
type Command ¶
type Command struct {
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
// contains filtered or unexported fields
}
func (*Command) Descriptor
deprecated
func (*Command) ProtoMessage ¶
func (*Command) ProtoMessage()
func (*Command) ProtoReflect ¶
func (x *Command) ProtoReflect() protoreflect.Message
type CommandResponse ¶
type CommandResponse struct {
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
// contains filtered or unexported fields
}
func (*CommandResponse) Descriptor
deprecated
func (*CommandResponse) Descriptor() ([]byte, []int)
Deprecated: Use CommandResponse.ProtoReflect.Descriptor instead.
func (*CommandResponse) GetData ¶
func (x *CommandResponse) GetData() []byte
func (*CommandResponse) ProtoMessage ¶
func (*CommandResponse) ProtoMessage()
func (*CommandResponse) ProtoReflect ¶
func (x *CommandResponse) ProtoReflect() protoreflect.Message
func (*CommandResponse) Reset ¶
func (x *CommandResponse) Reset()
func (*CommandResponse) String ¶
func (x *CommandResponse) String() string
type Event ¶ added in v1.4.1
type Event struct {
Level EventLevel `protobuf:"varint,1,opt,name=level,proto3,enum=EventLevel" json:"level,omitempty"`
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
// contains filtered or unexported fields
}
func (*Event) Descriptor
deprecated
added in
v1.4.1
func (*Event) GetLevel ¶ added in v1.4.1
func (x *Event) GetLevel() EventLevel
func (*Event) GetMessage ¶ added in v1.4.1
func (*Event) ProtoMessage ¶ added in v1.4.1
func (*Event) ProtoMessage()
func (*Event) ProtoReflect ¶ added in v1.4.1
func (x *Event) ProtoReflect() protoreflect.Message
type EventLevel ¶ added in v1.4.1
type EventLevel int32
EventLevel mirrors gocan.EventType so adapter event severity survives the wire instead of being collapsed to a single "info" system message.
const ( EventLevel_EVENT_DEBUG EventLevel = 0 EventLevel_EVENT_INFO EventLevel = 1 EventLevel_EVENT_WARN EventLevel = 2 EventLevel_EVENT_ERROR EventLevel = 3 EventLevel_EVENT_FATAL EventLevel = 4 )
func (EventLevel) Descriptor ¶ added in v1.4.1
func (EventLevel) Descriptor() protoreflect.EnumDescriptor
func (EventLevel) Enum ¶ added in v1.4.1
func (x EventLevel) Enum() *EventLevel
func (EventLevel) EnumDescriptor
deprecated
added in
v1.4.1
func (EventLevel) EnumDescriptor() ([]byte, []int)
Deprecated: Use EventLevel.Descriptor instead.
func (EventLevel) Number ¶ added in v1.4.1
func (x EventLevel) Number() protoreflect.EnumNumber
func (EventLevel) String ¶ added in v1.4.1
func (x EventLevel) String() string
func (EventLevel) Type ¶ added in v1.4.1
func (EventLevel) Type() protoreflect.EnumType
type GocanClient ¶
type GocanClient interface {
SendCommand(ctx context.Context, in *Command, opts ...grpc.CallOption) (*CommandResponse, error)
GetSerialPorts(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SerialPorts, error)
GetAdapters(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*Adapters, error)
Stream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[CANFrame, StreamMessage], error)
}
GocanClient is the client API for Gocan service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewGocanClient ¶
func NewGocanClient(cc grpc.ClientConnInterface) GocanClient
type GocanServer ¶
type GocanServer interface {
SendCommand(context.Context, *Command) (*CommandResponse, error)
GetSerialPorts(context.Context, *emptypb.Empty) (*SerialPorts, error)
GetAdapters(context.Context, *emptypb.Empty) (*Adapters, error)
Stream(grpc.BidiStreamingServer[CANFrame, StreamMessage]) error
// contains filtered or unexported methods
}
GocanServer is the server API for Gocan service. All implementations must embed UnimplementedGocanServer for forward compatibility.
type Gocan_StreamClient ¶
type Gocan_StreamClient = grpc.BidiStreamingClient[CANFrame, StreamMessage]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Gocan_StreamServer ¶
type Gocan_StreamServer = grpc.BidiStreamingServer[CANFrame, StreamMessage]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type SerialPort ¶
type SerialPort struct {
Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"`
Description string `protobuf:"bytes,2,opt,name=Description,proto3" json:"Description,omitempty"`
// contains filtered or unexported fields
}
func (*SerialPort) Descriptor
deprecated
func (*SerialPort) Descriptor() ([]byte, []int)
Deprecated: Use SerialPort.ProtoReflect.Descriptor instead.
func (*SerialPort) GetDescription ¶
func (x *SerialPort) GetDescription() string
func (*SerialPort) GetName ¶
func (x *SerialPort) GetName() string
func (*SerialPort) ProtoMessage ¶
func (*SerialPort) ProtoMessage()
func (*SerialPort) ProtoReflect ¶
func (x *SerialPort) ProtoReflect() protoreflect.Message
func (*SerialPort) Reset ¶
func (x *SerialPort) Reset()
func (*SerialPort) String ¶
func (x *SerialPort) String() string
type SerialPorts ¶
type SerialPorts struct {
Ports []*SerialPort `protobuf:"bytes,1,rep,name=ports,proto3" json:"ports,omitempty"`
// contains filtered or unexported fields
}
func (*SerialPorts) Descriptor
deprecated
func (*SerialPorts) Descriptor() ([]byte, []int)
Deprecated: Use SerialPorts.ProtoReflect.Descriptor instead.
func (*SerialPorts) GetPorts ¶
func (x *SerialPorts) GetPorts() []*SerialPort
func (*SerialPorts) ProtoMessage ¶
func (*SerialPorts) ProtoMessage()
func (*SerialPorts) ProtoReflect ¶
func (x *SerialPorts) ProtoReflect() protoreflect.Message
func (*SerialPorts) Reset ¶
func (x *SerialPorts) Reset()
func (*SerialPorts) String ¶
func (x *SerialPorts) String() string
type StreamMessage ¶ added in v1.4.1
type StreamMessage struct {
// Types that are valid to be assigned to Payload:
//
// *StreamMessage_Frame
// *StreamMessage_Event
Payload isStreamMessage_Payload `protobuf_oneof:"payload"`
// contains filtered or unexported fields
}
StreamMessage is what the gateway sends to the client: either a CAN frame or a typed event/error. The client→gateway direction stays a plain CANFrame.
func (*StreamMessage) Descriptor
deprecated
added in
v1.4.1
func (*StreamMessage) Descriptor() ([]byte, []int)
Deprecated: Use StreamMessage.ProtoReflect.Descriptor instead.
func (*StreamMessage) GetEvent ¶ added in v1.4.1
func (x *StreamMessage) GetEvent() *Event
func (*StreamMessage) GetFrame ¶ added in v1.4.1
func (x *StreamMessage) GetFrame() *CANFrame
func (*StreamMessage) GetPayload ¶ added in v1.4.1
func (x *StreamMessage) GetPayload() isStreamMessage_Payload
func (*StreamMessage) ProtoMessage ¶ added in v1.4.1
func (*StreamMessage) ProtoMessage()
func (*StreamMessage) ProtoReflect ¶ added in v1.4.1
func (x *StreamMessage) ProtoReflect() protoreflect.Message
func (*StreamMessage) Reset ¶ added in v1.4.1
func (x *StreamMessage) Reset()
func (*StreamMessage) String ¶ added in v1.4.1
func (x *StreamMessage) String() string
type StreamMessage_Event ¶ added in v1.4.1
type StreamMessage_Event struct {
Event *Event `protobuf:"bytes,2,opt,name=event,proto3,oneof"`
}
type StreamMessage_Frame ¶ added in v1.4.1
type StreamMessage_Frame struct {
Frame *CANFrame `protobuf:"bytes,1,opt,name=frame,proto3,oneof"`
}
type UnimplementedGocanServer ¶
type UnimplementedGocanServer struct{}
UnimplementedGocanServer must be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedGocanServer) GetAdapters ¶
func (UnimplementedGocanServer) GetSerialPorts ¶
func (UnimplementedGocanServer) GetSerialPorts(context.Context, *emptypb.Empty) (*SerialPorts, error)
func (UnimplementedGocanServer) SendCommand ¶
func (UnimplementedGocanServer) SendCommand(context.Context, *Command) (*CommandResponse, error)
func (UnimplementedGocanServer) Stream ¶
func (UnimplementedGocanServer) Stream(grpc.BidiStreamingServer[CANFrame, StreamMessage]) error
type UnsafeGocanServer ¶
type UnsafeGocanServer interface {
// contains filtered or unexported methods
}
UnsafeGocanServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to GocanServer will result in compilation errors.