Releases: ewilken/hap-rs
v0.1.0-pre.15
- Change the signatures of the closures passed to
OnUpdateFn
,OnReadFuture
andOnUpdateFuture
fromFn
toFnMut
.
Thanks to @soundprojects!
v0.1.0-pre.14
Custom characteristics, services & accessories
This aims to improve the API of characteristics, services and accessories to be able to create custom instances of them.
New methods on the HapCharacteristic
trait
fn set_id(&mut self, id: u64);
fn set_type(&mut self, hap_type: HapType);
fn set_format(&mut self, format: Format);
fn set_perms(&mut self, perms: Vec<Perm>);
fn get_description(&self) -> Option<String>;
fn set_description(&mut self, description: Option<String>);
fn set_unit(&mut self, unit: Option<Unit>);
fn set_max_value(&mut self, max_value: Option<serde_json::Value>);
fn set_min_value(&mut self, min_value: Option<serde_json::Value>);
fn set_step_value(&mut self, step_value: Option<serde_json::Value>);
fn set_max_len(&mut self, max_len: Option<u16>);
fn get_max_data_len(&self) -> Option<u32>;
fn set_max_data_len(&mut self, max_data_len: Option<u32>);
fn get_valid_values(&self) -> Option<Vec<serde_json::Value>>;
fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()>;
fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]>;
fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()>;
fn get_ttl(&self) -> Option<u64>;
fn set_ttl(&mut self, ttl: Option<u64>);
fn get_pid(&self) -> Option<u64>;
fn set_pid(&mut self, pid: Option<u64>);
New methods on the Characteristic<T>
struct
pub fn new(id: u64, accessory_id: u64, hap_type: HapType, format: Format, perms: Vec<Perm>, description: Option<String>, event_notifications: Option<bool>, value: T, unit: Option<Unit>, max_value: Option<T>, min_value: Option<T>, step_value: Option<T>, max_len: Option<u16>, max_data_len: Option<u32>, valid_values: Option<Vec<T>>, valid_values_range: Option<[T; 2]>, ttl: Option<u64>, pid: Option<u64>) -> Self;
pub fn set_id(&mut self, id: u64);
pub fn set_type(&mut self, hap_type: HapType);
pub fn set_format(&mut self, format: Format);
pub fn set_perms(&mut self, perms: Vec<Perm>);
pub fn get_description(&self) -> Option<String>;
pub fn set_unit(&mut self, unit: Option<Unit>);
pub fn set_max_len(&mut self, val: Option<u16>);
pub fn get_max_data_len(&self) -> Option<u32>;
pub fn set_max_data_len(&mut self, val: Option<u32>);
pub fn get_valid_values(&self) -> Option<Vec<T>>;
pub fn set_valid_values(&mut self, val: Option<Vec<T>>);
pub fn get_valid_values_range(&self) -> Option<[T; 2]>;
pub fn set_valid_values_range(&mut self, val: Option<[T; 2]>);
pub fn get_ttl(&self) -> Option<u64>;
pub fn set_ttl(&mut self, val: Option<u64>);
pub fn get_pid(&self) -> Option<u64>;
pub fn set_pid(&mut self, val: Option<u64>);
New methods on the HapService
trait
fn set_id(&mut self, id: u64);
fn set_type(&mut self, hap_type: HapType);
New Custom(Uuid)
option on HapType
According to Apple, custom service and characteristic types must be identified by custom UUIDs. The new Custom(Uuid)
option on the HapType
enum allows for that.
New examples
custom_characteristics_services_accessories
custom_multi_sensor
v0.1.0-pre.13
- Fix a wrong default of the
AccessoryInformation
struct resulting in an invalid accessory listing
v0.1.0-pre.12
Extending the Storage
trait to be able to store arbitrary binary data
This adds 3 new functions to the Storage
trait to implement a basic binary KV storage:
async fn load_bytes(&self, key: &str) -> Result<Vec<u8>>;
async fn save_bytes(&mut self, key: &str, value: &[u8]) -> Result<()>;
async fn delete_bytes(&mut self, key: &str) -> Result<()>;
This is a breaking change to existing file storage due to the internal addition of subdirectories. It can be fixed by moving every <uuid>.json
in the current data
directory into data/pairings
.
This also adds a few unit tests to FileStorage
to ensure correct behavior.
Upgrade to Rust 2021
The Cargo.toml
is updated to edition = "2021"
now.
Codegen for iOS 15 & macOS 12
Codegen was done on macOS 12.0.1 to reflect characteristics and services for iOS 15 & macOS 12.
New characteristics
AccessCodeControlPoint
AccessCodeSupportedConfiguration
AirplayEnable
AssetUpdateReadiness
ConfigurationState
HardwareFinish
MultifunctionButton
NfcAccessControlPoint
NfcAccessSupportedConfiguration
SelectedDiagnosticsModes
SiriEnable
SiriEndpointSessionStatus
SiriEngineVersion
SiriLightOnUse
SiriListening
SiriTouchToUse
SupportedAssetTypes
SupportedDiagnosticsModes
Updated characteristics
LockCurrentState
LockTargetState
Removed characteristics
TunnelConnectionTimeout
TunneledAccessoryAdvertisingStatus
TunneledAccessoryConnectionStatus
TunneledAccessoryStateNumber
New services
AccessCode
AccessoryMetrics
AssetUpdate
Assistant
NfcAccessService
SiriEndpoint
Updated services (with additional characteristics)
AccessoryInformation
Diagnostics
Siri
SmartSpeaker
Removed services
Tunnel
Change to the crate's re-exports
tokio
isn't re-exported anymore.
v0.1.0-pre.11
Correct BonjourStatusFlag
Behavior
- After the first controller is paired, the
Config
'sstatus_flag
field is set toBonjourStatusFlag::Zero
and the config update is immediately persisted to theStorage
. - After the last controller is unpaired, the
Config
'sstatus_flag
field is set back toBonjourStatusFlag::NotPaired
and the update is also immediately persisted to theStorage
. - On every program start, the correctness of the
Config
'sstatus_flag
field is checked by counting the paired controllers and updated if incorrect. Counting the paired controllers correctly was previously prevented by a bug inFileStorage
. That bug was fixed and a unit test covering CRD operations ofPairing
s was added.
v0.1.0-pre.10
Fallible characteristic read & update callbacks
- return
Result
s fromOnReadFn
,OnUpdateFn
,OnReadFuture
andOnUpdateFuture
to be able to reflect errors getting and setting values from and to the real world to the requesting crontroller - update
tokio
dependency and remove unused feature flags
v0.1.0-pre.9
Documentation
- Cover all public modules of the crate with useful documentation.
v0.1.0-pre.8
- Change the internal code generation to generate characteristics and services from the
HomeKitDaemon.framework
on macOS instead of the Xcode HomeKit accessory simulator. - Generate all (currently working) characteristics as
Some
by default. - Test all examples and fix the accessories that weren't working (except for Wi-Fi Router and Wi-Fi Satellite, which seem to be broken by design).
New Accessories
- Faucet
- Irrigation System
- Shower Head
- Smart Speaker
- Stateful Programmable Switch
- Wi-Fi Router (currently unpairable without a 3rd party app)
- Wi-Fi Satellite (currently unpairable without a 3rd party app)
Removed (Broken) Accessories
- IP Camera
- Valve
- Video Doorbell
New Accessory Categories
- Range Extender
- Apple TV
- Speaker
- AirPort
- Wi-Fi Router
- Audio Receiver
- Television Set Top Box
- Television Streaming Stick
Renamed Accessory Categories
- Heater -> Air Heater
- Humidifier -> Air Humidifier
- Dehumidifier -> Air Dehumidifier
- Sprinklers -> Sprinkler
- Faucets -> Faucet
- Shower Systems -> Shower Head
- Remote Control -> Target Controller
All definitions were generated using macOS 11.2.3.
v0.1.0-pre.7
Dependency Updates
- Upgrade
tokio
,hyper
&libmdns
tokio
0.2 -> 1.7hyper
0.13 -> 0.14libmdns
0.2 -> 0.6
Bind Address Determination
- Use
get_if_addrs
to replace the previous, flawed method of getting a bind IP - Remove the
socket_addr
field from theConfig
struct in favor of explicithost
&port
fields - Auto-determination now works with an IPv6 address too
- Add
redetermine_local_ip
method to theConfig
struct and documentation about using it
mDNS Responder Configuration
- The mDNS responder is configured correctly now (instead of constantly being restarted)
- Connections to iOS controllers should be a lot more reliable now
Server-side AID Cache
- Cache AIDs as a
Vec<u64>
that gets persisted to theStorage
- The config number is now only increased when an accessory with a new AID is added to the server
Other
- Make the future returned from
IpServer::run_handle
fallible to be able to properly catch bind errors (and all the other ones) - Rename
AccessoryList
toAccessoryDatabase
- Count pairings on
IpServer
creation and setconfig.status_flag
accordingly
v0.1.0-pre.6
- fix connections to multiple clients at once
- fix a bug in
EncryptedStream
not always being woken properly
Thanks again to @Gaelan!