| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -18,6 +18,11 @@ import (
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					"go.arsenm.dev/infinitime/blefs"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				// This global is used to store the logger.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				// log.Logger is not used as it would interfere
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				// with the package importing the library
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				var log zerolog.Logger
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				const BTName = "InfiniTime"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				const (
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -90,6 +95,8 @@ func Connect(opts *Options) (*Device, error) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						opts = DefaultOptions
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					log = opts.Logger.Level(opts.LogLevel)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					// Set passkey request callback
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					setOnPasskeyReq(opts.OnReqPasskey)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -129,16 +136,25 @@ func connect(opts *Options, first bool) (dev *device.Device1, err error) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						// device, skip
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if opts.WhitelistEnabled &&
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							!contains(opts.Whitelist, listDev.Properties.Address) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							log.Debug().
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								Str("mac", listDev.Properties.Address).
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								Msg("InfiniTime device skipped as it is not in whitelist")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							continue
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						// Set device
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						dev = listDev
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						log.Debug().
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							Str("mac", dev.Properties.Address).
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							Msg("InfiniTime device found in list")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						break
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					// If device not set
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if dev == nil {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						log.Debug().Msg("No device found in list, attempting to discover")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						// Discover devices on adapter
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						discoverCh, cancel, err := bt.Discover(defaultAdapter, &adapter.DiscoveryFilter{Transport: "le"})
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if err != nil {
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -166,11 +182,18 @@ func connect(opts *Options, first bool) (dev *device.Device1, err error) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							// device, skip
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							if opts.WhitelistEnabled &&
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								!contains(opts.Whitelist, discovered.Properties.Address) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								log.Debug().
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									Str("mac", discovered.Properties.Address).
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									Msg("Discovered InfiniTime device skipped as it is not in whitelist")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								continue
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							// Set device
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							dev = discovered
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							log.Debug().
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								Str("mac", dev.Properties.Address).
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								Msg("InfiniTime device discovered")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							break
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						// Stop discovery
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -187,6 +210,7 @@ func connect(opts *Options, first bool) (dev *device.Device1, err error) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					reconnRequired := false
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					// If device is not connected
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !dev.Properties.Connected {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						log.Debug().Msg("Device not connected, connecting")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						// Connect to device
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						err = dev.Connect()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if err != nil {
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -198,6 +222,7 @@ func connect(opts *Options, first bool) (dev *device.Device1, err error) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					// If device is not paired
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !dev.Properties.Paired {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						log.Debug().Msg("Device not paired, pairing")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						// Pair device
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						err = dev.Pair()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if err != nil {
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -215,6 +240,7 @@ func connect(opts *Options, first bool) (dev *device.Device1, err error) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					// was required, and the OnReconnect callback exists,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					// run it
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !first && reconnRequired && opts.OnReconnect != nil {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						log.Debug().Msg("Reconnected to device, running OnReconnect callback")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						opts.OnReconnect()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -336,6 +362,7 @@ func (i *Device) resolveChars() error {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					// For every discovered characteristics
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					for _, char := range chars {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						charResolved := true
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						// Set correct characteristics
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						switch char.Properties.UUID {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						case NewAlertChar:
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -374,6 +401,13 @@ func (i *Device) resolveChars() error {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							i.fsVersionChar = char
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						case WeatherDataChar:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							i.weatherDataChar = char
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						default:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							charResolved = false
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if charResolved {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							log.Debug().
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								Str("uuid", char.Properties.UUID).
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								Msg("Resolved characteristic")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					return nil
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -476,6 +510,7 @@ func (i *Device) WatchHeartRate() (<-chan uint8, func(), error) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						for {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							select {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							case <-done:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								log.Debug().Str("func", "WatchMotion").Msg("Received done signal")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								close(out)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								close(done)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								i.heartRateChar.StopNotify()
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -486,6 +521,7 @@ func (i *Device) WatchHeartRate() (<-chan uint8, func(), error) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									// Send heart rate to channel
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									out <- uint8(event.Value.([]byte)[1])
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								} else if event.Name == "Notifying" && !event.Value.(bool) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									log.Debug().Str("func", "WatchMotion").Msg("Notifications stopped, restarting")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									i.heartRateChar.StartNotify()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -520,6 +556,7 @@ func (i *Device) WatchBatteryLevel() (<-chan uint8, func(), error) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						for {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							select {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							case <-done:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								log.Debug().Str("func", "WatchMotion").Msg("Received done signal")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								close(out)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								close(done)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								i.battLevelChar.StopNotify()
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -530,6 +567,7 @@ func (i *Device) WatchBatteryLevel() (<-chan uint8, func(), error) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									// Send heart rate to channel
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									out <- uint8(event.Value.([]byte)[0])
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								} else if event.Name == "Notifying" && !event.Value.(bool) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									log.Debug().Str("func", "WatchMotion").Msg("Notifications stopped, restarting")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									i.battLevelChar.StartNotify()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -564,6 +602,7 @@ func (i *Device) WatchStepCount() (<-chan uint32, func(), error) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						for {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							select {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							case <-done:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								log.Debug().Str("func", "WatchMotion").Msg("Received done signal")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								close(out)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								close(done)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								i.stepCountChar.StopNotify()
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -574,6 +613,7 @@ func (i *Device) WatchStepCount() (<-chan uint32, func(), error) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									// Send step count to channel
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									out <- binary.LittleEndian.Uint32(event.Value.([]byte))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								} else if event.Name == "Notifying" && !event.Value.(bool) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									log.Debug().Str("func", "WatchMotion").Msg("Notifications stopped, restarting")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									i.stepCountChar.StartNotify()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -608,6 +648,7 @@ func (i *Device) WatchMotion() (<-chan MotionValues, func(), error) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						for {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							select {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							case <-done:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								log.Debug().Str("func", "WatchMotion").Msg("Received done signal")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								close(out)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								close(done)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								i.motionValChar.StopNotify()
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -620,6 +661,7 @@ func (i *Device) WatchMotion() (<-chan MotionValues, func(), error) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									// Send step count to channel
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									out <- motionVals
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								} else if event.Name == "Notifying" && !event.Value.(bool) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									log.Debug().Str("func", "WatchMotion").Msg("Notifications stopped, restarting")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									i.motionValChar.StartNotify()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -756,11 +798,13 @@ func (i *Device) AddWeatherEvent(event interface{}) error {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return err
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					log.Debug().Interface("event", event).Msg("Adding weather event")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					// Write data to weather data characteristic
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					return i.weatherDataChar.WriteValue(data, nil)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (i *Device) checkStatus(char *gatt.GattCharacteristic1) error {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					log.Debug().Msg("Checking characteristic status")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					connected, err := i.device.GetConnected()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if err != nil {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return err
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -769,7 +813,9 @@ func (i *Device) checkStatus(char *gatt.GattCharacteristic1) error {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return ErrNotConnected
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if char == nil {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						log.Debug().Msg("Characteristic not available (nil)")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return ErrCharNotAvail
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					log.Debug().Str("uuid", char.Properties.UUID).Msg("Characteristic available")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					return nil
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
	
		
			
				
					
					| 
						 
							
							
							
						 
					 | 
				
			
			 | 
			 | 
			
				 
 |