Skip to content

Releases: ewilken/hap-rs

v0.1.0-pre.15

12 Aug 07:49
Compare
Choose a tag to compare
v0.1.0-pre.15 Pre-release
Pre-release
  • Change the signatures of the closures passed to OnUpdateFn, OnReadFuture and OnUpdateFuture from Fn to FnMut.

Thanks to @soundprojects!

v0.1.0-pre.14

25 Dec 23:56
Compare
Choose a tag to compare
v0.1.0-pre.14 Pre-release
Pre-release

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

28 Oct 21:14
Compare
Choose a tag to compare
v0.1.0-pre.13 Pre-release
Pre-release
  • Fix a wrong default of the AccessoryInformation struct resulting in an invalid accessory listing

v0.1.0-pre.12

28 Oct 12:55
Compare
Choose a tag to compare
v0.1.0-pre.12 Pre-release
Pre-release

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

24 Oct 20:58
Compare
Choose a tag to compare
v0.1.0-pre.11 Pre-release
Pre-release

Correct BonjourStatusFlag Behavior

  • After the first controller is paired, the Config's status_flag field is set to BonjourStatusFlag::Zero and the config update is immediately persisted to the Storage.
  • After the last controller is unpaired, the Config's status_flag field is set back to BonjourStatusFlag::NotPaired and the update is also immediately persisted to the Storage.
  • On every program start, the correctness of the Config's status_flag field is checked by counting the paired controllers and updated if incorrect. Counting the paired controllers correctly was previously prevented by a bug in FileStorage. That bug was fixed and a unit test covering CRD operations of Pairings was added.

v0.1.0-pre.10

12 Jul 13:27
Compare
Choose a tag to compare
v0.1.0-pre.10 Pre-release
Pre-release

Fallible characteristic read & update callbacks

  • return Results from OnReadFn, OnUpdateFn, OnReadFuture and OnUpdateFuture 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

11 Jul 17:13
Compare
Choose a tag to compare
v0.1.0-pre.9 Pre-release
Pre-release

Documentation

  • Cover all public modules of the crate with useful documentation.

v0.1.0-pre.8

11 Jul 14:54
Compare
Choose a tag to compare
v0.1.0-pre.8 Pre-release
Pre-release
  • 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

27 Jun 13:41
Compare
Choose a tag to compare
v0.1.0-pre.7 Pre-release
Pre-release

Dependency Updates

  • Upgrade tokio, hyper & libmdns
    • tokio 0.2 -> 1.7
    • hyper 0.13 -> 0.14
    • libmdns 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 the Config struct in favor of explicit host & port fields
  • Auto-determination now works with an IPv6 address too
  • Add redetermine_local_ip method to the Config 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 the Storage
  • 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 to AccessoryDatabase
  • Count pairings on IpServer creation and set config.status_flag accordingly

v0.1.0-pre.6

04 Jan 22:35
Compare
Choose a tag to compare
v0.1.0-pre.6 Pre-release
Pre-release
  • fix connections to multiple clients at once
  • fix a bug in EncryptedStream not always being woken properly

Thanks again to @Gaelan!