Exemple #1
0
// SetServices ...
func (s *Server) SetServices(svcs []*ble.Service) error {
	s.Lock()
	defer s.Unlock()
	s.svcs = append(defaultServices("Gopher"), svcs...)
	s.db = att.NewDB(s.svcs, uint16(1)) // ble attrs start at 1
	return nil
}
Exemple #2
0
// AddService ...
func (s *Server) AddService(svc *ble.Service) error {
	s.Lock()
	defer s.Unlock()
	s.svcs = append(s.svcs, svc)
	s.db = att.NewDB(s.svcs, uint16(1)) // ble attrs start at 1
	return nil
}
Exemple #3
0
// RemoveAllServices ...
func (s *Server) RemoveAllServices() error {
	s.Lock()
	defer s.Unlock()
	s.svcs = defaultServices("Gopher")
	s.db = att.NewDB(s.svcs, uint16(1)) // ble attrs start at 1
	return nil
}
Exemple #4
0
// NewServer ...
func NewServer() (*Server, error) {
	return &Server{
		svcs: defaultServices("Gopher"),
		db:   att.NewDB(defaultServices("Gopher"), uint16(1)),
	}, nil
}