feat: Planar Clarity Video Wall#65
Conversation
|
Having a quick read now. To provide some further reading on TL;DR it can be used as a continent way to forward an arbitrary set of keyword arguments around. It was used a lot in the previous Ruby drivers, but would recommend avoiding it unless absolutely needed here as it can lead to some sloppy type signatures. |
| @@ -0,0 +1,10 @@ | |||
| DriverSpecs.mock_driver "Planar::ClarityMatrix" do | |||
| # on connect it should do_poll the device | |||
| should_send("op A1 display.power ? \r") | |||
There was a problem hiding this comment.
When writing specs, you also want to mock mock the device responses so that you test full request -> response behaviour. For some info on this, see: https://github.com/PlaceOS/drivers/blob/master/docs/writing-a-spec.md#testing-streaming-io.
Hi @kimburgess , upon going through this comment I thought it'd be a good idea to implement and queue's method is defined in which disallows anything but splats and NamedTuple in the argument. |
There was a problem hiding this comment.
I've had a look through and have picked up some things on style/feedback that @kimburgess has given me previously. There are probably other things I have missed or not knowledgable enough to give feedback on so best to reach out to @kimburgess for further feedback but this should hopefully be a good start of some things to look out for :)
|
|
||
| protected def do_poll | ||
| power? | ||
| input_status if self["power"] == "ON" |
There was a problem hiding this comment.
self[:power] will be of type JSON::Any so this should be changed to:
input_status if self[:power]?&.try as_bool
I've noticed this is necessary in order to use self values that are of type Bool properly in conditional statements.
Explanation of why this is needed is here #19 (comment) and is probably to do with how crystal deals with truthy/falsy values
There was a problem hiding this comment.
self[:key] will return an error if the key does not exist while self[:key]? will return nil so is safer to use generally.
.try is a safe way to deal with objects that may be nil https://crystal-lang.org/api/0.35.1/Object.html#try(&)-instance-method
as_bool https://crystal-lang.org/api/0.19.4/JSON/Any.html#as_bool%3ABool-instance-method is necessary in order to convert self[:power] which is of type JSON::Any to type Bool so it behaves as expected in conditional statements
| send "op ** slot.recall #{preset} \r", name: :recall | ||
| end | ||
|
|
||
| def input_status |
There was a problem hiding this comment.
I think this should be renamed to input? to keep it consistent with power? but @kimburgess can probably better comment on this
improved proxy support
…t makes the upstream api respond much faster for some reason
introduces more flexible proxy configuration
to provide DNA spaces dashboard with status of the streams being consumed
by an admin, mostly for testing
to support user login scripts
* feat(sharp_pn): initial commit * feat(sharp_pn): port over rest of driver * feat(sharp_pn): add basic spec * feat(sharp_pn): add spec for do_poll * feat(sharp_pn): add delay/timeout for commands * fix(sharp_pn): remove debugging * chore(sharp_pn): crystal tool format
* feat(lg): initial commit * feat(lg): add more methods * feat(lg): add delay to some commands * feat(lg): add cases on data receive * fix(lg): handle commands that use the same value * fix(lg): use safe self getter * feat(lg): add specs for connected/do_poll * feat(lg): add specs for power on/off * fix(lg): use string form for query in specs * feat(lg): group similar response behaviour * chore(nec): add comments for Command1 * feat(lg): add test for input switching * chore(lg): use warn instead of debug level logging Co-authored-by: Kim Burgess <kim@place.technology> * fix(lg): clear queue after hard_off Co-authored-by: Kim Burgess <kim@place.technology> * refactor(lg): use send and callback * fix(lg): move connected to instance var * fix(lg): update connected state * chore(lg): run crystal format * feat(lg ls5): implement minimal mute interface requirement Co-authored-by: Philip Kheav <pkheav@Philips-MacBook-Pro.local> Co-authored-by: Kim Burgess <kim@place.technology> Co-authored-by: Stephen von Takach <steve@vontaka.ch>
* wip: epson projector conversion from ruby * --no-edit * wip * wip * docker-compose up --build not working * wip * fix(epson_proj): make compilable * fix(epson_proj): use MuteLayer enum * feat(epson_proj): add working send * fix(epson_proj): use Array to store errors * feat(epson_proj): add specs for do_poll * feat(epson_proj): add more specs * fix(epson_proj): store commands in hash * fix(epson_proj): move unmute_volume to instance var * feat(epson projector): simplify mute interface crystal tool format Co-authored-by: PlaceOS <support@place.technology> Co-authored-by: Philip Kheav <philip.kheav@hotmail.com> Co-authored-by: Stephen von Takach <steve@vontaka.ch>
* fix(vergesense): Type of Space.People.coordinates * style(vergesense): whitespace
* fix(vergesense): Type of Space.People.coordinates * style(vergesense): whitespace * fix(vergesense): Null space_ref_id seen in the wild
before requesting sensor data
was previously looking for location objects for map details
use locker key as the primary method for accessing lockers
* feat(svsi): port decoder driver * feat(svsi): port encoder driver * fix(svsi): minor changes * feat(svsi): port n_series_switcher * feat(svsi_virtual_switcher): attempt to port * fix(svsi): use correct variable name * fix(svsi_virtual_switcher): use blocks * fix(svsi_n_series): downcase property * feat(svsi_virtual_switcher): implement Switchable * fix(svsi_virtual_switcher): make types clearer * feat(svsi_virtual_switcher): implement switch_to * fix(svsi): implement more interfaces * fix(svsi_virtual_switcher): decoder switch_to * fix(svsi_virtual_switcher): use switch_to * fix(svsi_virtual_switcher): workaround for int key * fix(svsi_virtual_switcher): use correct indexes * fix(svsi_virtual_switcher): use Int32 for input * chore(svsi): clearly define delimiter Co-authored-by: Caspian Baska <caspian@place.tech> * style(svsi): run formatter * fix(svsi): use delimiter directly * refactor(svsi:decoder): use mapped_enum for commands * refactor(svsi): ensure exhaustive case * fix(svsi): construct do_send args * fix(svsi): fix do_send Co-authored-by: Caspian Baska <caspian@place.tech> Co-authored-by: Caspian Baska <email@caspian.computer>
First attempt
Resolves #59
some confusion with options / **options