When possible record the name of the user that requested the
job. The klippy_api's component now takes an optional user
argument in its "start_print" method. This user is broadcast
in an event after a print request successfully returns.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The default behavior of the subscribe API shares all subscription
requests. API Transports require their own subscription. Add
a method to facilitate this request.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This change refactors the APIDefiniton into a dataclass, allowing
defs to be shared directly among HTTP and RPC requests. In
addition, all transports now share one instance of JSONRPC,
removing duplicate registration. API Defintiions are registered
with the RPC Dispatcher, and it validates the Transport type.
In addition tranports may perform their own validation prior
to request execution.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Emit a single event where the first argument contains
a "JobEvent" enumeration that describes the particular
event. This reduces the number of callbacks registered
by JobState consumers and allows them react to multiple
state changes in the same callback.
The individual events remain for compatibility, however
they are deprecated. Current modules should be updated
to use the "job_state:state_changed" event and new modules
must use this event.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The url received from SimplyPrint should already be escaped. It
isn't possibly to reliably quote a full url if any of the parts contain
special characters.
This commit also corrects some minor type checking issues.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Separate out code that applies to both standard websockets and the
future unix socket implementation.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Klipper now has the ability to report the current layer on
properly configured slicers. Prefer this value if available,
otherwise fall back to layer detection.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Users may specify a dedicated ambient sensor in the
[simplyprint] configuration. If the specified sensor is
invalid or no sensor is specified ambient detection
will fall back to an estimate using the extruder.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Its possible for the websocket client to disconnect before
read_message() returns None. Await all calls to write_message()
to handle websocket closed exceptions.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This adds initial support for connecting Moonraker to the SimplyPrint
service. Currently the connection defaults to SimplyPrint's dev/test
endpoint, this will be changed prior to official release.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>