Documentation ¶
Index ¶
- Constants
- Variables
- func DeviceAddress(id string) ([]byte, error)
- func NightscoutEntries(records CGMHistory) nightscout.Entries
- func ParseFrequency(s string) (uint32, error)
- func PumpAddress() []byte
- func ReverseCGMHistory(a CGMHistory)
- func ReverseHistory(a History)
- func Treatments(records History) []nightscout.Treatment
- type AlarmCode
- type BadResponseError
- type BasalProfileStartRecord
- type BasalRate
- type BasalRateSchedule
- type BatteryInfo
- type BolusRecord
- type BolusWizardConfig
- type BolusWizardRecord
- type BolusWizardSetupRecord
- type CGMHistory
- type CGMRecord
- type CGMRecordType
- type CarbRatio
- type CarbRatioSchedule
- type CarbRecord
- type CarbUnitsType
- type Carbs
- type Command
- type Duration
- type Family
- type Glucose
- type GlucoseRecord
- type GlucoseTarget
- type GlucoseTargetSchedule
- type GlucoseUnitsType
- type History
- type HistoryRecord
- type HistoryRecordType
- type Insulin
- type InsulinSensitivity
- type InsulinSensitivitySchedule
- type InvalidCommandError
- type NoResponseError
- type PrimeRecord
- type Pump
- func (pump *Pump) BadResponse(cmd Command, data []byte)
- func (pump *Pump) BasalPatternA() BasalRateSchedule
- func (pump *Pump) BasalPatternB() BasalRateSchedule
- func (pump *Pump) BasalRates() BasalRateSchedule
- func (pump *Pump) Battery() BatteryInfo
- func (pump *Pump) Bolus(amount Insulin)
- func (pump *Pump) Button(b PumpButton)
- func (pump *Pump) CGMCurrentGlucosePage() int
- func (pump *Pump) CGMHistory(since time.Time) CGMHistory
- func (pump *Pump) CGMWriteTimestamp()
- func (pump *Pump) CalibrationFactor() int
- func (pump *Pump) CarbRatios() CarbRatioSchedule
- func (pump *Pump) CarbUnits() CarbUnitsType
- func (pump *Pump) Clock() time.Time
- func (pump *Pump) Close()
- func (pump *Pump) Download(cmd Command, page int) []byte
- func (pump *Pump) Error() error
- func (pump *Pump) Execute(cmd Command, params ...byte) []byte
- func (pump *Pump) ExtendedRequest(cmd Command, params ...byte) []byte
- func (pump *Pump) ExtendedResponse(cmd Command, params ...byte) []byte
- func (pump *Pump) Family() Family
- func (pump *Pump) FirmwareVersion() string
- func (pump *Pump) GlucosePage(page int) []byte
- func (pump *Pump) GlucoseTargets() GlucoseTargetSchedule
- func (pump *Pump) GlucoseUnits() GlucoseUnitsType
- func (pump *Pump) History(since time.Time) History
- func (pump *Pump) HistoryFrom(id []byte) (History, bool)
- func (pump *Pump) HistoryPage(page int) []byte
- func (pump *Pump) ISIGPage(page int) []byte
- func (pump *Pump) InsulinSensitivities() InsulinSensitivitySchedule
- func (pump *Pump) LastHistoryPage() int
- func (pump *Pump) Model() string
- func (pump *Pump) NoResponse() bool
- func (pump *Pump) PumpID() string
- func (pump *Pump) RSSI() int
- func (pump *Pump) Reservoir() Insulin
- func (pump *Pump) Retries() int
- func (pump *Pump) SetAbsoluteTempBasal(duration time.Duration, rate Insulin)
- func (pump *Pump) SetBasalPatternA(s BasalRateSchedule)
- func (pump *Pump) SetBasalPatternB(s BasalRateSchedule)
- func (pump *Pump) SetBasalRates(s BasalRateSchedule)
- func (pump *Pump) SetClock(t time.Time)
- func (pump *Pump) SetError(err error)
- func (pump *Pump) SetMaxBasal(rate Insulin)
- func (pump *Pump) SetMaxBolus(amount Insulin)
- func (pump *Pump) SetPercentTempBasal(duration time.Duration, percent int)
- func (pump *Pump) SetRetries(n int)
- func (pump *Pump) SetTimeout(t time.Duration)
- func (pump *Pump) Settings() SettingsInfo
- func (pump *Pump) Status() StatusInfo
- func (pump *Pump) Suspend(yes bool)
- func (pump *Pump) TempBasal() TempBasalInfo
- func (pump *Pump) Timeout() time.Duration
- func (pump *Pump) VcntrPage(page int) []byte
- func (pump *Pump) Wakeup()
- type PumpButton
- type PumpError
- type Ratio
- type SettingsInfo
- type StatusInfo
- type TempBasalInfo
- type TempBasalRecord
- type TempBasalType
- type TimeOfDay
- type UnabsorbedBolus
- type UnabsorbedBolusHistory
- type UnknownRecordTypeError
- type Voltage
Constants ¶
const ( // MaxHistoryPages is the maximum number of pump history pages. MaxHistoryPages = 36 // Max512HistoryPages is the maximum number of pump history pages for model x12 pumps. Max512HistoryPages = 32 )
const ( // JSONTimeLayout specifies the format for JSON time values. JSONTimeLayout = time.RFC3339 // UserTimeLayout specifies a consistent, human-readable format for local time. UserTimeLayout = "2006-01-02 15:04:05" )
const (
// MaxGlucosePages is the maximum number of glucose history pages.
MaxGlucosePages = 32
)
Variables ¶
var ErrorNeedsTimestamp = fmt.Errorf("CGM history needs timestamp")
ErrorNeedsTimestamp indicates that no initial timestamp was found.
Functions ¶
func DeviceAddress ¶
DeviceAddress returns the encoded form of a device ID.
func NightscoutEntries ¶
func NightscoutEntries(records CGMHistory) nightscout.Entries
NightscoutEntries converts certain CGM history records into records that can be uploaded as Nightscout entries. The nightscout.Trend calculation assumes that the records are in reverse chronological order.
func ParseFrequency ¶
ParseFrequency interprets the given string as a frequency and returns its value in Hertz.
func ReverseCGMHistory ¶
func ReverseCGMHistory(a CGMHistory)
ReverseCGMHistory reverses a slice of CGM history records.
func ReverseHistory ¶
func ReverseHistory(a History)
ReverseHistory reverses a slice of history records.
func Treatments ¶
func Treatments(records History) []nightscout.Treatment
Treatments converts certain pump history records into records that can be uploaded as Nightscout treatments. History records must be in chronological order.
Types ¶
type BadResponseError ¶
BadResponseError indicates an unexpected response to a command.
func (BadResponseError) Error ¶
func (e BadResponseError) Error() string
type BasalProfileStartRecord ¶
type BasalRateSchedule ¶
type BasalRateSchedule []BasalRate
BasalRateSchedule represents a basal rate schedule.
func (BasalRateSchedule) BasalRateAt ¶
func (s BasalRateSchedule) BasalRateAt(t time.Time) int
BasalRateAt returns the index of the basal rate in effect at the given time.
func (BasalRateSchedule) NextChange ¶
func (s BasalRateSchedule) NextChange(t time.Time) time.Time
NextChange returns the time when the next scheduled rate will take effect (strictly after t).
func (BasalRateSchedule) NightscoutSchedule ¶
func (sched BasalRateSchedule) NightscoutSchedule() nightscout.Schedule
NightscoutSchedule converts a BasalRateSchedule to a nightscout.Schedule.
type BatteryInfo ¶
BatteryInfo represents the pump's battery voltage and low-battery state.
type BolusRecord ¶
type BolusWizardConfig ¶
type BolusWizardConfig struct { Ratios CarbRatioSchedule Sensitivities InsulinSensitivitySchedule Targets GlucoseTargetSchedule InsulinAction Duration }
type BolusWizardRecord ¶
type BolusWizardRecord struct { GlucoseInput Glucose CarbInput Carbs GlucoseUnits GlucoseUnitsType CarbUnits CarbUnitsType TargetLow Glucose TargetHigh Glucose Sensitivity Glucose // glucose reduction per insulin unit CarbRatio Ratio // 10x grams/unit or 1000x units/exchange Correction Insulin Food Insulin Unabsorbed Insulin Bolus Insulin }
func (BolusWizardRecord) MarshalJSON ¶
func (r BolusWizardRecord) MarshalJSON() ([]byte, error)
MarshalJSON marshals BolusWizardRecord values.
func (*BolusWizardRecord) UnmarshalJSON ¶
func (r *BolusWizardRecord) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals BolusWizardRecord values.
type BolusWizardSetupRecord ¶
type BolusWizardSetupRecord struct { Before BolusWizardConfig After BolusWizardConfig }
type CGMHistory ¶
type CGMHistory []CGMRecord
CGMHistory represents a sequence of CGM records.
func DecodeCGMHistory ¶
DecodeCGMHistory decodes the records in a page of CGM data and returns them in reverse chronological order (most recent first). If a non-zero time is given, it is used as the initial timestamp.
type CGMRecord ¶
type CGMRecord struct { Type CGMRecordType Data []byte Time time.Time Glucose int `json:",omitempty"` Value string `json:",omitempty"` }
CGMRecord represents a CGM record.
func DecodeCGMRecord ¶
DecodeCGMRecord decodes a CGM history record based on its type.
func (CGMRecord) MarshalJSON ¶
MarshalJSON marshals CGMRecord values.
func (*CGMRecord) UnmarshalJSON ¶
UnmarshalJSON unmarshals CGMRecord values.
type CGMRecordType ¶
type CGMRecordType byte
CGMRecordType represents a CGM record type.
const ( CGMDataEnd CGMRecordType = 0x01 CGMWeakSignal CGMRecordType = 0x02 CGMCal CGMRecordType = 0x03 CGMPacket CGMRecordType = 0x04 CGMError CGMRecordType = 0x05 CGMDataLow CGMRecordType = 0x06 CGMDataHigh CGMRecordType = 0x07 CGMTimestamp CGMRecordType = 0x08 CGMBatteryChange CGMRecordType = 0x0A CGMStatus CGMRecordType = 0x0B CGMTimeChange CGMRecordType = 0x0C CGMSync CGMRecordType = 0x0D CGMCalBG CGMRecordType = 0x0E CGMCalFactor CGMRecordType = 0x0F CGMEvent10 CGMRecordType = 0x10 CGMEvent13 CGMRecordType = 0x13 // Synthetic record type. // Single bytes with this value or greater represent glucose readings. CGMGlucose CGMRecordType = 0x20 )
Events stored in the pump's CGM history pages.
func (CGMRecordType) String ¶
func (i CGMRecordType) String() string
type CarbRatio ¶
type CarbRatio struct { Start TimeOfDay Ratio Ratio Units CarbUnitsType }
CarbRatio represents an entry in a carb ratio schedule.
func (CarbRatio) MarshalJSON ¶
MarshalJSON marshals CarbRatio values.
func (*CarbRatio) UnmarshalJSON ¶
UnmarshalJSON unmarshals CarbRatio values.
type CarbRatioSchedule ¶
type CarbRatioSchedule []CarbRatio
CarbRatioSchedule represents a carb ratio schedule.
func (CarbRatioSchedule) CarbRatioAt ¶
func (s CarbRatioSchedule) CarbRatioAt(t time.Time) CarbRatio
CarbRatioAt returns the carb ratio in effect at the given time.
func (CarbRatioSchedule) NightscoutSchedule ¶
func (sched CarbRatioSchedule) NightscoutSchedule() nightscout.Schedule
NightscoutSchedule converts a CarbRatioSchedule to a nightscout.Schedule.
type CarbRecord ¶
type CarbRecord struct { Units CarbUnitsType Carbs Carbs }
type CarbUnitsType ¶
type CarbUnitsType byte
CarbUnitsType represents the pump's carb unit type (grams or exchanges).
const ( // Grams represents the pump's use of grams for carb units. Grams CarbUnitsType = 1 // Exchanges represents the pump's use of exchanges for carb units. Exchanges CarbUnitsType = 2 )
func (CarbUnitsType) MarshalJSON ¶
func (r CarbUnitsType) MarshalJSON() ([]byte, error)
MarshalJSON marshals CarbUnitsType values.
func (CarbUnitsType) String ¶
func (i CarbUnitsType) String() string
func (*CarbUnitsType) UnmarshalJSON ¶
func (r *CarbUnitsType) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals CarbUnitsType values.
type Duration ¶
Duration allows custom JSON marshaling for time.Duration values.
func (Duration) MarshalJSON ¶
MarshalJSON marshals Duration values.
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON unmarshals Duration values.
type Family ¶
type Family int8
Family represents a pump family. Use int8 so the compiler will warn about accidental uses of 523 instead of 23, etc.
type Glucose ¶
type Glucose int
Glucose represents a glucose value as either mg/dL or μmol/L, so all conversions must include a GlucoseUnitsType parameter.
func (Glucose) NightscoutGlucose ¶
func (r Glucose) NightscoutGlucose() nightscout.Glucose
NightscoutGlucose converts a Glucose value to a nightscout.Glucose value.
type GlucoseRecord ¶
type GlucoseRecord struct { Units GlucoseUnitsType Glucose Glucose MeterID string `json:",omitempty"` }
type GlucoseTarget ¶
type GlucoseTarget struct { Start TimeOfDay Low Glucose High Glucose Units GlucoseUnitsType }
GlucoseTarget represents an entry in a glucose target schedule.
type GlucoseTargetSchedule ¶
type GlucoseTargetSchedule []GlucoseTarget
GlucoseTargetSchedule represents a glucose target schedule.
func (GlucoseTargetSchedule) GlucoseTargetAt ¶
func (s GlucoseTargetSchedule) GlucoseTargetAt(t time.Time) GlucoseTarget
GlucoseTargetAt returns the glucose target in effect at the given time.
func (GlucoseTargetSchedule) NightscoutSchedule ¶
func (sched GlucoseTargetSchedule) NightscoutSchedule() (nightscout.Schedule, nightscout.Schedule)
NightscoutSchedule converts a GlucoseTargetSchedule to a nightscout.Schedule.
type GlucoseUnitsType ¶
type GlucoseUnitsType byte
GlucoseUnitsType represents the pump's glucose unit type (mg/dL or mmol/L).
const ( // MgPerDeciLiter represents the pump's use of mg/dL for glucose units. MgPerDeciLiter GlucoseUnitsType = 1 // MMolPerLiter represents the pump's use of mmol/L for glucose units. MMolPerLiter GlucoseUnitsType = 2 )
func (GlucoseUnitsType) MarshalJSON ¶
func (r GlucoseUnitsType) MarshalJSON() ([]byte, error)
MarshalJSON marshals GlucoseUnitsType values.
func (GlucoseUnitsType) String ¶
func (u GlucoseUnitsType) String() string
func (*GlucoseUnitsType) UnmarshalJSON ¶
func (r *GlucoseUnitsType) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals GlucoseUnitsType values.
type History ¶
type History []HistoryRecord
type HistoryRecord ¶
func DecodeHistoryRecord ¶
func DecodeHistoryRecord(data []byte, family Family) (HistoryRecord, error)
DecodeHistoryRecord decodes a history record based on its type.
func (HistoryRecord) MarshalJSON ¶
func (r HistoryRecord) MarshalJSON() ([]byte, error)
MarshalJSON marshals HistoryRecord values.
func (HistoryRecord) Type ¶
func (r HistoryRecord) Type() HistoryRecordType
Type returns the history record type.
func (*HistoryRecord) UnmarshalJSON ¶
func (r *HistoryRecord) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals HistoryRecord values.
type HistoryRecordType ¶
type HistoryRecordType byte
HistoryRecordType represents a history record type.
const ( Bolus HistoryRecordType = 0x01 Prime HistoryRecordType = 0x03 Alarm HistoryRecordType = 0x06 DailyTotal HistoryRecordType = 0x07 BasalProfileBefore HistoryRecordType = 0x08 BasalProfileAfter HistoryRecordType = 0x09 BGCapture HistoryRecordType = 0x0A SensorAlarm HistoryRecordType = 0x0B ClearAlarm HistoryRecordType = 0x0C ChangeBasalPattern HistoryRecordType = 0x14 TempBasalDuration HistoryRecordType = 0x16 ChangeTime HistoryRecordType = 0x17 NewTime HistoryRecordType = 0x18 LowBattery HistoryRecordType = 0x19 BatteryChange HistoryRecordType = 0x1A SetAutoOff HistoryRecordType = 0x1B PrepareInsulinChange HistoryRecordType = 0x1C SuspendPump HistoryRecordType = 0x1E ResumePump HistoryRecordType = 0x1F SelfTest HistoryRecordType = 0x20 Rewind HistoryRecordType = 0x21 ClearSettings HistoryRecordType = 0x22 EnableChildBlock HistoryRecordType = 0x23 MaxBolus HistoryRecordType = 0x24 EnableRemote HistoryRecordType = 0x26 MaxBasal HistoryRecordType = 0x2C EnableBolusWizard HistoryRecordType = 0x2D Unknown2E HistoryRecordType = 0x2E BolusWizard512 HistoryRecordType = 0x2F UnabsorbedInsulin512 HistoryRecordType = 0x30 ChangeBGReminder HistoryRecordType = 0x31 SetAlarmClockTime HistoryRecordType = 0x32 TempBasalRate HistoryRecordType = 0x33 LowReservoir HistoryRecordType = 0x34 AlarmClock HistoryRecordType = 0x35 ChangeMeterID HistoryRecordType = 0x36 BGReceived512 HistoryRecordType = 0x39 ConfirmInsulinChange HistoryRecordType = 0x3A SensorStatus HistoryRecordType = 0x3B EnableMeter HistoryRecordType = 0x3C BGReceived HistoryRecordType = 0x3F MealMarker HistoryRecordType = 0x40 ExerciseMarker HistoryRecordType = 0x41 InsulinMarker HistoryRecordType = 0x42 OtherMarker HistoryRecordType = 0x43 EnableSensorAutoCal HistoryRecordType = 0x44 ChangeBolusWizardSetup HistoryRecordType = 0x4F SensorSetup HistoryRecordType = 0x50 Sensor51 HistoryRecordType = 0x51 Sensor52 HistoryRecordType = 0x52 ChangeSensorAlarm HistoryRecordType = 0x53 Sensor54 HistoryRecordType = 0x54 Sensor55 HistoryRecordType = 0x55 ChangeSensorAlert HistoryRecordType = 0x56 ChangeBolusStep HistoryRecordType = 0x57 BolusWizardSetup HistoryRecordType = 0x5A BolusWizard HistoryRecordType = 0x5B UnabsorbedInsulin HistoryRecordType = 0x5C SaveSettings HistoryRecordType = 0x5D EnableVariableBolus HistoryRecordType = 0x5E ChangeEasyBolus HistoryRecordType = 0x5F EnableBGReminder HistoryRecordType = 0x60 EnableAlarmClock HistoryRecordType = 0x61 ChangeTempBasalType HistoryRecordType = 0x62 ChangeAlarmType HistoryRecordType = 0x63 ChangeTimeFormat HistoryRecordType = 0x64 ChangeReservoirWarning HistoryRecordType = 0x65 EnableBolusReminder HistoryRecordType = 0x66 SetBolusReminderTime HistoryRecordType = 0x67 DeleteBolusReminderTime HistoryRecordType = 0x68 BolusReminder HistoryRecordType = 0x69 DeleteAlarmClockTime HistoryRecordType = 0x6A DailyTotal515 HistoryRecordType = 0x6C DailyTotal522 HistoryRecordType = 0x6D DailyTotal523 HistoryRecordType = 0x6E ChangeCarbUnits HistoryRecordType = 0x6F BasalProfileStart HistoryRecordType = 0x7B ConnectOtherDevices HistoryRecordType = 0x7C ChangeOtherDevice HistoryRecordType = 0x7D ChangeMarriage HistoryRecordType = 0x81 DeleteOtherDevice HistoryRecordType = 0x82 EnableCaptureEvent HistoryRecordType = 0x83 )
Events stored in the pump's history pages.
func (HistoryRecordType) String ¶
func (i HistoryRecordType) String() string
type Insulin ¶
type Insulin int
Insulin represents quantities and rates of insulin delivery, in milliunits.
func (Insulin) MarshalJSON ¶
MarshalJSON marshals Insulin values.
func (Insulin) NightscoutInsulin ¶
func (r Insulin) NightscoutInsulin() nightscout.Insulin
NightscoutInsulin converts an Insulin value to a nightscout.Insulin value.
func (*Insulin) UnmarshalJSON ¶
UnmarshalJSON unmarshals Insulin values.
type InsulinSensitivity ¶
type InsulinSensitivity struct { Start TimeOfDay Sensitivity Glucose // glucose reduction per insulin unit Units GlucoseUnitsType }
InsulinSensitivity represents an entry in an insulin sensitivity schedule.
type InsulinSensitivitySchedule ¶
type InsulinSensitivitySchedule []InsulinSensitivity
InsulinSensitivitySchedule represents an insulin sensitivity schedule.
func (InsulinSensitivitySchedule) InsulinSensitivityAt ¶
func (s InsulinSensitivitySchedule) InsulinSensitivityAt(t time.Time) InsulinSensitivity
InsulinSensitivityAt returns the insulin sensitivity in effect at the given time.
func (InsulinSensitivitySchedule) NightscoutSchedule ¶
func (sched InsulinSensitivitySchedule) NightscoutSchedule() nightscout.Schedule
NightscoutSchedule converts an InsulinSensitivitySchedule to a nightscout.Schedule.
type InvalidCommandError ¶
InvalidCommandError indicates that the pump rejected a command as invalid.
func (InvalidCommandError) Error ¶
func (e InvalidCommandError) Error() string
type NoResponseError ¶
type NoResponseError Command
NoResponseError indicates that no response to a command was received.
func (NoResponseError) Error ¶
func (e NoResponseError) Error() string
type PrimeRecord ¶
type Pump ¶
Pump represents a Medtronic insulin pump.
func (*Pump) BadResponse ¶
BadResponse sets the pump's error state to a BadResponseError.
func (*Pump) BasalPatternA ¶
func (pump *Pump) BasalPatternA() BasalRateSchedule
BasalPatternA returns the pump's basal pattern A.
func (*Pump) BasalPatternB ¶
func (pump *Pump) BasalPatternB() BasalRateSchedule
BasalPatternB returns the pump's basal pattern B.
func (*Pump) BasalRates ¶
func (pump *Pump) BasalRates() BasalRateSchedule
BasalRates returns the pump's basal rate schedule.
func (*Pump) Battery ¶
func (pump *Pump) Battery() BatteryInfo
Battery returns the pump's battery information.
func (*Pump) Button ¶
func (pump *Pump) Button(b PumpButton)
Button sends the button-press to the pump.
func (*Pump) CGMCurrentGlucosePage ¶
CGMCurrentGlucosePage returns the current CGM glucose page number.
func (*Pump) CGMHistory ¶
func (pump *Pump) CGMHistory(since time.Time) CGMHistory
CGMHistory returns the CGM records since the specified time.
func (*Pump) CGMWriteTimestamp ¶
func (pump *Pump) CGMWriteTimestamp()
CGMWriteTimestamp writes a new sensor timestamp to the CGM history.
func (*Pump) CalibrationFactor ¶
CalibrationFactor returns the CGM calibration factor.
func (*Pump) CarbRatios ¶
func (pump *Pump) CarbRatios() CarbRatioSchedule
CarbRatios returns the pump's carb ratio schedule..
func (*Pump) CarbUnits ¶
func (pump *Pump) CarbUnits() CarbUnitsType
CarbUnits returns the pump's carb units.
func (*Pump) Execute ¶
Execute sends a command and parameters to the pump and returns its response. Commands with parameters require an initial exchange with no parameters, followed by an exchange with the actual arguments.
func (*Pump) ExtendedRequest ¶
ExtendedRequest sends a command and a sequence of parameter packets to the pump and returns its response.
func (*Pump) ExtendedResponse ¶
ExtendedResponse sends a command and parameters to the pump and collects the sequence of packets that make up its response.
func (*Pump) Family ¶
Family returns 22 for 522/722 pumps, 23 for 523/723 pumps, etc., and returns -1 for an unrecognized model. It calls Model once and caches the result.
func (*Pump) FirmwareVersion ¶
FirmwareVersion returns the pump's firmware version.
func (*Pump) GlucosePage ¶
GlucosePage downloads the given glucose page.
func (*Pump) GlucoseTargets ¶
func (pump *Pump) GlucoseTargets() GlucoseTargetSchedule
GlucoseTargets returns the pump's glucose target schedule.
func (*Pump) GlucoseUnits ¶
func (pump *Pump) GlucoseUnits() GlucoseUnitsType
GlucoseUnits returns the pump's glucose units.
func (*Pump) History ¶
History returns the history records since the specified time. Note that the results may include records with a zero timestamp or an earlier timestamp than the cutoff (in the case of DailyTotal records).
func (*Pump) HistoryFrom ¶
HistoryFrom returns the history records since the specified record ID along with a bool indicating whether it was found. If the record ID was not found, the result will contain the entire pump history.
func (*Pump) HistoryPage ¶
HistoryPage downloads the given history page.
func (*Pump) InsulinSensitivities ¶
func (pump *Pump) InsulinSensitivities() InsulinSensitivitySchedule
InsulinSensitivities returns the pump's insulin sensitivity schedule.
func (*Pump) LastHistoryPage ¶
LastHistoryPage returns the pump's last (oldest) history page number.
func (*Pump) Model ¶
Model requests the model number from the pump and returns it, caching the pump family as a side effect. Use Family to avoid contacting the pump more than once.
func (*Pump) NoResponse ¶
NoResponse checks whether the pump has a NoResponseError.
func (*Pump) SetAbsoluteTempBasal ¶
SetAbsoluteTempBasal sets a temporary basal with the given absolute rate and duration.
func (*Pump) SetBasalPatternA ¶
func (pump *Pump) SetBasalPatternA(s BasalRateSchedule)
SetBasalPatternA sets the pump's basal pattern A.
func (*Pump) SetBasalPatternB ¶
func (pump *Pump) SetBasalPatternB(s BasalRateSchedule)
SetBasalPatternB sets the pump's basal pattern B.
func (*Pump) SetBasalRates ¶
func (pump *Pump) SetBasalRates(s BasalRateSchedule)
SetBasalRates sets the pump's basal rate schedule.
func (*Pump) SetMaxBasal ¶
SetMaxBasal sets the pump's maximum basal rate.
func (*Pump) SetMaxBolus ¶
SetMaxBolus sets the pump's maximum bolus.
func (*Pump) SetPercentTempBasal ¶
SetPercentTempBasal sets a temporary basal with the given percent rate and duration.
func (*Pump) SetRetries ¶
SetRetries sets the number of retries used for pump communications. For safety, state-changing commands are only tried once.
func (*Pump) SetTimeout ¶
SetTimeout sets the timeout used for pump communications.
func (*Pump) Settings ¶
func (pump *Pump) Settings() SettingsInfo
Settings returns the pump's settings.
func (*Pump) TempBasal ¶
func (pump *Pump) TempBasal() TempBasalInfo
TempBasal returns the pump's current temporary basal setting. If none is in effect, it will have a Duration of 0.
type PumpButton ¶
type PumpButton byte
PumpButton represents a key on the pump keypad.
const ( BolusButton PumpButton = 0 EscButton PumpButton = 1 ActButton PumpButton = 2 UpButton PumpButton = 3 DownButton PumpButton = 4 )
Pump button codes.
func (PumpButton) String ¶
func (i PumpButton) String() string
type PumpError ¶
type PumpError byte
PumpError represents an error response from the pump.
type Ratio ¶
type Ratio int
Ratio represents a carb ratio using the higher resolution: 10x grams/unit or 1000x units/exchange.
func (Ratio) MarshalJSON ¶
MarshalJSON panics because Ratios must be marshaled together with carb units.
func (*Ratio) UnmarshalJSON ¶
UnmarshalJSON panics because Ratios must be unmarshaled together with carb units.
type SettingsInfo ¶
type SettingsInfo struct { AutoOff time.Duration InsulinAction time.Duration InsulinConcentration int // 50 or 100 MaxBolus Insulin MaxBasal Insulin RFEnabled bool TempBasalType TempBasalType SelectedPattern int }
SettingsInfo represents the pump's settings.
func (SettingsInfo) MarshalJSON ¶
func (r SettingsInfo) MarshalJSON() ([]byte, error)
MarshalJSON marshals SettingsInfo values.
func (*SettingsInfo) UnmarshalJSON ¶
func (r *SettingsInfo) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals SettingsInfo values.
type StatusInfo ¶
StatusInfo represents the pump's status.
func (StatusInfo) Normal ¶
func (s StatusInfo) Normal() bool
Normal returns true if the status code indicates normal pump operation. Observed values:
0: rewinding 1: preparing to prime 2: priming 3: normal
type TempBasalInfo ¶
type TempBasalInfo struct { Duration time.Duration Type TempBasalType Rate *Insulin `json:",omitempty"` Percent *uint8 `json:",omitempty"` }
TempBasalInfo represents a temporary basal setting.
func (TempBasalInfo) MarshalJSON ¶
func (r TempBasalInfo) MarshalJSON() ([]byte, error)
MarshalJSON marshals TempBasalInfo values.
func (*TempBasalInfo) UnmarshalJSON ¶
func (r *TempBasalInfo) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals TempBasalInfo values.
type TempBasalRecord ¶
type TempBasalRecord struct { Type TempBasalType Value interface{} }
type TempBasalType ¶
type TempBasalType byte
TempBasalType represents the temp basal type.
const ( // Absolute represents the pump's use of absolute rates for temporary basals. Absolute TempBasalType = 0 // Percent represents the pump's use of percentage rates for temporary basals. Percent TempBasalType = 1 )
func (TempBasalType) MarshalJSON ¶
func (r TempBasalType) MarshalJSON() ([]byte, error)
MarshalJSON marshals TempBasalType values.
func (TempBasalType) String ¶
func (i TempBasalType) String() string
func (*TempBasalType) UnmarshalJSON ¶
func (r *TempBasalType) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals TempBasalType values.
type TimeOfDay ¶
TimeOfDay represents a value between 0 and 24 hours.
func ParseTimeOfDay ¶
ParseTimeOfDay parses a string of the form HH:MM into a time of day.
func SinceMidnight ¶
SinceMidnight converts a time to a time of day.
func (TimeOfDay) MarshalJSON ¶
MarshalJSON marshals TimeOfDay values.
func (*TimeOfDay) UnmarshalJSON ¶
UnmarshalJSON unmarshals TimeOfDay values.
type UnabsorbedBolus ¶
type UnabsorbedBolusHistory ¶
type UnabsorbedBolusHistory []UnabsorbedBolus
type UnknownRecordTypeError ¶
type UnknownRecordTypeError struct {
Data []byte
}
func (UnknownRecordTypeError) Error ¶
func (e UnknownRecordTypeError) Error() string
type Voltage ¶
type Voltage int
Voltage represents the battery voltage in milliVolts.
func (Voltage) MarshalJSON ¶
MarshalJSON marshals Voltage values.
func (Voltage) NightscoutVoltage ¶
func (r Voltage) NightscoutVoltage() nightscout.Voltage
NightscoutVoltage converts a Voltage value to a nightscout.Voltage value.
func (*Voltage) UnmarshalJSON ¶
UnmarshalJSON unmarshals Voltage values.
Source Files ¶
- alarmcode_string.go
- basal.go
- battery.go
- bolus.go
- button.go
- carbratios.go
- carbunitstype_string.go
- cc111x.go
- cgmhistory.go
- cgmpage.go
- cgmrecord.go
- cgmrecordtype_string.go
- cleanup.go
- clock.go
- command.go
- command_string.go
- firmware.go
- historypage.go
- historyrecord.go
- historyrecordtype_string.go
- json.go
- maxbasal.go
- maxbolus.go
- model.go
- nightscout.go
- pump.go
- pumpbutton_string.go
- pumperror_string.go
- pumphistory.go
- pumpid.go
- reservoir.go
- sensitivities.go
- settings.go
- status.go
- suspend.go
- targets.go
- tempbasal.go
- tempbasaltype_string.go
- time.go
- units.go
- unmarshal.go
- wakeup.go