Commit Graph

48 Commits

Author SHA1 Message Date
Gregg 6ff86345c9 update 2024-01-21 15:40:41 -06:00
Gregg 769de582fb update 2024-01-21 14:18:41 -06:00
Gregg 0a00c27d64 update 2024-01-21 12:46:01 -06:00
Gregg d023bdbfda update 2024-01-21 11:54:13 -06:00
Gregg 358ea3a371 Update Span.h 2024-01-20 22:55:18 -06:00
Gregg 87b7ebf095 update 2024-01-20 22:51:52 -06:00
Gregg 8cae896273 update 2024-01-20 19:14:11 -06:00
Gregg 348232a663 update 2024-01-20 16:43:17 -06:00
Gregg 97afdcd555 update 2024-01-19 18:03:09 -06:00
Gregg c5a30ebedf update 2024-01-19 17:33:41 -06:00
Gregg 1aa8dede6b update 2024-01-19 14:32:00 -06:00
Gregg 83ad277aa0 Addressed issue with new Characteristic enum constants 2023-11-26 18:19:36 -06:00
Gregg ead05d8690 Added Characteristic Constants
Added constants to Characteristics that describe states.

Example: Characteristic::SecuritySystemTargetState::ARM_STAY
2023-11-25 18:22:59 -06:00
Gregg 98d6abeb1f Changed storage of required and optional Characteristics from unordered_set to vector
Significantly reduces memory usage - unordered_sets take up much more memory and using std::find from <algorithm> is as efficient as using find() method of an unordered_set.

To do: Remove all uses of unordered_set across HomeSpan wherever possible
2023-11-12 09:48:46 -06:00
Gregg 69af3d59a3 Replaced Service definitions with macros CREATE_SERV and END_SERV
This has no effect on the code but the names of the macros can be used as flags for an external script to autogenerate documentation in the form of a list of all services and characteristics supported by HomeSpan
2023-02-16 07:23:22 -06:00
Gregg 0ecaf2ee7f Add CUSTOM_CHAR_HEADER logic
used to include custom Characteristics in a common header without redefining.
2023-02-12 13:24:19 -06:00
Gregg 88897ee085 Updated copyright dates on source code 2023-02-04 11:41:57 -06:00
Gregg 3cb8d27342 Added CUSTOM_CHAR_DATA() macro
Similar to CUSTOM_CHAR_STRING() macro, but does not include a parameter to set the default value (since the user can type an invalid string).  Instead, user setData after creating the Characteristic as needed.
2023-01-01 15:08:34 -06:00
Gregg 72b4ece64d Added DATA format
Includes 3 new methods: getData(), getNewData(), and setData()
2023-01-01 11:33:50 -06:00
Gregg 3fae9c24a9 Updated Television Characteristics
Removed Mute, Active, and Volume since they don't appear to do anything.
2022-12-23 18:39:14 -06:00
Gregg 7939624bf7 Added Service::TelevisionSpeaker
Also updated Television Example.  Volume buttons on remote now function as expected, though there does not seems to be a mute button
2022-12-23 16:51:55 -06:00
Gregg 3e88d69997 Added optional AccessoryFlags Characteristic to AccessoryInformation Service
This optional flag does not seem to have any affect on the Home App and does not produce any messages indicating that the device needs additional setup.  Was hopeful this would have prevented the "Not Supported" message on a Home App Tile that is configured as a bridge, but without any other Accessories.
2022-08-08 05:56:11 -05:00
Gregg 9f71c67f14 Updated logic for required/optional Characteristics
Logic now embedded in 'i' CLI command.
2022-04-30 22:20:42 -05:00
Gregg 0507f26b13 Updated "Other Examples" and added SPAN_ACCESSORY() Macro
Need to revisit Television sketch - the latest iOS seemed to have disabled the ability to dynamically set visibility of input sources.  Checking/Un-Checking the visibility radio buttons either during pairing, or after pairing on the settings screen, seems to be ignored by the Home App (the same input sources are shown in the selector regardless of any changes made).  However, dynamically changing the name of an input source seems to work fine.
2022-04-16 15:21:13 -05:00
Gregg 98f812ba0c Updating examples 1-7 to conform with latest iOS changes 2022-04-04 06:13:30 -05:00
Gregg 170e0b61b1 Add new macro CUSTOM_SERV() to created custom services
Also, updated error checking so that the UUID for both custom Services and custom Characteristics are checked for syntax.  A fatal error is thrown if an ill-formatted UUID is found, since this will definitely prevent pairing with the HomeApp.

The UUID for HAP Services and Characteristics are NOT error checked, since these are fixed in HomeSpan.

Also, the custom Characteristics are not validated against the optional list for a service.  If the user adds a custom Characteristic to a HAP Service, it is assumed to be valid.  Similarly, none of the Characteristics (HAP of Custom) in a Custom Service are validated at all.
2022-02-27 09:51:27 -06:00
Gregg 02d841390c Updated License Dates 2022-02-20 13:05:03 -06:00
Gregg a872111743 Fixed bug in CUSTOM_CHAR() when applied to STRING Characteristic
Created a new CUSTOM_CHAR_STRING(NAME,UUID,PERMISISONS,DEFVAL) macro specifically for STRING Characteristics
2021-12-03 07:02:25 -06:00
Gregg b5f4592b29 Removed Characteristic::ConfiguredNameStatic() end updated Television Example
Characteristic::ConfiguredNameStatic() is no longer needed since you can now change permissions on ConfiguredStatic to remove PW with removePerms(PW).  Updated Television Example accordingly.

