probe/service/SensorService.go

75 lines
1.3 KiB
Go
Raw Normal View History

2018-04-29 09:41:14 +00:00
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"
2018-07-02 08:44:53 +00:00
2018-07-02 12:22:45 +00:00
"encoding/base64"
2018-04-29 09:41:14 +00:00
)
var SensorServiceType = reflect.TypeOf((*SensorService)(nil))
func init() {
cdr.RegisterType(SensorServiceType)
}
type SensorService struct {
cda.TypeAnnotation `annotation:"@overflow:RPCService()"`
ContainerService *ContainerService `annotation:"@Inject()"`
2018-07-02 08:44:53 +00:00
SensorConfigService *SensorConfigService `annotation:"@Inject()"`
2018-04-29 09:41:14 +00:00
}
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 {
2018-07-02 08:44:53 +00:00
// base64 decode
2018-07-02 12:22:45 +00:00
bufByte, err := base64.StdEncoding.DecodeString(sensorConfigBase64)
2018-07-02 08:44:53 +00:00
if nil == bufByte || nil != err {
return err
}
2018-07-02 12:22:45 +00:00
s.SensorConfigService.AddConfig(string(bufByte))
2018-07-02 08:44:53 +00:00
2018-04-29 09:41:14 +00:00
return nil
}
func (s *SensorService) RemoveSensor(sensorConfigID string) error {
return nil
}
func (s *SensorService) UpdateSensor(id int64) error {
return nil
}