Documentation
¶
Index ¶
- Constants
- func ConnectAddress(ctx context.Context, address string) (ble.Client, error)
- func ConnectName(ctx context.Context, name string) (ble.Client, error)
- func ConnectNameOrAddress(ctx context.Context, nameoraddress string) (ble.Client, error)
- func OpenBLE(timeout time.Duration) (*linux.Device, context.Context)
- type CarelinkMessage
- type CarelinkMessageType
- type ConnectedRileyLink
- func (crl *ConnectedRileyLink) GetBLEVersion() (string, error)
- func (crl *ConnectedRileyLink) GetBatteryLevel() (int, error)
- func (crl *ConnectedRileyLink) GetCustomName() (string, error)
- func (crl *ConnectedRileyLink) GetFrequency() (uint32, error)
- func (crl *ConnectedRileyLink) GetLEDMode() (LEDMode, error)
- func (crl *ConnectedRileyLink) GetPacket(rlpc RileyLinkPacketChannel, timeout time.Duration) (*RLCCResponse, error)
- func (crl *ConnectedRileyLink) GetRadioVersion() (string, error)
- func (crl *ConnectedRileyLink) GetState() (bool, error)
- func (crl *ConnectedRileyLink) GetStatistics() (*RileyLinkStatistics, error)
- func (crl *ConnectedRileyLink) Interrupt() error
- func (crl *ConnectedRileyLink) LED(ledc LEDColor, ledm LEDMode) error
- func (crl *ConnectedRileyLink) NotifySubscribe() error
- func (crl *ConnectedRileyLink) RawReset() error
- func (crl *ConnectedRileyLink) ReadRSSI() int
- func (crl *ConnectedRileyLink) ReadRegister(reg CxRegister) (byte, error)
- func (crl *ConnectedRileyLink) Reset() (bool, error)
- func (crl *ConnectedRileyLink) ResetRadioConfig() error
- func (crl *ConnectedRileyLink) SendAndListen() error
- func (crl *ConnectedRileyLink) SendPacket() error
- func (crl *ConnectedRileyLink) SetCustomName(newname string) error
- func (crl *ConnectedRileyLink) SetFrequency(freq uint32) error
- func (crl *ConnectedRileyLink) SetLEDMode(mode LEDMode) error
- func (crl *ConnectedRileyLink) SetModeRegisters() error
- func (crl *ConnectedRileyLink) SetPreamble() error
- func (crl *ConnectedRileyLink) SetSWEncoding() error
- func (crl *ConnectedRileyLink) UpdateRegister() error
- func (crl *ConnectedRileyLink) WriteRegister(reg CxRegister, value byte) error
- type CxRegister
- type LEDColor
- type LEDMode
- type MMTPumpSize
- type MedtronicPump
- func (mmtpump *MedtronicPump) ASWTHOSOD() bool
- func (mmtpump *MedtronicPump) GetGeneration() int
- func (mmtpump *MedtronicPump) GetMaxReserviorSize() MMTPumpSize
- func (mmtpump *MedtronicPump) HasBolusErrorQuirk() bool
- func (mmtpump *MedtronicPump) HasLowSuspend() bool
- func (mmtpump *MedtronicPump) HasMySentry() bool
- func (mmtpump *MedtronicPump) Modern() bool
- func (mmtpump *MedtronicPump) NewRecordStyle() bool
- func (mmtpump *MedtronicPump) RBPSE() bool
- func (mmtpump *MedtronicPump) StrokesPerUnit() int
- type RLCCResponse
- type RileyLinkCCResponseType
- type RileyLinkCommand
- type RileyLinkPacketChannel
- type RileyLinkStatistics
- type RxFilter
- type SwEncoding
Constants ¶
const ( RxFilterWide RxFilter = 0x50 // 300KHz RxFilterNarrow RxFilter = 0x90 // 150KHz EncodingNone SwEncoding = 0x00 EncodingManchester SwEncoding = 0x01 Encoding4b6b SwEncoding = 0x02 RegisterSync1 CxRegister = 0x00 RegisterSync0 CxRegister = 0x01 RegisterPktlen CxRegister = 0x02 RegisterPktctrl1 CxRegister = 0x03 RegisterPktctrl0 CxRegister = 0x04 RegisterFsctrl1 CxRegister = 0x07 RegisterFreq2 CxRegister = 0x09 RegisterFreq1 CxRegister = 0x0a RegisterFreq0 CxRegister = 0x0b RegisterMdmcfg4 CxRegister = 0x0c RegisterMdmcfg3 CxRegister = 0x0d RegisterMdmcfg2 CxRegister = 0x0e RegisterMdmcfg1 CxRegister = 0x0f RegisterMdmcfg0 CxRegister = 0x10 RegisterDeviatn CxRegister = 0x11 RegisterMcsm0 CxRegister = 0x14 RegisterFoccfg CxRegister = 0x15 RegisterAgcctrl2 CxRegister = 0x17 RegisterAgcctrl1 CxRegister = 0x18 RegisterAgcctrl0 CxRegister = 0x19 RegisterFrend1 CxRegister = 0x1a RegisterFrend0 CxRegister = 0x1b RegisterFscal3 CxRegister = 0x1c RegisterFscal2 CxRegister = 0x1d RegisterFscal1 CxRegister = 0x1e RegisterFscal0 CxRegister = 0x1f RegisterTest1 CxRegister = 0x24 RegisterTest0 CxRegister = 0x25 RegisterPaTable0 CxRegister = 0x2e // 24MHz crystal OscillatorHz = 24000000 )
Variables ¶
This section is empty.
Functions ¶
func ConnectAddress ¶
ConnectAddress binds a RileyLink via BT address
func ConnectName ¶
ConnectName binds a RileyLink via local (custom) name
func ConnectNameOrAddress ¶
ConnectNameOrAddress binds a RileyLink based on address or name input
Types ¶
type CarelinkMessage ¶
type CarelinkMessage struct {
MessageType CarelinkMessageType
Data []byte
}
CarelinkMessage encapsulates a command with associated data
type CarelinkMessageType ¶
type CarelinkMessageType byte
CarelinkMessageType is the literal type of commands
const ( CMTAlert CarelinkMessageType = 0x01 CMTAlertCleared CarelinkMessageType = 0x02 CMTDeviceTest CarelinkMessageType = 0x03 CMTPumpStatus CarelinkMessageType = 0x04 CMTPumpAck CarelinkMessageType = 0x06 CMTPumpBackfill CarelinkMessageType = 0x08 CMTFindDevice CarelinkMessageType = 0x09 CMTDeviceLink CarelinkMessageType = 0x0A CMTErrorResponse CarelinkMessageType = 0x15 CMTWriteGlucoseHistoryTimestamp CarelinkMessageType = 0x28 CMTSetBasalProfileA CarelinkMessageType = 0x30 // CMD_SET_A_PROFILE CMTSetBasalProfileB CarelinkMessageType = 0x31 // CMD_SET_B_PROFILE CMTChangeTime CarelinkMessageType = 0x40 CMTSetMaxBolus CarelinkMessageType = 0x41 // CMD_SET_MAX_BOLUS CMTBolus CarelinkMessageType = 0x42 CMTPumpExperimentOP67 CarelinkMessageType = 0x43 CMTPumpExperimentOP68 CarelinkMessageType = 0x44 CMTPumpExperimentOP69 CarelinkMessageType = 0x45 // CMD_SET_VAR_BOLUS_ENABLE CMTSelectBasalProfile CarelinkMessageType = 0x4a CMTChangeTempBasal CarelinkMessageType = 0x4c CMTPumpExperimentOP80 CarelinkMessageType = 0x50 CMTSetRemoteControlID CarelinkMessageType = 0x51 // CMD_SET_RF_REMOTE_ID CMTPumpExperimentOP82 CarelinkMessageType = 0x52 // CMD_SET_BLOCK_ENABLE CMTSetLanguage CarelinkMessageType = 0x53 CMTPumpExperimentOP84 CarelinkMessageType = 0x54 // CMD_SET_ALERT_TYPE CMTPumpExperimentOP85 CarelinkMessageType = 0x55 // CMD_SET_PATTERNS_ENABLE CMTPumpExperimentOP86 CarelinkMessageType = 0x56 CMTSetRemoteControlEnabled CarelinkMessageType = 0x57 // CMD_SET_RF_ENABLE CMTPumpExperimentOP88 CarelinkMessageType = 0x58 // CMD_SET_INSULIN_ACTION_TYPE CMTPumpExperimentOP89 CarelinkMessageType = 0x59 CMTPumpExperimentOP90 CarelinkMessageType = 0x5a CMTButtonPress CarelinkMessageType = 0x5b CMTPumpExperimentOP92 CarelinkMessageType = 0x5c CMTPowerOn CarelinkMessageType = 0x5d CMTSetBolusWizardEnabled1 CarelinkMessageType = 0x61 CMTSetBolusWizardEnabled2 CarelinkMessageType = 0x62 CMTSetBolusWizardEnabled3 CarelinkMessageType = 0x63 CMTSetBolusWizardEnabled4 CarelinkMessageType = 0x64 CMTSetBolusWizardEnabled5 CarelinkMessageType = 0x65 CMTSetAlarmClockEnable CarelinkMessageType = 0x67 CMTSetMaxBasalRate CarelinkMessageType = 0x6e // CMD_SET_MAX_BASAL CMTSetBasalProfileStandard CarelinkMessageType = 0x6f // CMD_SET_STD_PROFILE CMTReadTime CarelinkMessageType = 0x70 CMTGetBattery CarelinkMessageType = 0x72 CMTReadRemainingInsulin CarelinkMessageType = 0x73 CMTReadFirmwareVersion CarelinkMessageType = 0x74 CMTReadErrorStatus CarelinkMessageType = 0x75 CMTReadRemoteControlIDs CarelinkMessageType = 0x76 // CMD_READ_REMOTE_CTRL_IDS CMTGetHistoryPage CarelinkMessageType = 0x80 CMTGetPumpModel CarelinkMessageType = 0x8d CMTReadProfileSTD512 CarelinkMessageType = 0x92 CMTReadProfileA512 CarelinkMessageType = 0x93 CMTReadProfileB512 CarelinkMessageType = 0x94 CMTReadTempBasal CarelinkMessageType = 0x98 CMTGetGlucosePage CarelinkMessageType = 0x9A CMTReadCurrentPageNumber CarelinkMessageType = 0x9d CMTReadSettings CarelinkMessageType = 0xc0 CMTReadCurrentGlucosePage CarelinkMessageType = 0xcd CMTReadPumpStatus CarelinkMessageType = 0xce CMTUnknownE2 CarelinkMessageType = 0xe2 // a7594040e214190226330000000000021f99011801e00103012c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 CMTUnknownE6 CarelinkMessageType = 0xe6 // a7594040e60200190000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 CMTSettingsChangeCounter CarelinkMessageType = 0xec // Body[3] increments by 1 after changing certain settings 0200af0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 CMTReadOtherDevicesIDs CarelinkMessageType = 0xf0 CMTReadCaptureEventEnabled CarelinkMessageType = 0xf1 // Body[1] encodes the bool state 0101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 CMTChangeCaptureEventEnable CarelinkMessageType = 0xf2 CMTReadOtherDevicesStatus CarelinkMessageType = 0xf3 )
type ConnectedRileyLink ¶
type ConnectedRileyLink struct {
// contains filtered or unexported fields
}
ConnectedRileyLink represents a BLE connection to a rileylink
func AttachBTLE ¶
func AttachBTLE(blec ble.Client) (*ConnectedRileyLink, error)
AttachBTLE creates a connection descriptor for a rileylink based on input of a legitimate BLE-layer connected device. It will fail if you give it a BT speaker or whatever Effectively the constructor
func (*ConnectedRileyLink) GetBLEVersion ¶
func (crl *ConnectedRileyLink) GetBLEVersion() (string, error)
Version [BLE] returns the BLE firmware revision on the device
func (*ConnectedRileyLink) GetBatteryLevel ¶
func (crl *ConnectedRileyLink) GetBatteryLevel() (int, error)
BatteryLevel [BLE] retrieves an approximated battery percentage from the device
func (*ConnectedRileyLink) GetCustomName ¶
func (crl *ConnectedRileyLink) GetCustomName() (string, error)
GetCustomName [BLE] returns the device's name set by the user
func (*ConnectedRileyLink) GetFrequency ¶
func (crl *ConnectedRileyLink) GetFrequency() (uint32, error)
GetFrequency returns the radio's current tuning in Hz (from Kenneth)
func (*ConnectedRileyLink) GetLEDMode ¶
func (crl *ConnectedRileyLink) GetLEDMode() (LEDMode, error)
GetLEDMode [BLE] retrieves the mode of the diagnostic LEDs (blue)
func (*ConnectedRileyLink) GetPacket ¶
func (crl *ConnectedRileyLink) GetPacket(rlpc RileyLinkPacketChannel, timeout time.Duration) (*RLCCResponse, error)
GetPacket [CC] does a thing that will be documented at some point
func (*ConnectedRileyLink) GetRadioVersion ¶
func (crl *ConnectedRileyLink) GetRadioVersion() (string, error)
GetRadioVersion [CC] returns the version of the CC firmware
func (*ConnectedRileyLink) GetState ¶
func (crl *ConnectedRileyLink) GetState() (bool, error)
GetState [CC] is an internal diagnostic call
func (*ConnectedRileyLink) GetStatistics ¶
func (crl *ConnectedRileyLink) GetStatistics() (*RileyLinkStatistics, error)
GetStatistics [CC] does a thing that will be documented at some point
func (*ConnectedRileyLink) Interrupt ¶
func (crl *ConnectedRileyLink) Interrupt() error
Interrupt [CC] is, like, stop what you're doing
func (*ConnectedRileyLink) LED ¶
func (crl *ConnectedRileyLink) LED(ledc LEDColor, ledm LEDMode) error
LED [CC] does a thing that will be documented at some point
func (*ConnectedRileyLink) NotifySubscribe ¶
func (crl *ConnectedRileyLink) NotifySubscribe() error
NotifySubscribe [local] wires a function as a callback to the data notifier
func (*ConnectedRileyLink) RawReset ¶
func (crl *ConnectedRileyLink) RawReset() error
RawReset [CC] resets the CC chip and that's that
func (*ConnectedRileyLink) ReadRSSI ¶
func (crl *ConnectedRileyLink) ReadRSSI() int
ReadRSSI [local] just exposes the underlying call
func (*ConnectedRileyLink) ReadRegister ¶
func (crl *ConnectedRileyLink) ReadRegister(reg CxRegister) (byte, error)
ReadRegister [CC] reads a cute 'lil 8-bit register
func (*ConnectedRileyLink) Reset ¶
func (crl *ConnectedRileyLink) Reset() (bool, error)
Reset [CC] resets the CC chip, and returns a state call after 100ms
func (*ConnectedRileyLink) ResetRadioConfig ¶
func (crl *ConnectedRileyLink) ResetRadioConfig() error
ResetRadioConfig [CC] does a thing that will be documented at some point
func (*ConnectedRileyLink) SendAndListen ¶
func (crl *ConnectedRileyLink) SendAndListen() error
SendAndListen [CC] does a thing that will be documented at some point
func (*ConnectedRileyLink) SendPacket ¶
func (crl *ConnectedRileyLink) SendPacket() error
SendPacket [CC] does a thing that will be documented at some point
func (*ConnectedRileyLink) SetCustomName ¶
func (crl *ConnectedRileyLink) SetCustomName(newname string) error
SetCustomName [BLE] pushes a new name to the device
func (*ConnectedRileyLink) SetFrequency ¶
func (crl *ConnectedRileyLink) SetFrequency(freq uint32) error
SetFrequency tells the CC to tune to a specific frequency
func (*ConnectedRileyLink) SetLEDMode ¶
func (crl *ConnectedRileyLink) SetLEDMode(mode LEDMode) error
SetLEDMode [BLE] switches the mode of the diagnostic LEDs (blue)
func (*ConnectedRileyLink) SetModeRegisters ¶
func (crl *ConnectedRileyLink) SetModeRegisters() error
SetModeRegisters [CC] does a thing that will be documented at some point
func (*ConnectedRileyLink) SetPreamble ¶
func (crl *ConnectedRileyLink) SetPreamble() error
SetPreamble [CC] does a thing that will be documented at some point
func (*ConnectedRileyLink) SetSWEncoding ¶
func (crl *ConnectedRileyLink) SetSWEncoding() error
SetSWEncoding [CC] does a thing that will be documented at some point
func (*ConnectedRileyLink) UpdateRegister ¶
func (crl *ConnectedRileyLink) UpdateRegister() error
UpdateRegister [CC] does a thing that will be documented at some point
func (*ConnectedRileyLink) WriteRegister ¶
func (crl *ConnectedRileyLink) WriteRegister(reg CxRegister, value byte) error
WriteRegister [CC] writes a cute 'lil 8-bit register
type CxRegister ¶
type CxRegister byte
type LEDColor ¶
type LEDColor byte
LEDColor is the literal type of the choice of LED Valid for CC LEDs for sure, BLE LEDs idk
type MMTPumpSize ¶
type MMTPumpSize int
const ( MMTPumpSizeUnknown MMTPumpSize = 0 MMTPumpSizeSmall MMTPumpSize = 500 MMTPumpSizeLarge MMTPumpSize = 700 )
type MedtronicPump ¶
type MedtronicPump struct {
ModelNumber int
}
func (*MedtronicPump) ASWTHOSOD ¶
func (mmtpump *MedtronicPump) ASWTHOSOD() bool
func (*MedtronicPump) GetGeneration ¶
func (mmtpump *MedtronicPump) GetGeneration() int
func (*MedtronicPump) GetMaxReserviorSize ¶
func (mmtpump *MedtronicPump) GetMaxReserviorSize() MMTPumpSize
func (*MedtronicPump) HasBolusErrorQuirk ¶
func (mmtpump *MedtronicPump) HasBolusErrorQuirk() bool
func (*MedtronicPump) HasLowSuspend ¶
func (mmtpump *MedtronicPump) HasLowSuspend() bool
func (*MedtronicPump) HasMySentry ¶
func (mmtpump *MedtronicPump) HasMySentry() bool
func (*MedtronicPump) Modern ¶
func (mmtpump *MedtronicPump) Modern() bool
Modern returns whether the pump is considered "modern"
func (*MedtronicPump) NewRecordStyle ¶
func (mmtpump *MedtronicPump) NewRecordStyle() bool
func (*MedtronicPump) RBPSE ¶
func (mmtpump *MedtronicPump) RBPSE() bool
func (*MedtronicPump) StrokesPerUnit ¶
func (mmtpump *MedtronicPump) StrokesPerUnit() int
type RLCCResponse ¶
type RLCCResponse struct {
Result RileyLinkCCResponseType
Payload []byte
RSSI int
}
RLCCResponse represents a return from the CC chip
type RileyLinkCCResponseType ¶
type RileyLinkCCResponseType byte
RileyLinkCCResponseType represents the outcome of the sent command
const ( RLRRecvTimeout RileyLinkCCResponseType = 0xaa RLRInterrupted RileyLinkCCResponseType = 0xbb RLRZeroData RileyLinkCCResponseType = 0xcc RLRSuccess RileyLinkCCResponseType = 0xdd RLRInvalidParam RileyLinkCCResponseType = 0x11 RLRUnknownCommand RileyLinkCCResponseType = 0x22 )
func (RileyLinkCCResponseType) String ¶
func (rlr RileyLinkCCResponseType) String() string
type RileyLinkCommand ¶
type RileyLinkCommand byte
RileyLinkCommand is the literal type of a device command
const ( // RLCInterrupt just pushes a null command out, effectively // interrupting another command in progress RLCInterrupt RileyLinkCommand = 0x00 // RLCGetState returns "OK" when the CC chip is ... OK RLCGetState RileyLinkCommand = 0x01 // RLCGetVersion returns the version of the CC firmware (subg_rfspy) RLCGetVersion RileyLinkCommand = 0x02 RLCGetPacket RileyLinkCommand = 0x03 RLCSendPacket RileyLinkCommand = 0x04 RLCSendAndListen RileyLinkCommand = 0x05 RLCUpdateRegister RileyLinkCommand = 0x06 RLCReset RileyLinkCommand = 0x07 RLCLED RileyLinkCommand = 0x08 RLCReadRegister RileyLinkCommand = 0x09 RLCSetModeRegisters RileyLinkCommand = 0x0A RLCSetSWEncoding RileyLinkCommand = 0x0B RLCSetPreamble RileyLinkCommand = 0x0C RLCResetRadioConfig RileyLinkCommand = 0x0D RLCGetStatistics RileyLinkCommand = 0x0E )
func (RileyLinkCommand) String ¶
func (rlc RileyLinkCommand) String() string
type RileyLinkPacketChannel ¶
type RileyLinkPacketChannel byte
RileyLinkPacketChannel represents the internal channel type
const ( RLPCMeter RileyLinkPacketChannel = 0x01 RLPCPump RileyLinkPacketChannel = 0x02 )
func (RileyLinkPacketChannel) String ¶
func (rlpc RileyLinkPacketChannel) String() string
type RileyLinkStatistics ¶
type RileyLinkStatistics struct {
Collected time.Time
Uptime time.Duration
RecvOverflows uint16
RecvFifoOverflows uint16
PacketsRecv uint16
PacketsXmit uint16
CRCFailures uint16
SPISyncFailures uint16
}
RileyLinkStatistics represents a concrete statistics pull event
type SwEncoding ¶
type SwEncoding byte
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
grl-demo
command
|
|
|
grl-getpacket
command
|
|
|
grl-info
command
|
|
|
grl-leds
command
|
|
|
grl-rename
command
|
|
|
grl-sendpacket
command
|
|
|
grl-tune
command
|