View Source PrusaLink.Printer (PrusaLink v0.1.2)
Representation of a Prusa 3D printer and how to connect to it.
Summary
Functions
Create a new printer representation. It tries to connect to two endpoints (version & info) to retrieve meta information.
Retuns the meta information retrieved from the printer when connecting to it the first time.
Functions
@spec new(host_or_ip :: binary(), password :: binary()) :: {:ok, %PrusaLink.Printer{ api_version: integer(), capabilities: term(), client: Tesla.Client.t(), mmu: term(), name: term(), nozzle: term(), serial: term() }} | {:not_reachable, %PrusaLink.Printer{ api_version: integer(), capabilities: term(), client: Tesla.Client.t(), mmu: term(), name: term(), nozzle: term(), serial: term() }} | {:error, reason :: any()}
Create a new printer representation. It tries to connect to two endpoints (version & info) to retrieve meta information.
Returns a %PrusaLink.Printer{} struct including the information to connect to the printer as well as some meta information. If the printer can not be reached it returns a tuple with {:unreachable, %Printer{}}. The printer struct can still be used to connect to the printer later assuming the giving information is correct.
@spec specs(%PrusaLink.Printer{ api_version: term(), capabilities: term(), client: term(), mmu: term(), name: term(), nozzle: term(), serial: term() }) :: map()
Retuns the meta information retrieved from the printer when connecting to it the first time.
Examples
iex> PrusaLink.Printer.specs(mk4)
%{
name: "prusa-mk4",
serial: "1234567890",
api_version: 1,
capabilities: %{"upload-by-put" => true},
nozzle: 0.4,
mmu: false
}