Generate frameId from timestamp and add creation date field

This commit is contained in:
Cyrille Nofficial 2020-01-03 17:41:42 +01:00
parent 4090078bec
commit e6119c0616
10 changed files with 571 additions and 59 deletions

View File

@ -1,9 +1,11 @@
package camera
import (
"fmt"
"github.com/cyrilix/robocar-protobuf/go/events"
mqtt "github.com/eclipse/paho.mqtt.golang"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes/timestamp"
log "github.com/sirupsen/logrus"
"gocv.io/x/gocv"
"io"
@ -57,8 +59,8 @@ func (o *OpencvCameraPart) Start() error {
for {
select {
case <-ticker.C:
o.publishFrame()
case tickerTime := <-ticker.C:
o.publishFrame(tickerTime)
case <-o.cancel:
return nil
}
@ -77,11 +79,12 @@ func (o *OpencvCameraPart) Stop() {
}
}
func (o *OpencvCameraPart) publishFrame() {
func (o *OpencvCameraPart) publishFrame(tickerTime time.Time) {
o.muImgBuffered.Lock()
defer o.muImgBuffered.Unlock()
o.vc.Read(o.imgBuffered)
img, err := gocv.IMEncode(gocv.JPEGFileExt, *o.imgBuffered)
if err != nil {
log.Printf("unable to convert image to jpeg: %v", err)
@ -91,7 +94,11 @@ func (o *OpencvCameraPart) publishFrame() {
msg := &events.FrameMessage{
Id: &events.FrameRef{
Name: "camera",
Id: "XX",
Id: fmt.Sprintf("%d%000d", tickerTime.Unix(), tickerTime.Nanosecond() / 1000 / 1000),
CreatedAt: &timestamp.Timestamp{
Seconds: tickerTime.Unix(),
Nanos: int32(tickerTime.Nanosecond()),
},
},
Frame: img,
}
@ -105,5 +112,9 @@ func (o *OpencvCameraPart) publishFrame() {
}
var publish = func(client mqtt.Client, topic string, payload *[]byte) {
client.Publish(topic, 0, false, *payload)
token := client.Publish(topic, 0, false, *payload)
token.WaitTimeout(10 * time.Millisecond)
if err := token.Error(); err != nil {
log.Errorf("unable to publish frame: %v", err)
}
}

View File

@ -69,8 +69,12 @@ func TestOpencvCameraPart(t *testing.T) {
if frameMsg.GetId().GetName() != "camera" {
t.Errorf("bad name frame: %v, wants %v", frameMsg.GetId().GetName(), "camera")
}
if frameMsg.GetId().GetId() != "XX" {
t.Errorf("bad name frame: %v, wants %v", frameMsg.GetId().GetId(), "XX")
if len(frameMsg.GetId().GetId()) != 13 {
t.Errorf("bad id length: %v, wants %v", len(frameMsg.GetId().GetId()), 13)
}
if frameMsg.GetId().GetCreatedAt() == nil {
t.Errorf("missin CreatedAt field")
}
_, err = jpeg.Decode(bytes.NewReader(frameMsg.GetFrame()))

4
go.mod
View File

@ -3,8 +3,8 @@ module github.com/cyrilix/robocar-camera
go 1.13
require (
github.com/cyrilix/robocar-base v0.0.0-20191218200846-a0dedb056b1a
github.com/cyrilix/robocar-protobuf/go v0.0.0-20191231152709-7f1ff9d86307
github.com/cyrilix/robocar-base v0.0.0-20200103000136-b08c9be9a69a
github.com/cyrilix/robocar-protobuf/go v0.0.0-20200103154825-ada39b1ded08
github.com/eclipse/paho.mqtt.golang v1.2.0
github.com/golang/protobuf v1.3.2
github.com/sirupsen/logrus v1.2.0

8
go.sum
View File

@ -10,10 +10,10 @@ github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QH
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc h1:TP+534wVlf61smEIq1nwLLAjQVEK2EADoW3CX9AuT+8=
github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y=
github.com/cyrilix/robocar-base v0.0.0-20191218200846-a0dedb056b1a h1:SGF8hqFYFNqebPn+F7xFx8riwGgVEGOADhmlEAhoNEQ=
github.com/cyrilix/robocar-base v0.0.0-20191218200846-a0dedb056b1a/go.mod h1:/KZidG8Y4sKxCCkTcswpKz20oFN3j62tJvamEHcSgLM=
github.com/cyrilix/robocar-protobuf/go v0.0.0-20191231152709-7f1ff9d86307 h1:MEKPyLLyR3sq8dXf3oQROiDW01iw/DkCpo72RLEF9Ck=
github.com/cyrilix/robocar-protobuf/go v0.0.0-20191231152709-7f1ff9d86307/go.mod h1:I+i6Ujns+4DmRmmUej56MItlmT4K2zlMZ35vZrHEfQ4=
github.com/cyrilix/robocar-base v0.0.0-20200103000136-b08c9be9a69a h1:Gznzd8APE9C+rkN3ePlKajYhgmNaCO7aJQ2WeNvoSt8=
github.com/cyrilix/robocar-base v0.0.0-20200103000136-b08c9be9a69a/go.mod h1:jRQ+lJAHKkdcjwS5vt2t5LX2zM+bxX+gKffixkc2lbA=
github.com/cyrilix/robocar-protobuf/go v0.0.0-20200103154825-ada39b1ded08 h1:jOTAAOIcaA5ub5iPr/7LubPHYQjVcr7lrrx5ANaK7hE=
github.com/cyrilix/robocar-protobuf/go v0.0.0-20200103154825-ada39b1ded08/go.mod h1:I+i6Ujns+4DmRmmUej56MItlmT4K2zlMZ35vZrHEfQ4=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible h1:dvc1KSkIYTVjZgHf/CTC2diTYC8PzhaA5sFISRfNVrE=

View File

@ -3,6 +3,7 @@ package cli
import (
"flag"
"fmt"
"github.com/cyrilix/robocar-base/service"
MQTT "github.com/eclipse/paho.mqtt.golang"
"log"
"os"
@ -33,13 +34,23 @@ func SetIntDefaultValueFromEnv(value *int, key string, defaultValue int) error {
}
return nil
}
type Part interface {
Start() error
Stop()
func SetFloat64DefaultValueFromEnv(value *float64, key string, defaultValue float64) error {
var sVal string
if os.Getenv(key) != "" {
sVal = os.Getenv(key)
val, err := strconv.ParseFloat(sVal, 64)
if err != nil {
log.Printf("unable to convert string to float: %v", err)
return err
}
*value = val
} else {
*value = defaultValue
}
return nil
}
func HandleExit(p Part) {
func HandleExit(p service.Part) {
signals := make(chan os.Signal, 1)
signal.Notify(signals, os.Kill, os.Interrupt, syscall.SIGTERM)
@ -71,6 +82,15 @@ func InitIntFlag(key string, defValue int) int {
return value
}
func InitFloat64Flag(key string, defValue float64) float64 {
var value float64
err := SetFloat64DefaultValueFromEnv(&value, key, defValue)
if err != nil {
log.Panicf("invalid value: %v", err)
}
return value
}
func Connect(uri, username, password, clientId string) (MQTT.Client, error) {
//create a ClientOptions struct setting the broker address, clientid, turn
//off trace output and set the default message handler

33
vendor/github.com/cyrilix/robocar-base/service/part.go generated vendored Normal file
View File

@ -0,0 +1,33 @@
package service
import (
"fmt"
mqtt "github.com/eclipse/paho.mqtt.golang"
"log"
)
func StopService(name string, client mqtt.Client, topics ...string) {
log.Printf("Stop %s service", name)
token := client.Unsubscribe(topics...)
token.Wait()
if token.Error() != nil {
log.Printf("unable to unsubscribe service: %v", token.Error())
}
client.Disconnect(50)
}
func RegisterCallback(client mqtt.Client, topic string, callback mqtt.MessageHandler) error {
log.Printf("Register callback on topic %v", topic)
token := client.Subscribe(topic, 0, callback)
token.Wait()
if token.Error() != nil {
return fmt.Errorf("unable to register callback on topic %s: %v", topic, token.Error())
}
return nil
}
type Part interface {
Start() error
Stop()
}

View File

@ -6,6 +6,7 @@ package events
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
timestamp "github.com/golang/protobuf/ptypes/timestamp"
math "math"
)
@ -20,6 +21,34 @@ var _ = math.Inf
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type DriveMode int32
const (
DriveMode_INVALID DriveMode = 0
DriveMode_USER DriveMode = 1
DriveMode_PILOT DriveMode = 2
)
var DriveMode_name = map[int32]string{
0: "INVALID",
1: "USER",
2: "PILOT",
}
var DriveMode_value = map[string]int32{
"INVALID": 0,
"USER": 1,
"PILOT": 2,
}
func (x DriveMode) String() string {
return proto.EnumName(DriveMode_name, int32(x))
}
func (DriveMode) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_8ec31f2d2a3db598, []int{0}
}
type TypeObject int32
const (
@ -48,15 +77,16 @@ func (x TypeObject) String() string {
}
func (TypeObject) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_8ec31f2d2a3db598, []int{0}
return fileDescriptor_8ec31f2d2a3db598, []int{1}
}
type FrameRef 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"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
CreatedAt *timestamp.Timestamp `protobuf:"bytes,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *FrameRef) Reset() { *m = FrameRef{} }
@ -98,6 +128,13 @@ func (m *FrameRef) GetId() string {
return ""
}
func (m *FrameRef) GetCreatedAt() *timestamp.Timestamp {
if m != nil {
return m.CreatedAt
}
return nil
}
type FrameMessage struct {
Id *FrameRef `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Frame []byte `protobuf:"bytes,2,opt,name=frame,proto3" json:"frame,omitempty"`
@ -255,6 +292,45 @@ func (m *ThrottleMessage) GetFrameRef() *FrameRef {
return nil
}
type DriveModeMessage struct {
DriveMode DriveMode `protobuf:"varint,1,opt,name=drive_mode,json=driveMode,proto3,enum=robocar.events.DriveMode" json:"drive_mode,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DriveModeMessage) Reset() { *m = DriveModeMessage{} }
func (m *DriveModeMessage) String() string { return proto.CompactTextString(m) }
func (*DriveModeMessage) ProtoMessage() {}
func (*DriveModeMessage) Descriptor() ([]byte, []int) {
return fileDescriptor_8ec31f2d2a3db598, []int{4}
}
func (m *DriveModeMessage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DriveModeMessage.Unmarshal(m, b)
}
func (m *DriveModeMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DriveModeMessage.Marshal(b, m, deterministic)
}
func (m *DriveModeMessage) XXX_Merge(src proto.Message) {
xxx_messageInfo_DriveModeMessage.Merge(m, src)
}
func (m *DriveModeMessage) XXX_Size() int {
return xxx_messageInfo_DriveModeMessage.Size(m)
}
func (m *DriveModeMessage) XXX_DiscardUnknown() {
xxx_messageInfo_DriveModeMessage.DiscardUnknown(m)
}
var xxx_messageInfo_DriveModeMessage proto.InternalMessageInfo
func (m *DriveModeMessage) GetDriveMode() DriveMode {
if m != nil {
return m.DriveMode
}
return DriveMode_INVALID
}
type ObjectsMessage struct {
Objects []*Object `protobuf:"bytes,1,rep,name=objects,proto3" json:"objects,omitempty"`
FrameRef *FrameRef `protobuf:"bytes,2,opt,name=frame_ref,json=frameRef,proto3" json:"frame_ref,omitempty"`
@ -267,7 +343,7 @@ func (m *ObjectsMessage) Reset() { *m = ObjectsMessage{} }
func (m *ObjectsMessage) String() string { return proto.CompactTextString(m) }
func (*ObjectsMessage) ProtoMessage() {}
func (*ObjectsMessage) Descriptor() ([]byte, []int) {
return fileDescriptor_8ec31f2d2a3db598, []int{4}
return fileDescriptor_8ec31f2d2a3db598, []int{5}
}
func (m *ObjectsMessage) XXX_Unmarshal(b []byte) error {
@ -302,10 +378,11 @@ func (m *ObjectsMessage) GetFrameRef() *FrameRef {
return nil
}
// BoundingBox that contains an object
type Object struct {
Type TypeObject `protobuf:"varint,1,opt,name=type,proto3,enum=robocar.events.TypeObject" json:"type,omitempty"`
LLeft int32 `protobuf:"varint,2,opt,name=lLeft,proto3" json:"lLeft,omitempty"`
Up int32 `protobuf:"varint,3,opt,name=up,proto3" json:"up,omitempty"`
Left int32 `protobuf:"varint,2,opt,name=left,proto3" json:"left,omitempty"`
Top int32 `protobuf:"varint,3,opt,name=top,proto3" json:"top,omitempty"`
Right int32 `protobuf:"varint,4,opt,name=right,proto3" json:"right,omitempty"`
Bottom int32 `protobuf:"varint,5,opt,name=bottom,proto3" json:"bottom,omitempty"`
Confidence float32 `protobuf:"fixed32,6,opt,name=confidence,proto3" json:"confidence,omitempty"`
@ -318,7 +395,7 @@ func (m *Object) Reset() { *m = Object{} }
func (m *Object) String() string { return proto.CompactTextString(m) }
func (*Object) ProtoMessage() {}
func (*Object) Descriptor() ([]byte, []int) {
return fileDescriptor_8ec31f2d2a3db598, []int{5}
return fileDescriptor_8ec31f2d2a3db598, []int{6}
}
func (m *Object) XXX_Unmarshal(b []byte) error {
@ -346,16 +423,16 @@ func (m *Object) GetType() TypeObject {
return TypeObject_ANY
}
func (m *Object) GetLLeft() int32 {
func (m *Object) GetLeft() int32 {
if m != nil {
return m.LLeft
return m.Left
}
return 0
}
func (m *Object) GetUp() int32 {
func (m *Object) GetTop() int32 {
if m != nil {
return m.Up
return m.Top
}
return 0
}
@ -381,42 +458,93 @@ func (m *Object) GetConfidence() float32 {
return 0
}
type SwitchRecordMessage struct {
Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *SwitchRecordMessage) Reset() { *m = SwitchRecordMessage{} }
func (m *SwitchRecordMessage) String() string { return proto.CompactTextString(m) }
func (*SwitchRecordMessage) ProtoMessage() {}
func (*SwitchRecordMessage) Descriptor() ([]byte, []int) {
return fileDescriptor_8ec31f2d2a3db598, []int{7}
}
func (m *SwitchRecordMessage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SwitchRecordMessage.Unmarshal(m, b)
}
func (m *SwitchRecordMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_SwitchRecordMessage.Marshal(b, m, deterministic)
}
func (m *SwitchRecordMessage) XXX_Merge(src proto.Message) {
xxx_messageInfo_SwitchRecordMessage.Merge(m, src)
}
func (m *SwitchRecordMessage) XXX_Size() int {
return xxx_messageInfo_SwitchRecordMessage.Size(m)
}
func (m *SwitchRecordMessage) XXX_DiscardUnknown() {
xxx_messageInfo_SwitchRecordMessage.DiscardUnknown(m)
}
var xxx_messageInfo_SwitchRecordMessage proto.InternalMessageInfo
func (m *SwitchRecordMessage) GetEnabled() bool {
if m != nil {
return m.Enabled
}
return false
}
func init() {
proto.RegisterEnum("robocar.events.DriveMode", DriveMode_name, DriveMode_value)
proto.RegisterEnum("robocar.events.TypeObject", TypeObject_name, TypeObject_value)
proto.RegisterType((*FrameRef)(nil), "robocar.events.FrameRef")
proto.RegisterType((*FrameMessage)(nil), "robocar.events.FrameMessage")
proto.RegisterType((*SteeringMessage)(nil), "robocar.events.SteeringMessage")
proto.RegisterType((*ThrottleMessage)(nil), "robocar.events.ThrottleMessage")
proto.RegisterType((*DriveModeMessage)(nil), "robocar.events.DriveModeMessage")
proto.RegisterType((*ObjectsMessage)(nil), "robocar.events.ObjectsMessage")
proto.RegisterType((*Object)(nil), "robocar.events.Object")
proto.RegisterType((*SwitchRecordMessage)(nil), "robocar.events.SwitchRecordMessage")
}
func init() { proto.RegisterFile("events/events.proto", fileDescriptor_8ec31f2d2a3db598) }
var fileDescriptor_8ec31f2d2a3db598 = []byte{
// 383 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x53, 0x4d, 0x6f, 0x9b, 0x40,
0x10, 0x2d, 0xcb, 0x87, 0xf1, 0xd8, 0xa2, 0x68, 0x5b, 0x59, 0xc8, 0x87, 0xca, 0xf2, 0xc9, 0xea,
0x81, 0x56, 0x54, 0xf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 0x54, 0x13, 0xa3,
0xc1, 0x1f, 0x15, 0xe3, 0x0c, 0xde, 0x2a, 0xb9, 0xa7, 0xa9, 0xa8, 0x9a, 0x10, 0x3f, 0xa1, 0xc3,
0x34, 0x13, 0x18, 0x23, 0x73, 0xd2, 0x8b, 0x06, 0x6d, 0x1b, 0xdd, 0x40, 0x1a, 0xd9, 0xf5, 0x68,
0xf4, 0xee, 0xd1, 0x4f, 0x06, 0x38, 0xda, 0x0a, 0x87, 0x60, 0x89, 0x73, 0xa9, 0x97, 0xf6, 0xa2,
0x61, 0xbb, 0x79, 0x73, 0x2e, 0x69, 0x3d, 0x54, 0xe9, 0xe4, 0x97, 0x3d, 0xcc, 0x69, 0x26, 0xd4,
0x34, 0x9b, 0x68, 0x20, 0xff, 0x9c, 0x53, 0xa9, 0x76, 0xb7, 0x09, 0x3a, 0x95, 0x52, 0xc5, 0xf3,
0xdd, 0x5e, 0x04, 0x96, 0x56, 0x29, 0x80, 0x07, 0xe0, 0x24, 0x4c, 0x08, 0x76, 0x0c, 0x6c, 0x45,
0xd7, 0xa8, 0x75, 0xc0, 0x4e, 0xfb, 0x80, 0xbf, 0x47, 0x00, 0xaf, 0x39, 0x70, 0x07, 0xcc, 0xe9,
0xf2, 0xc6, 0xff, 0x24, 0x8b, 0x3f, 0x53, 0xe2, 0x1b, 0xd8, 0x05, 0x6b, 0xf6, 0x7f, 0xb1, 0xf6,
0x91, 0xac, 0xd6, 0xf3, 0xd5, 0xc6, 0x37, 0x67, 0xee, 0xad, 0xa3, 0x57, 0x48, 0x1c, 0x75, 0x19,
0x7e, 0x3d, 0x07, 0x00, 0x00, 0xff, 0xff, 0xb6, 0x83, 0x51, 0xbe, 0x23, 0x03, 0x00, 0x00,
// 522 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x53, 0x5d, 0x8b, 0xd3, 0x40,
0x14, 0xdd, 0xa4, 0x5f, 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0x00, 0xb9, 0x84, 0x76, 0xc0, 0x84, 0x60, 0xa9, 0xdb, 0x92,
0x74, 0x85, 0x6a, 0xd7, 0xd5, 0xae, 0x5f, 0xd7, 0x70, 0x0c, 0x17, 0xeb, 0x9f, 0x89, 0x08, 0xf7,
0x14, 0x43, 0xc6, 0x23, 0xbd, 0x2e, 0x17, 0x3a, 0x98, 0xf9, 0xc1, 0x01, 0xd5, 0x0b, 0xb7, 0xa8,
0x86, 0x57, 0xaf, 0xc1, 0x3e, 0xad, 0x9c, 0x74, 0xa1, 0x33, 0x5b, 0x7e, 0x99, 0xce, 0x67, 0x37,
0xce, 0x19, 0xb1, 0xa0, 0x79, 0xb7, 0xfe, 0x44, 0x1d, 0x83, 0xd8, 0xd0, 0x5a, 0xcd, 0xe6, 0xb7,
0x1b, 0xc7, 0xbc, 0x9a, 0x00, 0xfc, 0x9d, 0x93, 0x74, 0xa0, 0x31, 0x5d, 0x7e, 0x75, 0xce, 0xca,
0xe2, 0xe3, 0xb4, 0x3c, 0x6a, 0x41, 0xf3, 0xfa, 0x6e, 0xb1, 0x72, 0xcc, 0xb2, 0x5a, 0x95, 0x3d,
0x8d, 0x6b, 0xeb, 0x5b, 0x5b, 0xad, 0x28, 0x68, 0xcb, 0x4f, 0xf2, 0xed, 0x9f, 0x00, 0x00, 0x00,
0xff, 0xff, 0xb8, 0x68, 0x5d, 0xd0, 0x2d, 0x04, 0x00, 0x00,
}

View File

@ -0,0 +1,179 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/timestamp.proto
package timestamp
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// 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
// A Timestamp represents a point in time independent of any time zone
// or calendar, represented as seconds and fractions of seconds at
// nanosecond resolution in UTC Epoch time. It is encoded using the
// Proleptic Gregorian Calendar which extends the Gregorian calendar
// backwards to year one. It is encoded assuming all minutes are 60
// seconds long, i.e. leap seconds are "smeared" so that no leap second
// table is needed for interpretation. Range is from
// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
// By restricting to that range, we ensure that we can convert to
// and from RFC 3339 date strings.
// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
//
// # Examples
//
// Example 1: Compute Timestamp from POSIX `time()`.
//
// Timestamp timestamp;
// timestamp.set_seconds(time(NULL));
// timestamp.set_nanos(0);
//
// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
//
// struct timeval tv;
// gettimeofday(&tv, NULL);
//
// Timestamp timestamp;
// timestamp.set_seconds(tv.tv_sec);
// timestamp.set_nanos(tv.tv_usec * 1000);
//
// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
//
// FILETIME ft;
// GetSystemTimeAsFileTime(&ft);
// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
//
// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
// Timestamp timestamp;
// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
//
// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
//
// long millis = System.currentTimeMillis();
//
// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
// .setNanos((int) ((millis % 1000) * 1000000)).build();
//
//
// Example 5: Compute Timestamp from current time in Python.
//
// timestamp = Timestamp()
// timestamp.GetCurrentTime()
//
// # JSON Mapping
//
// In JSON format, the Timestamp type is encoded as a string in the
// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
// where {year} is always expressed using four digits while {month}, {day},
// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
// is required. A proto3 JSON serializer should always use UTC (as indicated by
// "Z") when printing the Timestamp type and a proto3 JSON parser should be
// able to accept both UTC and other timezones (as indicated by an offset).
//
// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
// 01:30 UTC on January 15, 2017.
//
// In JavaScript, one can convert a Date object to this format using the
// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
// method. In Python, a standard `datetime.datetime` object can be converted
// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
// can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
// ) to obtain a formatter capable of generating timestamps in this format.
//
//
type Timestamp struct {
// Represents seconds of UTC time since Unix epoch
// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
// 9999-12-31T23:59:59Z inclusive.
Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"`
// Non-negative fractions of a second at nanosecond resolution. Negative
// second values with fractions must still have non-negative nanos values
// that count forward in time. Must be from 0 to 999,999,999
// inclusive.
Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Timestamp) Reset() { *m = Timestamp{} }
func (m *Timestamp) String() string { return proto.CompactTextString(m) }
func (*Timestamp) ProtoMessage() {}
func (*Timestamp) Descriptor() ([]byte, []int) {
return fileDescriptor_292007bbfe81227e, []int{0}
}
func (*Timestamp) XXX_WellKnownType() string { return "Timestamp" }
func (m *Timestamp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Timestamp.Unmarshal(m, b)
}
func (m *Timestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Timestamp.Marshal(b, m, deterministic)
}
func (m *Timestamp) XXX_Merge(src proto.Message) {
xxx_messageInfo_Timestamp.Merge(m, src)
}
func (m *Timestamp) XXX_Size() int {
return xxx_messageInfo_Timestamp.Size(m)
}
func (m *Timestamp) XXX_DiscardUnknown() {
xxx_messageInfo_Timestamp.DiscardUnknown(m)
}
var xxx_messageInfo_Timestamp proto.InternalMessageInfo
func (m *Timestamp) GetSeconds() int64 {
if m != nil {
return m.Seconds
}
return 0
}
func (m *Timestamp) GetNanos() int32 {
if m != nil {
return m.Nanos
}
return 0
}
func init() {
proto.RegisterType((*Timestamp)(nil), "google.protobuf.Timestamp")
}
func init() { proto.RegisterFile("google/protobuf/timestamp.proto", fileDescriptor_292007bbfe81227e) }
var fileDescriptor_292007bbfe81227e = []byte{
// 191 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xcf, 0xcf, 0x4f,
0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0xc9, 0xcc, 0x4d,
0x2d, 0x2e, 0x49, 0xcc, 0x2d, 0xd0, 0x03, 0x0b, 0x09, 0xf1, 0x43, 0x14, 0xe8, 0xc1, 0x14, 0x28,
0x59, 0x73, 0x71, 0x86, 0xc0, 0xd4, 0x08, 0x49, 0x70, 0xb1, 0x17, 0xa7, 0x26, 0xe7, 0xe7, 0xa5,
0x14, 0x4b, 0x30, 0x2a, 0x30, 0x6a, 0x30, 0x07, 0xc1, 0xb8, 0x42, 0x22, 0x5c, 0xac, 0x79, 0x89,
0x79, 0xf9, 0xc5, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xac, 0x41, 0x10, 0x8e, 0x53, 0x1d, 0x97, 0x70,
0x72, 0x7e, 0xae, 0x1e, 0x9a, 0x99, 0x4e, 0x7c, 0x70, 0x13, 0x03, 0x40, 0x42, 0x01, 0x8c, 0x51,
0xda, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xe9, 0xf9, 0x39, 0x89,
0x79, 0xe9, 0x08, 0x27, 0x16, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x23, 0x5c, 0xfa, 0x83, 0x91, 0x71,
0x11, 0x13, 0xb3, 0x7b, 0x80, 0xd3, 0x2a, 0x26, 0x39, 0x77, 0x88, 0xc9, 0x01, 0x50, 0xb5, 0x7a,
0xe1, 0xa9, 0x39, 0x39, 0xde, 0x79, 0xf9, 0xe5, 0x79, 0x21, 0x20, 0x3d, 0x49, 0x6c, 0x60, 0x43,
0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x77, 0x4a, 0x07, 0xf7, 0x00, 0x00, 0x00,
}

View File

@ -0,0 +1,135 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto3";
package google.protobuf;
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
option cc_enable_arenas = true;
option go_package = "github.com/golang/protobuf/ptypes/timestamp";
option java_package = "com.google.protobuf";
option java_outer_classname = "TimestampProto";
option java_multiple_files = true;
option objc_class_prefix = "GPB";
// A Timestamp represents a point in time independent of any time zone
// or calendar, represented as seconds and fractions of seconds at
// nanosecond resolution in UTC Epoch time. It is encoded using the
// Proleptic Gregorian Calendar which extends the Gregorian calendar
// backwards to year one. It is encoded assuming all minutes are 60
// seconds long, i.e. leap seconds are "smeared" so that no leap second
// table is needed for interpretation. Range is from
// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
// By restricting to that range, we ensure that we can convert to
// and from RFC 3339 date strings.
// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
//
// # Examples
//
// Example 1: Compute Timestamp from POSIX `time()`.
//
// Timestamp timestamp;
// timestamp.set_seconds(time(NULL));
// timestamp.set_nanos(0);
//
// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
//
// struct timeval tv;
// gettimeofday(&tv, NULL);
//
// Timestamp timestamp;
// timestamp.set_seconds(tv.tv_sec);
// timestamp.set_nanos(tv.tv_usec * 1000);
//
// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
//
// FILETIME ft;
// GetSystemTimeAsFileTime(&ft);
// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
//
// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
// Timestamp timestamp;
// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
//
// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
//
// long millis = System.currentTimeMillis();
//
// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
// .setNanos((int) ((millis % 1000) * 1000000)).build();
//
//
// Example 5: Compute Timestamp from current time in Python.
//
// timestamp = Timestamp()
// timestamp.GetCurrentTime()
//
// # JSON Mapping
//
// In JSON format, the Timestamp type is encoded as a string in the
// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
// where {year} is always expressed using four digits while {month}, {day},
// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
// is required. A proto3 JSON serializer should always use UTC (as indicated by
// "Z") when printing the Timestamp type and a proto3 JSON parser should be
// able to accept both UTC and other timezones (as indicated by an offset).
//
// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
// 01:30 UTC on January 15, 2017.
//
// In JavaScript, one can convert a Date object to this format using the
// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
// method. In Python, a standard `datetime.datetime` object can be converted
// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
// can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
// ) to obtain a formatter capable of generating timestamps in this format.
//
//
message Timestamp {
// Represents seconds of UTC time since Unix epoch
// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
// 9999-12-31T23:59:59Z inclusive.
int64 seconds = 1;
// Non-negative fractions of a second at nanosecond resolution. Negative
// second values with fractions must still have non-negative nanos values
// that count forward in time. Must be from 0 to 999,999,999
// inclusive.
int32 nanos = 2;
}

6
vendor/modules.txt vendored
View File

@ -1,12 +1,14 @@
# github.com/cyrilix/robocar-base v0.0.0-20191218200846-a0dedb056b1a
# github.com/cyrilix/robocar-base v0.0.0-20200103000136-b08c9be9a69a
github.com/cyrilix/robocar-base/cli
# github.com/cyrilix/robocar-protobuf/go v0.0.0-20191231152709-7f1ff9d86307
github.com/cyrilix/robocar-base/service
# github.com/cyrilix/robocar-protobuf/go v0.0.0-20200103154825-ada39b1ded08
github.com/cyrilix/robocar-protobuf/go/events
# github.com/eclipse/paho.mqtt.golang v1.2.0
github.com/eclipse/paho.mqtt.golang
github.com/eclipse/paho.mqtt.golang/packets
# github.com/golang/protobuf v1.3.2
github.com/golang/protobuf/proto
github.com/golang/protobuf/ptypes/timestamp
# github.com/konsorten/go-windows-terminal-sequences v1.0.1
github.com/konsorten/go-windows-terminal-sequences
# github.com/sirupsen/logrus v1.2.0