36 lines
455 B
Go
36 lines
455 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"gosvc"
|
|
|
|
"robotfs/engine"
|
|
)
|
|
|
|
type Service struct {
|
|
gosvc.ServiceBase
|
|
|
|
engine *engine.Engine
|
|
}
|
|
|
|
func CreateService() (*Service, error) {
|
|
return &Service{
|
|
engine: engine.NewEngine(),
|
|
}, nil
|
|
}
|
|
|
|
func (s *Service) Start() error {
|
|
if err := s.engine.Start(); err != nil {
|
|
return fmt.Errorf("failed to start engine: %v", err)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (s *Service) Stop() {
|
|
s.engine.Stop()
|
|
}
|
|
|
|
func (s *Service) Tick() {
|
|
}
|