diff --git a/Cargo.toml b/Cargo.toml index a1252db5..3ba0156c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ bytes = "1.0" chacha20poly1305 = "0.8" ed25519-dalek = { version = "1.0", features = ["std", "serde"] } erased-serde = "0.3" -eui48 = { version = "1.0", features = ["serde"] } +macaddr = { version = "1.0.1", features = ["serde"] } futures = "0.3" get_if_addrs = "0.5" hkdf = "0.11" diff --git a/codegen/src/main.rs b/codegen/src/main.rs index 1cca618e..4e3ab0d8 100644 --- a/codegen/src/main.rs +++ b/codegen/src/main.rs @@ -1274,7 +1274,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: \"Acme {{service.DefaultDescription}}\".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: {{category service.DefaultDescription}}, ..Default::default() }; diff --git a/examples/adding_accessories_dynamically.rs b/examples/adding_accessories_dynamically.rs index 49792ee5..8b32153f 100644 --- a/examples/adding_accessories_dynamically.rs +++ b/examples/adding_accessories_dynamically.rs @@ -33,7 +33,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Bridge".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Bridge, ..Default::default() }; diff --git a/examples/air_purifier.rs b/examples/air_purifier.rs index 37e6b4be..7b0c34d5 100644 --- a/examples/air_purifier.rs +++ b/examples/air_purifier.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Air Purifier".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::AirPurifier, ..Default::default() }; diff --git a/examples/air_quality_sensor.rs b/examples/air_quality_sensor.rs index 9f7c8c54..77f3007e 100644 --- a/examples/air_quality_sensor.rs +++ b/examples/air_quality_sensor.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Air Quality Sensor".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Sensor, ..Default::default() }; diff --git a/examples/async_callbacks.rs b/examples/async_callbacks.rs index c04aa75c..f84fd5e6 100644 --- a/examples/async_callbacks.rs +++ b/examples/async_callbacks.rs @@ -49,7 +49,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Lightbulb".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Lightbulb, ..Default::default() }; diff --git a/examples/bridged_accessories.rs b/examples/bridged_accessories.rs index b4e7ff49..594e90d3 100644 --- a/examples/bridged_accessories.rs +++ b/examples/bridged_accessories.rs @@ -73,7 +73,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Bridge".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Bridge, ..Default::default() }; diff --git a/examples/callbacks.rs b/examples/callbacks.rs index bce85e16..4d922ecf 100644 --- a/examples/callbacks.rs +++ b/examples/callbacks.rs @@ -42,7 +42,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Lightbulb".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Lightbulb, ..Default::default() }; diff --git a/examples/carbon_dioxide_sensor.rs b/examples/carbon_dioxide_sensor.rs index 4d7671e6..89006f7f 100644 --- a/examples/carbon_dioxide_sensor.rs +++ b/examples/carbon_dioxide_sensor.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Carbon dioxide Sensor".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Sensor, ..Default::default() }; diff --git a/examples/carbon_monoxide_sensor.rs b/examples/carbon_monoxide_sensor.rs index c4b3a8c8..5b27d53e 100644 --- a/examples/carbon_monoxide_sensor.rs +++ b/examples/carbon_monoxide_sensor.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Carbon monoxide Sensor".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Sensor, ..Default::default() }; diff --git a/examples/contact_sensor.rs b/examples/contact_sensor.rs index f91c79dd..dabe9440 100644 --- a/examples/contact_sensor.rs +++ b/examples/contact_sensor.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Contact Sensor".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Sensor, ..Default::default() }; diff --git a/examples/cooler.rs b/examples/cooler.rs index d7957b2e..38810c32 100644 --- a/examples/cooler.rs +++ b/examples/cooler.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Cooler".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::AirConditioner, ..Default::default() }; diff --git a/examples/custom_characteristics_services_accessories.rs b/examples/custom_characteristics_services_accessories.rs index 38098e47..2e806b58 100644 --- a/examples/custom_characteristics_services_accessories.rs +++ b/examples/custom_characteristics_services_accessories.rs @@ -240,7 +240,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Foo".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Other, ..Default::default() }; diff --git a/examples/custom_multi_sensor.rs b/examples/custom_multi_sensor.rs index 411ce4aa..462f1400 100644 --- a/examples/custom_multi_sensor.rs +++ b/examples/custom_multi_sensor.rs @@ -111,7 +111,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Temperature & Humidity Sensor".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Sensor, ..Default::default() }; diff --git a/examples/dehumidifier.rs b/examples/dehumidifier.rs index f873174d..8b9dae26 100644 --- a/examples/dehumidifier.rs +++ b/examples/dehumidifier.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Dehumidifier".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::AirDehumidifier, ..Default::default() }; diff --git a/examples/door.rs b/examples/door.rs index dbe3c6c7..699bead2 100644 --- a/examples/door.rs +++ b/examples/door.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Door".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Door, ..Default::default() }; diff --git a/examples/fan.rs b/examples/fan.rs index b6dc0ee5..9cd30280 100644 --- a/examples/fan.rs +++ b/examples/fan.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Fan".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Fan, ..Default::default() }; diff --git a/examples/fan_v2.rs b/examples/fan_v2.rs index 1d7f7d31..1d56d0f6 100644 --- a/examples/fan_v2.rs +++ b/examples/fan_v2.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Fan v2".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Fan, ..Default::default() }; diff --git a/examples/faucet.rs b/examples/faucet.rs index bfd0c3a1..9179c234 100644 --- a/examples/faucet.rs +++ b/examples/faucet.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Faucet".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Faucet, ..Default::default() }; diff --git a/examples/garage_door_opener.rs b/examples/garage_door_opener.rs index 1a60c393..7a562cac 100644 --- a/examples/garage_door_opener.rs +++ b/examples/garage_door_opener.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Garage Door Opener".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::GarageDoorOpener, ..Default::default() }; diff --git a/examples/heater.rs b/examples/heater.rs index fc342d6f..99dea92c 100644 --- a/examples/heater.rs +++ b/examples/heater.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Heater".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::AirHeater, ..Default::default() }; diff --git a/examples/humidifier.rs b/examples/humidifier.rs index c94c43d2..a11fb288 100644 --- a/examples/humidifier.rs +++ b/examples/humidifier.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Humidifier-Dehumidifier".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::AirDehumidifier, ..Default::default() }; diff --git a/examples/humidity_sensor.rs b/examples/humidity_sensor.rs index 62a4783c..37fdd028 100644 --- a/examples/humidity_sensor.rs +++ b/examples/humidity_sensor.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Humidity Sensor".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Sensor, ..Default::default() }; diff --git a/examples/irrigation_system.rs b/examples/irrigation_system.rs index e5f2ddc2..2535aa89 100644 --- a/examples/irrigation_system.rs +++ b/examples/irrigation_system.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Irrigation-System".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Sprinkler, ..Default::default() }; diff --git a/examples/leak_sensor.rs b/examples/leak_sensor.rs index 27b43fc6..5207a101 100644 --- a/examples/leak_sensor.rs +++ b/examples/leak_sensor.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Leak Sensor".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Sensor, ..Default::default() }; diff --git a/examples/light_sensor.rs b/examples/light_sensor.rs index f863b34b..0810aa15 100644 --- a/examples/light_sensor.rs +++ b/examples/light_sensor.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Light Sensor".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Sensor, ..Default::default() }; diff --git a/examples/lightbulb.rs b/examples/lightbulb.rs index 43e56d67..bbce9f4b 100644 --- a/examples/lightbulb.rs +++ b/examples/lightbulb.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Lightbulb".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Lightbulb, ..Default::default() }; diff --git a/examples/lock.rs b/examples/lock.rs index ea8feb88..bcbbdda8 100644 --- a/examples/lock.rs +++ b/examples/lock.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Lock".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::DoorLock, ..Default::default() }; diff --git a/examples/motion_sensor.rs b/examples/motion_sensor.rs index b90cf157..e1e344a2 100644 --- a/examples/motion_sensor.rs +++ b/examples/motion_sensor.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Motion Sensor".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Sensor, ..Default::default() }; diff --git a/examples/occupancy_sensor.rs b/examples/occupancy_sensor.rs index f24dd4fc..510f0493 100644 --- a/examples/occupancy_sensor.rs +++ b/examples/occupancy_sensor.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Occupancy Sensor".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Sensor, ..Default::default() }; diff --git a/examples/outlet.rs b/examples/outlet.rs index af3748be..8f54f24a 100644 --- a/examples/outlet.rs +++ b/examples/outlet.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Outlet".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Outlet, ..Default::default() }; diff --git a/examples/security_system.rs b/examples/security_system.rs index 5cd0ef02..09824d58 100644 --- a/examples/security_system.rs +++ b/examples/security_system.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Security System".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::SecuritySystem, ..Default::default() }; diff --git a/examples/setting_values_after_server_start.rs b/examples/setting_values_after_server_start.rs index d39dcc1d..31babca8 100644 --- a/examples/setting_values_after_server_start.rs +++ b/examples/setting_values_after_server_start.rs @@ -31,7 +31,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Sensor".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 63]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 63]), category: AccessoryCategory::Sensor, ..Default::default() }; diff --git a/examples/shower_head.rs b/examples/shower_head.rs index aa1651e1..5af9efdd 100644 --- a/examples/shower_head.rs +++ b/examples/shower_head.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Shower Head".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::ShowerHead, ..Default::default() }; diff --git a/examples/smart_speaker.rs b/examples/smart_speaker.rs index 04a79413..faa83575 100644 --- a/examples/smart_speaker.rs +++ b/examples/smart_speaker.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Smart Speaker".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Speaker, ..Default::default() }; diff --git a/examples/smoke_sensor.rs b/examples/smoke_sensor.rs index fa4e53a8..622d5c74 100644 --- a/examples/smoke_sensor.rs +++ b/examples/smoke_sensor.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Smoke Sensor".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Sensor, ..Default::default() }; diff --git a/examples/stateful_programmable_switch.rs b/examples/stateful_programmable_switch.rs index b63f2be4..6092926b 100644 --- a/examples/stateful_programmable_switch.rs +++ b/examples/stateful_programmable_switch.rs @@ -33,7 +33,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Stateful Programmable Switch".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::ProgrammableSwitch, ..Default::default() }; diff --git a/examples/stateless_programmable_switch.rs b/examples/stateless_programmable_switch.rs index 53837bd9..b7540e32 100644 --- a/examples/stateless_programmable_switch.rs +++ b/examples/stateless_programmable_switch.rs @@ -33,7 +33,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Stateless Programmable Switch".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::ProgrammableSwitch, ..Default::default() }; diff --git a/examples/storing_arbitrary_bytes.rs b/examples/storing_arbitrary_bytes.rs index 454ccc39..eca24e40 100644 --- a/examples/storing_arbitrary_bytes.rs +++ b/examples/storing_arbitrary_bytes.rs @@ -38,7 +38,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Stateful Lightbulb".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Lightbulb, ..Default::default() }; diff --git a/examples/switch.rs b/examples/switch.rs index 6d7d7243..7855e9cf 100644 --- a/examples/switch.rs +++ b/examples/switch.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Switch".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Switch, ..Default::default() }; diff --git a/examples/television.rs b/examples/television.rs index 0dc2dac8..262da861 100644 --- a/examples/television.rs +++ b/examples/television.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Television".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Television, ..Default::default() }; diff --git a/examples/temperature_sensor.rs b/examples/temperature_sensor.rs index 993371f6..80502abf 100644 --- a/examples/temperature_sensor.rs +++ b/examples/temperature_sensor.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Temperature Sensor".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Sensor, ..Default::default() }; diff --git a/examples/thermostat.rs b/examples/thermostat.rs index ba4737a8..2b217997 100644 --- a/examples/thermostat.rs +++ b/examples/thermostat.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Thermostat".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Thermostat, ..Default::default() }; diff --git a/examples/wi_fi_router.rs b/examples/wi_fi_router.rs index f32ccbee..7d01feb1 100644 --- a/examples/wi_fi_router.rs +++ b/examples/wi_fi_router.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Wi-Fi Router".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::WiFiRouter, ..Default::default() }; diff --git a/examples/wi_fi_satellite.rs b/examples/wi_fi_satellite.rs index 5411b86e..8686815d 100644 --- a/examples/wi_fi_satellite.rs +++ b/examples/wi_fi_satellite.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Wi-Fi Satellite".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::WiFiRouter, ..Default::default() }; diff --git a/examples/window.rs b/examples/window.rs index 56b1e044..b8fcc09d 100644 --- a/examples/window.rs +++ b/examples/window.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Window".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::Window, ..Default::default() }; diff --git a/examples/window_covering.rs b/examples/window_covering.rs index fb2a1aca..1a706f57 100644 --- a/examples/window_covering.rs +++ b/examples/window_covering.rs @@ -29,7 +29,7 @@ async fn main() -> Result<()> { let config = Config { pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, name: "Acme Window Covering".into(), - device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), category: AccessoryCategory::WindowCovering, ..Default::default() }; diff --git a/src/config.rs b/src/config.rs index b945f99f..4a7be014 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,5 +1,6 @@ use ed25519_dalek::Keypair as Ed25519Keypair; -use eui48::MacAddress; +//use eui48::MacAddress; +use macaddr::MacAddr6 as MacAddress; use rand::{rngs::OsRng, Rng}; use serde::{Deserialize, Serialize}; use std::net::IpAddr; @@ -16,7 +17,7 @@ use crate::{accessory::AccessoryCategory, BonjourFeatureFlag, BonjourStatusFlag, /// let config = Config { /// pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3]).unwrap(), /// name: "Acme Lightbulb".into(), -/// device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), +/// device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), /// category: AccessoryCategory::Lightbulb, /// ..Default::default() /// }; @@ -78,7 +79,7 @@ impl Config { [ format!("c#={}", self.configuration_number), format!("ff={}", self.feature_flag as u8), - format!("id={}", self.device_id.to_hex_string()), + format!("id={}", self.device_id.to_string()), format!("md={}", self.name), format!("pv={}", self.protocol_version), format!("s#={}", self.state_number), @@ -113,7 +114,7 @@ impl Default for Config { fn generate_random_mac_address() -> MacAddress { let mut csprng = OsRng {}; let eui = csprng.gen::<[u8; 6]>(); - MacAddress::new(eui) + MacAddress::from(eui) } /// Generates an Ed25519 keypair. diff --git a/src/error.rs b/src/error.rs index 8f16cf5e..053313a1 100644 --- a/src/error.rs +++ b/src/error.rs @@ -56,7 +56,7 @@ pub enum Error { #[error("UTF-8 Error: {0}")] Utf8(#[from] str::Utf8Error), #[error("Parse EUI-48 Error: {0}")] - ParseEui48(#[from] eui48::ParseError), + ParseEui48(#[from] macaddr::ParseError), #[error("Parse Int Error: {0}")] ParseInt(#[from] num::ParseIntError), #[error("MPSC Send Error: {0}")] diff --git a/src/lib.rs b/src/lib.rs index be622229..c1233860 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,6 @@ pub use ed25519_dalek::Keypair as Ed25519Keypair; -pub use eui48::MacAddress; pub use futures; +pub use macaddr::MacAddr6 as MacAddress; pub use serde_json; pub use crate::{ diff --git a/src/server/ip.rs b/src/server/ip.rs index 52254ab2..9435f4c8 100644 --- a/src/server/ip.rs +++ b/src/server/ip.rs @@ -65,7 +65,7 @@ impl IpServer { /// let config = Config { /// pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?, /// name: "Acme Lightbulb".into(), - /// device_id: MacAddress::new([10, 20, 30, 40, 50, 60]), + /// device_id: MacAddress::from([10, 20, 30, 40, 50, 60]), /// category: AccessoryCategory::Lightbulb, /// ..Default::default() /// }; diff --git a/src/transport/http/handler/pair_setup.rs b/src/transport/http/handler/pair_setup.rs index e9fe1a10..69545285 100644 --- a/src/transport/http/handler/pair_setup.rs +++ b/src/transport/http/handler/pair_setup.rs @@ -321,7 +321,7 @@ async fn handle_exchange( )?; let config = config.lock().await; - let device_id = config.device_id.to_hex_string(); + let device_id = config.device_id.to_string(); let mut accessory_info: Vec = Vec::new(); accessory_info.extend(&accessory_x); diff --git a/src/transport/http/handler/pair_verify.rs b/src/transport/http/handler/pair_verify.rs index a2a19fb4..752d60ca 100644 --- a/src/transport/http/handler/pair_verify.rs +++ b/src/transport/http/handler/pair_verify.rs @@ -137,7 +137,7 @@ async fn handle_start( let shared_secret = b.diffie_hellman(&a_pub); let config = config.lock().await; - let device_id = config.device_id.to_hex_string(); + let device_id = config.device_id.to_string(); let mut accessory_info: Vec = Vec::new(); accessory_info.extend(b_pub.as_bytes());