func (c *Characteristic) HandleWrite(h WriteHandler) {
	c.Property |= CharWrite | CharWriteNR
	c.WriteHandler = h
}
HandleWrite makes the characteristic support write and write-no-response requests, and routes write requests to h.
The WriteHandler does not differentiate between write and write-no-response requests; it is handled automatically.
HandleWrite must be called before the containing service is added to a server.
package ble
func NewService(u UUID) *Service {
	return &Service{UUID: u}
}
func NewDescriptor(u UUID) *Descriptor {
	return &Descriptor{UUID: u}
}
func NewCharacteristic(u UUID) *Characteristic {
	return &Characteristic{UUID: u}
}
type Property int
const (
	CharBroadcast   Property = 0x01  
	CharRead        Property = 0x02  
	CharWriteNR     Property = 0x04  
	CharWrite       Property = 0x08  
	CharNotify      Property = 0x10  
	CharIndicate    Property = 0x20  
	CharSignedWrite Property = 0x40  
	CharExtended    Property = 0x80  
)
type Profile struct {
	Services []*Service
}
func (p *Profile) Find(target interface{}) interface{} {
	switch target.(type) {
	case *Service:
	case *Characteristic:
	case *Descriptor:
	default:
		return nil
	}
	for _, s := range p.Services {
		ts, ok := target.(*Service)
		if ok && s.UUID.Equal(ts.UUID) {
			target = s
			return s
		}
		for _, c := range s.Characteristics {
			tc, ok := target.(*Characteristic)
			if ok && c.UUID.Equal(tc.UUID) {
				return c
			}
			for _, d := range c.Descriptors {
				td, ok := target.(*Descriptor)
				if ok && d.UUID.Equal(td.UUID) {
					return d
				}
			}
		}
	}
	return nil
}
type Service struct {
	UUID            UUID
	Characteristics []*Characteristic
	Handle    uint16
	EndHandle uint16
}
func (s *Service) AddCharacteristic(c *Characteristic) *Characteristic {
	for _, x := range s.Characteristics {
		if x.UUID.Equal(c.UUID) {
			panic("service already contains a characteristic with UUID " + c.UUID.String())
		}
	}
	s.Characteristics = append(s.Characteristics, c)
	return c
}
func (s *Service) NewCharacteristic(u UUID) *Characteristic {
	return s.AddCharacteristic(&Characteristic{UUID: u})
}
type Characteristic struct {
	UUID        UUID
	Property    Property
	Secure      Property  
	Descriptors []*Descriptor
	CCCD        *Descriptor
	Value []byte
	ReadHandler     ReadHandler
	WriteHandler    WriteHandler
	NotifyHandler   NotifyHandler
	IndicateHandler NotifyHandler
	Handle      uint16
	ValueHandle uint16
	EndHandle   uint16
}
func (c *Characteristic) AddDescriptor(d *Descriptor) *Descriptor {
	for _, x := range c.Descriptors {
		if x.UUID.Equal(d.UUID) {
			panic("service already contains a characteristic with UUID " + d.UUID.String())
		}
	}
	c.Descriptors = append(c.Descriptors, d)
	return d
}
func (c *Characteristic) NewDescriptor(u UUID) *Descriptor {
	return c.AddDescriptor(&Descriptor{UUID: u})
}
func (c *Characteristic) SetValue(b []byte) {
	if c.ReadHandler != nil {
		panic("charactristic has been configured with a read handler")
	}
	c.Property |= CharRead
	c.Value = make([]byte, len(b))
	copy(c.Value, b)
}
func (c *Characteristic) HandleRead(h ReadHandler) {
	if c.Value != nil {
		panic("charactristic has been configured with a static value")
	}
	c.Property |= CharRead
	c.ReadHandler = h
}