Closed ewilken closed 2 years ago
This aims to improve the API of characteristics, services and accessories to be able to create custom instances of them.
HapCharacteristic
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>);
Characteristic<T>
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>);
HapService
fn set_id(&mut self, id: u64); fn set_type(&mut self, hap_type: HapType);
Custom(Uuid)
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.
custom_characteristics_services_accessories
custom_multi_sensor
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
traitNew methods on the
Characteristic<T>
structNew methods on the
HapService
traitNew
Custom(Uuid)
option onHapType
According to Apple, custom service and characteristic types must be identified by custom UUIDs. The new
Custom(Uuid)
option on theHapType
enum allows for that.New examples
custom_characteristics_services_accessories
custom_multi_sensor