package service import ( "reflect" cda "git.loafle.net/commons/di-go/annotation" cdr "git.loafle.net/commons/di-go/registry" // For annotation _ "git.loafle.net/overflow/commons-go/core/annotation" "encoding/base64" ) var SensorServiceType = reflect.TypeOf((*SensorService)(nil)) func init() { cdr.RegisterType(SensorServiceType) } type SensorService struct { cda.TypeAnnotation `annotation:"@overflow:RPCService()"` ContainerService *ContainerService `annotation:"@Inject()"` SensorConfigService *SensorConfigService `annotation:"@Inject()"` } func (s *SensorService) InitService() error { return nil } func (s *SensorService) StartService() error { return nil } func (s *SensorService) StopService() { } func (s *SensorService) DestroyService() { } func (s *SensorService) StartSensor(id int64) error { return nil } func (s *SensorService) StopSensor(id int64) error { return nil } func (s *SensorService) AddSensor(sensorConfigBase64 string) error { // base64 decode bufByte, err := base64.StdEncoding.DecodeString(sensorConfigBase64) if nil == bufByte || nil != err { return err } s.SensorConfigService.AddConfig(string(bufByte)) return nil } func (s *SensorService) RemoveSensor(sensorConfigID string) error { return nil } func (s *SensorService) UpdateSensor(id int64) error { return nil }