示例#1
0
文件: server.go 项目: currantlabs/ble
// 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
}
示例#2
0
文件: server.go 项目: currantlabs/ble
// 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
}
示例#3
0
文件: server.go 项目: currantlabs/ble
// 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
}
示例#4
0
文件: server.go 项目: currantlabs/ble
// NewServer ...
func NewServer() (*Server, error) {
	return &Server{
		svcs: defaultServices("Gopher"),
		db:   att.NewDB(defaultServices("Gopher"), uint16(1)),
	}, nil
}