To Do:  Add getLinks() and setPerms/addPerms/removePerms to API Reference Documentation
2021-11-10 05:54:19 -06:00
HomeSpan 08c92f8eb0 Update Span.h
Make Characteristic::Identifier required for Service::InputSource
2021-10-31 17:20:56 -05:00
Gregg 226548defa Added check to ensure Custom Characteristic has valid UUID
And also converted ERRORS to WARNINGS when a Characteristic that is not in the REQ or OPT list is specified for a Service.   This allows the user to add any Characteristic to any Service without forcing an Error (just a Warning).
2021-10-29 22:54:10 -05:00
Gregg b6001f9418 Update Span.h 2021-10-25 21:58:51 -05:00
Gregg eb9530800e Created typedef for HAP types - used to simplify CUSTOM_CHAR
No need to specify both FORMAT and TYPE.   For example, specifying UINT16 automatically sets type to be uint16_t.

To do:  Explore if this can be used for standard Characteristics - revisit standard Characteristics definitions and structure to see if it can be simplified.
2021-10-25 21:57:29 -05:00
Gregg 4309be8f91 Finalized CUSTOM_CHAR() macro to add a custom Characteristic 2021-10-24 21:19:38 -05:00
Gregg 37e0486cf7 Removed all unusable TV Characteristics from TV and Input Source Services
But retained the actual Characteristics in the Characteristics lists in the event that they may be activated in the Home App in the future.
2021-10-23 22:58:16 -05:00
Gregg 8a24819955 Added Characteristic::ConfiguredNameStatic()
This "custom" Characteristic is identical to ConfiguredName() but only allows paired-read and notifications.  By excluding paired-write it prevents the user from editing the name of a TV input source from the Home App.  This is useful when some sources are fixed, such as "netflix" instead of generic, such as "hdmi 1".
2021-10-22 06:35:33 -05:00
Gregg d4603df58d Creating Television Example 2021-10-20 06:15:12 -05:00
Gregg f07fa4e9c7 Testing TV functions 2021-10-17 22:02:11 -05:00
HomeSpan 353749baea
Merge pull request #121 from unreality/master
add support for Televisions
2021-10-17 16:10:50 -05:00
Gregg 6a74ce9283 Add setValidValues(int n, ...) method to Characteristic
Allows user to explicitly set the valid values for a Characteristic of type UINT8.  Throws an error if used with any other Characteristic type.
2021-09-05 08:54:34 -05:00
Raal Goff fc9714ed95 ConfiguredName is writeable, allow writes to string characteristics when they have write perms 2021-08-09 19:41:31 +08:00
Raal Goff 586f690727 increase allowed range for Identifier characteristic 2021-08-07 21:46:16 +08:00
Raal Goff 38457c2b72 add HAP Services and Characteristics for Televisions 2021-08-03 21:43:32 +08:00
Gregg f4c9c430ef Replace restore() method with second optional parameter when instantiating Characteristic
To enable save/restore for a Characteristic, set second parameter to TRUE when instantiating.  Since first parameter was optional as well, this requires setting it as well.

Next up:  Must add logic to setVal() to store new value as well.
2021-06-13 09:20:13 -05:00
Gregg 8121146c6b Changed ERROR to WARNING when a required Characteristic is missing
Only throw a non-fatal warning instead of a fatal error if a Service is missing a required Characteristic.  This allows for user flexibility in leaving out required Characteristics for Services that don't seem to need them (contrary to the HAP docs).

Also, changed PositionState Characteristic back to Required (instead of Optional) in WindowCovering Service (as specified by HAP).  If PositionState is not included this will only throw an error instead of a warning as a result of the above change.

To Do: Update Example 13 to properly incorporate PositionState Characteristic.
2021-03-09 20:33:54 -06:00
Gregg 7e3d982ee5 Added min/max Range defaults for all Characteristics
Also added new flag "staticRange" for all Characteristics that indicates whether the min/max range can be changed.  An ERROR will be thrown if setRange is attempted for a Characteristic having staticRange=true.
2021-03-05 22:34:55 -06:00
Gregg 5ca0bdc907 Added error checks to setVal()
Warning will be thrown if setVal() request is outside of mix/max range for the Characteristic, though min/max range not yet modified by SpanRange().

TO DO:  Create new Characteristic methods setRange(typename T_MIN, typename T_MAX) and setRange(typename T_MIN, typename T_MAX, typename T_STEP) that will reset min/max, or min/max/step, and trigger required output in database.  Add in checks to ensure setRange is NOT used to STRING or BOOLEAN.  Also add check to ensure STEP is always>0.  Add new UVAL for STEP that is normally zero, which indicates NO step size has been set (and does not need to be reported to database).   Then, set warnings about SpanRange being deprecated at some point in the future.
2021-03-01 09:09:24 -06:00
Gregg c8a2770253 Renamed Services.h to Span.h
Also, made it possible to use UVAL.set() for STRING Characteristic (upon initialization) but setVal() is NOT allowed.
2021-02-28 17:48:34 -06:00