Documentation ¶
Index ¶
Constants ¶
View Source
const ( HeartRateServiceUUID = "0000180d-0000-1000-8000-00805f9b34fb" HeartRateCharacteristicUUID = "00002a37-0000-1000-8000-00805f9b34fb" )
UUIDs for Heart Rate service and characteristic.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { TargetDeviceMAC string TargetDeviceName string ScanTimeout int ReconnectAttempts int // Add this line }
Config holds the configuration for the heart rate monitor
type ConnectionState ¶
type ConnectionState int
ConnectionState represents the connection state of the heart rate monitor.
const ( Disconnected ConnectionState = iota Connecting Connected Subscribing Subscribed Disconnecting )
type HeartRateMonitor ¶
type HeartRateMonitor struct {
// contains filtered or unexported fields
}
HeartRateMonitor represents a heart rate monitor instance.
func NewHeartRateMonitor ¶
func NewHeartRateMonitor(config Config) *HeartRateMonitor
NewHeartRateMonitor creates a new HeartRateMonitor instance.
func (*HeartRateMonitor) Start ¶
func (hrm *HeartRateMonitor) Start()
Start starts monitoring heart rate.
func (*HeartRateMonitor) Stop ¶
func (hrm *HeartRateMonitor) Stop()
Stop stops monitoring heart rate.
func (*HeartRateMonitor) Subscribe ¶
func (hrm *HeartRateMonitor) Subscribe() <-chan HeartRatePayload
Subscribe returns a channel to receive heart rate data.
type HeartRatePayload ¶
type HeartRatePayload struct { HeartRate int `json:"heart_rate"` // Heart rate value Timestamp time.Time `json:"timestamp"` // Timestamp when the data was received }
HeartRatePayload represents the heart rate data along with the timestamp.
Click to show internal directories.
Click to hide internal directories.