Packages

Pummpcomm is a library to handle communication with a Medtronic insulin pump via a serial link to a cc1110 chip running subg_rfspy.

Current section

Files

Jump to
pummpcomm lib pummpcomm session exchange read_pump_model.ex
Raw

lib/pummpcomm/session/exchange/read_pump_model.ex

defmodule Pummpcomm.Session.Exchange.ReadPumpModel do
alias Pummpcomm.Session.Command
alias Pummpcomm.Session.Response
alias Pummpcomm.PumpModel
@opcode 0x8D
def make(pump_serial) do
%Command{opcode: @opcode, pump_serial: pump_serial}
end
def decode(%Response{opcode: @opcode, data: <<length::8, rest::binary>>}) do
{:ok, model_number} = PumpModel.model_number(binary_part(rest, 0, length))
%{model_number: model_number}
end
end