I hope adding more analogies doesn’t sidetrack the Topic, but this first major Capability addition seems to be stimulating conversation. I do cover some of this in my Guidelines Topic in this Category, and will be adding more.
And most of what I just wrote below was just better stated by JD as I was writing.
Ref:
So … I used “mouse” (mouse drivers that implement the interface/capability “mouse”) as my analogy, whereas JD used “printer drivers”. Same intention, same message.
Thanks, @JDRoberts!!!
-
Capabilities should (really, must) be the only way a SmartApp (or external application) can access a physical device for input and/or output. The Device Type handler “implements” the interface to the Capabilities, but should not expose anything that is not defined in the Capability.
-
The interface model is common to all HAL (hardware abstraction layer) architectures. On a PC, a “mouse” is an interface with certain capabilities. The applications which use a mouse don’t care what brand it is, or even if it is a trackball or some other weird implementation of mouse. The applications just know it has buttons and motion and perhaps a scroll-wheel.
-
There is no direct relationship between a mouse and the application. The mouse and the Pointer (cursor) are not a part of the same interface: They are, in fact, two distinct interfaces. The pointer, however, is a very useful interface that responds to applications that use the mouse, though other non-mouse applications can access it’s interface and move it around, change its appearance, etc.
-
Capability.alarm is like the pointer – it is a display (output) capability (as is capability.indicator).
-
Capability.urgentAlert is like a mouse – it is an input capability (as is capability.contactSensor).
-
Some Capabilities are input and output (Capability.switch is an “output” capability when you use Commands to turn the switch on/off; it is an “input” capability when it reports its current state (or state change) as on/off, and that state change could be initiated from a Command or from a physical action (pressing the button or wall switch or another remote).