[
  {
    "path": ".github/workflows/ci.yml",
    "content": "name: CI\n\non:\n  pull_request:\n  push:\n    branches:\n      - main\n\nenv:\n  RUST_BACKTRACE: 1\n\njobs:\n  style:\n    name: Check style\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v1\n      - name: Install Rust\n        uses: actions-rs/toolchain@v1\n        with:\n          profile: minimal\n          toolchain: nightly\n          override: true\n          components: rustfmt\n      - name: cargo fmt --check\n        uses: actions-rs/cargo@v1\n        with:\n          command: fmt\n          args: --all -- --check\n\n  test:\n    name: Test ${{ matrix.rust }} on ${{ matrix.os }}\n    needs: [style]\n    strategy:\n      matrix:\n        rust:\n          - stable\n          - beta\n          - nightly\n        os:\n          - ubuntu-latest\n          - windows-latest\n          - macOS-latest\n        include:\n          - rust: stable\n            features: ''\n          - rust: beta\n            features: ''\n          - rust: nightly\n            features: ''\n            benches: true\n    runs-on: ${{ matrix.os }}\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v1\n      - name: Install Rust (${{ matrix.rust }})\n        uses: actions-rs/toolchain@v1\n        with:\n          profile: minimal\n          toolchain: ${{ matrix.rust }}\n          override: true\n      - name: Build only\n        if: matrix.build-only\n        uses: actions-rs/cargo@v1\n        with:\n          command: build\n          args: ${{ matrix.features }}\n      - name: Test\n        if: matrix.build-only != true\n        uses: actions-rs/cargo@v1\n        with:\n          command: test\n          args: ${{ matrix.features }}\n      - name: Test all benches\n        if: matrix.benches && matrix.build-only != true\n        uses: actions-rs/cargo@v1\n        with:\n          command: test\n          args: --benches ${{ matrix.features }}\n\n  doc:\n    name: Build docs\n    needs: [style, test]\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v1\n      - name: Install Rust\n        uses: actions-rs/toolchain@v1\n        with:\n          profile: minimal\n          toolchain: stable\n          override: true\n      - name: cargo rustdoc -- -D rustdoc::broken_intra_doc_links\n        uses: actions-rs/cargo@v1\n        with:\n          command: rustdoc\n          args: -- -D rustdoc::broken_intra_doc_links\n"
  },
  {
    "path": ".gitignore",
    "content": "Cargo.lock\ntarget\ndata\n.DS_Store\n"
  },
  {
    "path": "Cargo.toml",
    "content": "[package]\nname = \"hap\"\nversion = \"0.1.0-pre.15\"\nauthors = [\"Elias Wilken <elias@wlkn.io>\"]\nedition = \"2021\"\ndescription = \"Rust implementation of the Apple HomeKit Accessory Protocol (HAP)\"\ndocumentation = \"https://docs.rs/hap\"\nreadme = \"README.md\"\nrepository = \"https://github.com/ewilken/hap-rs\"\nlicense = \"MIT/Apache-2.0\"\nkeywords = [\"apple\", \"homekit\"]\nexclude = [\n    \".github\",\n    \".gitignore\",\n    \"examples\",\n    \"LICENSE-APACHE\",\n    \"LICENSE-MIT\",\n    \"README.md\",\n    \"rls.toml\",\n    \"rustfmt.toml\",\n]\n\n[dependencies]\naead = \"0.4\"\nasync-trait = \"0.1\"\nbyteorder = \"1.3\"\nbytes = \"1.0\"\nchacha20poly1305 = \"0.8\"\ned25519-dalek = { version = \"1.0\", features = [\"std\", \"serde\"] }\nerased-serde = \"0.3\"\nmacaddr = { version = \"1.0.1\", features = [\"serde\"] }\nfutures = \"0.3\"\nget_if_addrs = \"0.5\"\nhkdf = \"0.11\"\nhyper = { version = \"0.14\", features = [\"server\", \"http1\"] }\nlibmdns = \"0.6\"\nlog = \"0.4\"\nnum = \"0.2\"\nrand = \"0.7\"\nserde = { version = \"1.0\", features = [\"rc\", \"derive\"] }\nserde_json = \"1.0\"\nsha2 = \"0.9\"\nsignature = \"1.1\"\nsrp = \"0.5\"\nthiserror = \"1.0\"\ntokio = \"1.8\"\nurl = \"2.1\"\nuuid = { version = \"0.8\", features = [\"v4\", \"serde\"] }\nx25519-dalek = \"0.6\"\n\n[build-dependencies]\nhandlebars = \"2.0\"\nserde = { version = \"1.0\", features = [\"derive\"] }\nserde_json = \"1.0\"\nuuid = { version = \"0.8\", features = [\"v4\", \"serde\"] }\n\n[dev-dependencies]\nenv_logger = \"0.8\"\nserde = { version = \"1.0\", features = [\"derive\"] }\ntokio = { version = \"1.8\", features = [\"rt-multi-thread\", \"time\", \"macros\"] }\n\n[workspace]\nmembers = [\"codegen\"]\n"
  },
  {
    "path": "LICENSE-APACHE",
    "content": "                              Apache License\n                        Version 2.0, January 2004\n                     http://www.apache.org/licenses/\n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n1. Definitions.\n\n   \"License\" shall mean the terms and conditions for use, reproduction,\n   and distribution as defined by Sections 1 through 9 of this document.\n\n   \"Licensor\" shall mean the copyright owner or entity authorized by\n   the copyright owner that is granting the License.\n\n   \"Legal Entity\" shall mean the union of the acting entity and all\n   other entities that control, are controlled by, or are under common\n   control with that entity. For the purposes of this definition,\n   \"control\" means (i) the power, direct or indirect, to cause the\n   direction or management of such entity, whether by contract or\n   otherwise, or (ii) ownership of fifty percent (50%) or more of the\n   outstanding shares, or (iii) beneficial ownership of such entity.\n\n   \"You\" (or \"Your\") shall mean an individual or Legal Entity\n   exercising permissions granted by this License.\n\n   \"Source\" form shall mean the preferred form for making modifications,\n   including but not limited to software source code, documentation\n   source, and configuration files.\n\n   \"Object\" form shall mean any form resulting from mechanical\n   transformation or translation of a Source form, including but\n   not limited to compiled object code, generated documentation,\n   and conversions to other media types.\n\n   \"Work\" shall mean the work of authorship, whether in Source or\n   Object form, made available under the License, as indicated by a\n   copyright notice that is included in or attached to the work\n   (an example is provided in the Appendix below).\n\n   \"Derivative Works\" shall mean any work, whether in Source or Object\n   form, that is based on (or derived from) the Work and for which the\n   editorial revisions, annotations, elaborations, or other modifications\n   represent, as a whole, an original work of authorship. For the purposes\n   of this License, Derivative Works shall not include works that remain\n   separable from, or merely link (or bind by name) to the interfaces of,\n   the Work and Derivative Works thereof.\n\n   \"Contribution\" shall mean any work of authorship, including\n   the original version of the Work and any modifications or additions\n   to that Work or Derivative Works thereof, that is intentionally\n   submitted to Licensor for inclusion in the Work by the copyright owner\n   or by an individual or Legal Entity authorized to submit on behalf of\n   the copyright owner. For the purposes of this definition, \"submitted\"\n   means any form of electronic, verbal, or written communication sent\n   to the Licensor or its representatives, including but not limited to\n   communication on electronic mailing lists, source code control systems,\n   and issue tracking systems that are managed by, or on behalf of, the\n   Licensor for the purpose of discussing and improving the Work, but\n   excluding communication that is conspicuously marked or otherwise\n   designated in writing by the copyright owner as \"Not a Contribution.\"\n\n   \"Contributor\" shall mean Licensor and any individual or Legal Entity\n   on behalf of whom a Contribution has been received by Licensor and\n   subsequently incorporated within the Work.\n\n2. Grant of Copyright License. Subject to the terms and conditions of\n   this License, each Contributor hereby grants to You a perpetual,\n   worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n   copyright license to reproduce, prepare Derivative Works of,\n   publicly display, publicly perform, sublicense, and distribute the\n   Work and such Derivative Works in Source or Object form.\n\n3. Grant of Patent License. Subject to the terms and conditions of\n   this License, each Contributor hereby grants to You a perpetual,\n   worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n   (except as stated in this section) patent license to make, have made,\n   use, offer to sell, sell, import, and otherwise transfer the Work,\n   where such license applies only to those patent claims licensable\n   by such Contributor that are necessarily infringed by their\n   Contribution(s) alone or by combination of their Contribution(s)\n   with the Work to which such Contribution(s) was submitted. If You\n   institute patent litigation against any entity (including a\n   cross-claim or counterclaim in a lawsuit) alleging that the Work\n   or a Contribution incorporated within the Work constitutes direct\n   or contributory patent infringement, then any patent licenses\n   granted to You under this License for that Work shall terminate\n   as of the date such litigation is filed.\n\n4. Redistribution. You may reproduce and distribute copies of the\n   Work or Derivative Works thereof in any medium, with or without\n   modifications, and in Source or Object form, provided that You\n   meet the following conditions:\n\n   (a) You must give any other recipients of the Work or\n       Derivative Works a copy of this License; and\n\n   (b) You must cause any modified files to carry prominent notices\n       stating that You changed the files; and\n\n   (c) You must retain, in the Source form of any Derivative Works\n       that You distribute, all copyright, patent, trademark, and\n       attribution notices from the Source form of the Work,\n       excluding those notices that do not pertain to any part of\n       the Derivative Works; and\n\n   (d) If the Work includes a \"NOTICE\" text file as part of its\n       distribution, then any Derivative Works that You distribute must\n       include a readable copy of the attribution notices contained\n       within such NOTICE file, excluding those notices that do not\n       pertain to any part of the Derivative Works, in at least one\n       of the following places: within a NOTICE text file distributed\n       as part of the Derivative Works; within the Source form or\n       documentation, if provided along with the Derivative Works; or,\n       within a display generated by the Derivative Works, if and\n       wherever such third-party notices normally appear. The contents\n       of the NOTICE file are for informational purposes only and\n       do not modify the License. You may add Your own attribution\n       notices within Derivative Works that You distribute, alongside\n       or as an addendum to the NOTICE text from the Work, provided\n       that such additional attribution notices cannot be construed\n       as modifying the License.\n\n   You may add Your own copyright statement to Your modifications and\n   may provide additional or different license terms and conditions\n   for use, reproduction, or distribution of Your modifications, or\n   for any such Derivative Works as a whole, provided Your use,\n   reproduction, and distribution of the Work otherwise complies with\n   the conditions stated in this License.\n\n5. Submission of Contributions. Unless You explicitly state otherwise,\n   any Contribution intentionally submitted for inclusion in the Work\n   by You to the Licensor shall be under the terms and conditions of\n   this License, without any additional terms or conditions.\n   Notwithstanding the above, nothing herein shall supersede or modify\n   the terms of any separate license agreement you may have executed\n   with Licensor regarding such Contributions.\n\n6. Trademarks. This License does not grant permission to use the trade\n   names, trademarks, service marks, or product names of the Licensor,\n   except as required for reasonable and customary use in describing the\n   origin of the Work and reproducing the content of the NOTICE file.\n\n7. Disclaimer of Warranty. Unless required by applicable law or\n   agreed to in writing, Licensor provides the Work (and each\n   Contributor provides its Contributions) on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n   implied, including, without limitation, any warranties or conditions\n   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n   PARTICULAR PURPOSE. You are solely responsible for determining the\n   appropriateness of using or redistributing the Work and assume any\n   risks associated with Your exercise of permissions under this License.\n\n8. Limitation of Liability. In no event and under no legal theory,\n   whether in tort (including negligence), contract, or otherwise,\n   unless required by applicable law (such as deliberate and grossly\n   negligent acts) or agreed to in writing, shall any Contributor be\n   liable to You for damages, including any direct, indirect, special,\n   incidental, or consequential damages of any character arising as a\n   result of this License or out of the use or inability to use the\n   Work (including but not limited to damages for loss of goodwill,\n   work stoppage, computer failure or malfunction, or any and all\n   other commercial damages or losses), even if such Contributor\n   has been advised of the possibility of such damages.\n\n9. Accepting Warranty or Additional Liability. While redistributing\n   the Work or Derivative Works thereof, You may choose to offer,\n   and charge a fee for, acceptance of support, warranty, indemnity,\n   or other liability obligations and/or rights consistent with this\n   License. However, in accepting such obligations, You may act only\n   on Your own behalf and on Your sole responsibility, not on behalf\n   of any other Contributor, and only if You agree to indemnify,\n   defend, and hold each Contributor harmless for any liability\n   incurred by, or claims asserted against, such Contributor by reason\n   of your accepting any such warranty or additional liability.\n\nEND OF TERMS AND CONDITIONS\n\nAPPENDIX: How to apply the Apache License to your work.\n\n   To apply the Apache License to your work, attach the following\n   boilerplate notice, with the fields enclosed by brackets \"[]\"\n   replaced with your own identifying information. (Don't include\n   the brackets!)  The text should be enclosed in the appropriate\n   comment syntax for the file format. We also recommend that a\n   file or class name and description of purpose be included on the\n   same \"printed page\" as the copyright notice for easier\n   identification within third-party archives.\n\nCopyright [yyyy] [name of copyright owner]\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n"
  },
  {
    "path": "LICENSE-MIT",
    "content": "Copyright (c) 2021 Elias Wilken\n\nPermission is hereby granted, free of charge, to any\nperson obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the\nSoftware without restriction, including without\nlimitation the rights to use, copy, modify, merge,\npublish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software\nis furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice\nshall be included in all copies or substantial portions\nof the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF\nANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED\nTO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\nPARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\nSHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR\nIN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\nDEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# HAP (HomeKit Accessory Protocol)\n\n[![CI](https://github.com/ewilken/hap-rs/workflows/CI/badge.svg)](https://github.com/ewilken/hap-rs/actions?query=workflow%3ACI)\n[![crates.io](https://img.shields.io/crates/v/hap.svg)](https://crates.io/crates/hap)\n[![docs.rs](https://docs.rs/hap/badge.svg)](https://docs.rs/hap)\n[![license: MIT/Apache-2.0](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg)](https://github.com/ewilken/hap-rs)\n\nRust implementation of the Apple HomeKit Accessory Protocol (HAP).\n\nThis crate supports all HomeKit services and characteristics currently implemented by Apple (on stable macOS versions) and provides the ability to create custom characteristics, services and accessories.\n\nThe HomeKit Accessory Protocol supports transports over IP and Bluetooth LE. Currently only the transport over IP is implemented in this crate. Accessories are exposed by the implemented HAP Accessory HTTP server and announced via built-in mDNS.\n\n## HomeKit Data Model\n\nThe HAP defines HomeKit enabled devices as virtual `accessories` that are composed of `services` that are composed of `characteristics`.\n\nCharacteristics hold values of various data types as well as optional metadata like max/min values or units. Services group characteristics and represent features of the accessory. Every accessory consists of at least one `accessory information service` and any number of additional services. For example a custom ceiling fan accessory may consist of an `accessory information service`, a `fan service` and a `lightbulb service`.\n\n```\nCeiling Fan Accessory\n|\n|-- Accessory Information Service\n|   |-- Identify Characteristic\n|   |-- Manufacturer Characteristic\n|   |-- Model Characteristic\n|   |-- Name Characteristic\n|   |-- Serial Characteristic\n|\n|-- Fan Service\n|   |-- Power State Characteristic\n|   |-- Rotation Direction Characteristic\n|   |-- Rotation Speed Characteristic\n|\n|-- Lightbulb Service\n|   |-- Power State Characteristic\n|   |-- Brightness Characteristic\n|   |-- Hue Characteristic\n|   |-- Saturation Characteristic\n```\n\nThis crate provides a pre-built accessory for every service predefined by Apple in the HomeKit Accessory Simulator as well as others like Television. Custom characteristics and services can be created, assembled and used alongside the predefined ones.\n\nFor a full list of the predefined characteristics, services and accessories, see the [docs](https://docs.rs/hap/) or [Apple's official specification](https://developer.apple.com/homekit/).\n\n## Usage Examples\n\n### Creating a simple lightbulb accessory and starting the IP server\n\n```rust\nuse tokio;\n\nuse hap::{\n    accessory::{lightbulb::LightbulbAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let lightbulb = LightbulbAccessory::new(1, AccessoryInformation {\n        name: \"Acme Lightbulb\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Lightbulb\".into(),\n                device_id: MacAddress::new([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Lightbulb,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(lightbulb).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n```\n\n### Setting sync callbacks to react to remote value reads and updates\n\n```rust\nuse hap::characteristic::CharacteristicCallbacks;\n\nlightbulb.lightbulb.power_state.on_read(Some(|| {\n    println!(\"power_state characteristic read\");\n    Ok(None)\n}));\n\nlightbulb.lightbulb.power_state.on_update(Some(|current_val: &bool, new_val: &bool| {\n    println!(\"power_state characteristic updated from {} to {}\", current_val, new_val);\n    Ok(())\n}));\n```\n\n### Setting async callbacks to react to remote value reads and updates\n\n```rust\nuse hap::characteristic::AsyncCharacteristicCallbacks;\n\nlightbulb.lightbulb.power_state.on_read_async(Some(|| {\n    async {\n        println!(\"power_state characteristic read (async)\");\n        Ok(None)\n    }\n    .boxed()\n}));\n\nlightbulb.lightbulb.power_state.on_update_async(Some(|current_val: bool, new_val: bool| {\n    async move {\n        println!(\"power_state characteristic updated from {} to {} (async)\", current_val, new_val);\n        Ok(())\n    }\n    .boxed()\n}));\n```\n\n### Setting a characteristic value directly\n\n```rust\nuse hap::{\n    characteristic::HapCharacteristic,\n    serde_json::Value,\n};\n\nlightbulb.lightbulb.power_state.set_value(Value::Bool(true)).await.unwrap();\n```\n\n### Interacting with accessories added to the server\n\n`Server::add_accessory` returns a pointer to the accessory that can be used like this:\n\n```rust\nasync {\n    let accessory_ptr = server.add_accessory(accessory).await.unwrap();\n}\n```\n\nAccessories behind the pointer are represented by the `HapAccessory` trait. The `HapAccessory::get_service` and `HapAccessory::get_mut_service` methods provide access to the services of the accessory, represented by the `HapService` trait. The `HapService::get_characteristic` and `HapService::get_mut_characteristic` methods provide access to the characteristics of the service, represented by the `HapCharacteristic` trait. All services and characteristics are identified by their `HapType`.\n\nAccessing and changing the `power_state` characteristic of the `lightbulb` service of a `lightbulb` accessory would look like this:\n\n```rust\nuse hap::{HapType, serde_json::Value};\n\nasync {\n    let mut lightbulb_accessory = lightbulb_ptr.lock().await;\n\n    let lightbulb_service = lightbulb_accessory.get_mut_service(HapType::Lightbulb).unwrap();\n    let power_state_characteristic = lightbulb_service.get_mut_characteristic(HapType::PowerState).unwrap();\n\n    power_state_characteristic.set_value(Value::Bool(true)).await.unwrap();\n}\n```\n\nA full working example can be found [here](https://github.com/ewilken/hap-rs/blob/master/examples/setting_values_after_server_start.rs).\n\n### (Re-)Determining the IP to bind on\n\nIP and port to serve on are set via the `host` and `port` fields of the `Config` struct. On config creation, if not explicitly set, the port defaults to `32000` and the IP is set to that of the first non-loopback network interface detected on the host. After config creation however, that IP isn't implicitly re-evaluated. To do so, an implementor has to explicitly call the `redetermine_local_ip()` method of the `Config` struct.\n\nAn example of doing that on every program restart while reloading a saved config:\n\n```rust\nlet config = match storage.load_config().await {\n    Ok(mut config) => {\n        config.redetermine_local_ip(); // on config reload, the IP has to be explicitly redetermined\n        let mut storage = FileStorage::current_dir().await?;\n        config\n    },\n    Err(_) => {\n        let config = Config {\n            pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n            name: \"Acme Outlet\".into(),\n            device_id: MacAddress::new([10, 20, 30, 40, 50, 60]),\n            category: AccessoryCategory::Outlet,\n            ..Default::default() // on config creation, the IP can be implicitly determined\n        };\n        let mut storage = FileStorage::current_dir().await?;\n        config\n    },\n};\n```\n\n## Development\n\nCodegen is handled by the `codegen` crate in the workspace. Generated files are checked in. To run the code generation, do:\n\n    cargo run --package hap-codegen\n    cargo +nightly fmt\n\n## License\n\nHAP is licensed under either of\n\n- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n"
  },
  {
    "path": "codegen/Cargo.toml",
    "content": "[package]\nname = \"hap-codegen\"\nversion = \"0.1.0-pre.15\"\nauthors = [\"Elias Wilken <elias@wlkn.io>\"]\nedition = \"2021\"\ndescription = \"Rust implementation of the Apple HomeKit Accessory Protocol (HAP)\"\ndocumentation = \"https://docs.rs/hap\"\nreadme = \"README.md\"\nrepository = \"https://github.com/ewilken/hap-rs\"\nlicense = \"MIT/Apache-2.0\"\nkeywords = [\"apple\", \"homekit\"]\npublish = false\n\n[dependencies]\nhandlebars = \"2.0\"\nserde = { version = \"1.0\", features = [\"derive\"] }\nserde_json = \"1.0\"\nuuid = { version = \"0.8\", features = [\"v4\", \"serde\"] }\n"
  },
  {
    "path": "codegen/gen/README.md",
    "content": "### Getting system definitions\n\n    cp /System/Library/PrivateFrameworks/HomeKitDaemon.framework/Resources/plain-metadata.config system.json\n    # remove `LegacyCloud` & `LegacyIDS` entries\n    plutil -convert json system.json\n"
  },
  {
    "path": "codegen/gen/system.json",
    "content": "{\n  \"Version\": 880,\n  \"PlistDictionary\": {\n    \"HomeKit\": {\n      \"Notification\": {\n        \"CoalesceNotifications\": {\n          \"tilt.current\": [\"slats\"],\n          \"brightness\": [\"lightbulb\"],\n          \"horizontal-tilt.current\": [\"window-covering\"],\n          \"saturation\": [\"lightbulb\"],\n          \"position.current\": [\"window-covering\"],\n          \"vertical-tilt.current\": [\"window-covering\"],\n          \"color-temperature\": [\"lightbulb\"],\n          \"hue\": [\"lightbulb\"],\n          \"temperature.current\": [\"sensor.temperature\"]\n        },\n        \"NotificationAutoEnabled\": {\n          \"display-order\": [\"television\"],\n          \"position.target\": [\"door\", \"window\"],\n          \"operating-state-response\": [\"doorbell\"],\n          \"active\": [\"access-code\"],\n          \"lock-mechanism.current-state\": [\"garage-door-opener\", \"lock-mechanism\"],\n          \"security-system-state.current\": [\"security-system\"],\n          \"is-configured\": [\"valve\"],\n          \"input-event\": [\"doorbell\"],\n          \"heart-beat\": [\"accessory-runtime-information\"],\n          \"position.hold\": [\"door\", \"window\"],\n          \"configured-name\": [\"input-source\", \"television\", \"smart-speaker\"],\n          \"lock-mechanism.target-state\": [\"garage-door-opener\", \"lock-mechanism\"],\n          \"position.current\": [\"door\", \"window\"],\n          \"position.state\": [\"door\", \"window\"],\n          \"door-state.current\": [\"garage-door-opener\"],\n          \"security-system-state.target\": [\"security-system\"],\n          \"door-state.target\": [\"garage-door-opener\"]\n        },\n        \"BulletinBoardEnabled\": {\n          \"position.hold\": [\"door\", \"window\"],\n          \"lock-mechanism.current-state\": [\"garage-door-opener\", \"lock-mechanism\"],\n          \"position.state\": [\"door\", \"window\"],\n          \"input-event\": [\"doorbell\"],\n          \"security-system-state.current\": [\"security-system\"],\n          \"door-state.current\": [\"garage-door-opener\"],\n          \"position.current\": [\"door\", \"window\"]\n        }\n      },\n      \"WakeOnOperationsFilter\": { \"active\": { \"television\": { \"Operations\": [\"Write\"], \"Values\": [1] } } },\n      \"Categories\": {\n        \"faucet\": { \"Identifier\": 29, \"DefaultDescription\": \"Faucet\", \"UUID\": \"43CE6F7E-F7E8-44B4-80CE-5786F6E6CD47\" },\n        \"television-set-top-box\": {\n          \"Identifier\": 35,\n          \"DefaultDescription\": \"Television Set Top Box\",\n          \"UUID\": \"FB953A08-6CDD-44E0-B011-CFAC559A3CFB\"\n        },\n        \"other\": { \"Identifier\": 1, \"DefaultDescription\": \"Other\", \"UUID\": \"0FBA259B-05AC-46F2-875F-204ABB6D9FE7\" },\n        \"air-heater\": {\n          \"Identifier\": 20,\n          \"DefaultDescription\": \"Air Heater\",\n          \"UUID\": \"BF7036FD-93CF-49B5-954F-CD2B760D11DA\"\n        },\n        \"window\": { \"Identifier\": 13, \"DefaultDescription\": \"Window\", \"UUID\": \"1C501511-408E-4C1E-816B-3FC011FFD5B1\" },\n        \"audio-receiver\": {\n          \"Identifier\": 34,\n          \"DefaultDescription\": \"Audio Receiver\",\n          \"UUID\": \"BE15659C-3CE6-4FD0-B152-BCDB488446C6\"\n        },\n        \"air-purifier\": {\n          \"Identifier\": 19,\n          \"DefaultDescription\": \"Air Purifier\",\n          \"UUID\": \"5510B997-D711-4636-870F-82BB61092B15\"\n        },\n        \"television\": {\n          \"Identifier\": 31,\n          \"DefaultDescription\": \"Television\",\n          \"UUID\": \"830C0952-7CD8-44FB-B0C0-DA4EDB0F32A9\"\n        },\n        \"outlet\": { \"Identifier\": 7, \"DefaultDescription\": \"Outlet\", \"UUID\": \"730F40D4-6D0E-4903-B09E-520A08AFB78C\" },\n        \"garage-door-opener\": {\n          \"Identifier\": 4,\n          \"DefaultDescription\": \"Garage Door Opener\",\n          \"UUID\": \"604B6E52-2C87-4596-B4C9-D15077C0C07F\"\n        },\n        \"apple-tv\": {\n          \"Identifier\": 24,\n          \"DefaultDescription\": \"Apple TV\",\n          \"UUID\": \"F6D2A2AC-3A6E-4E6F-8196-678ABE909D8E\"\n        },\n        \"airport\": {\n          \"Identifier\": 27,\n          \"DefaultDescription\": \"AirPort\",\n          \"UUID\": \"8BFB739C-1E09-4F7B-ABB8-DD7BADD0E8A9\"\n        },\n        \"lightbulb\": {\n          \"Identifier\": 5,\n          \"DefaultDescription\": \"Lightbulb\",\n          \"UUID\": \"57D56F4D-3302-41F7-AB34-5365AA180E81\"\n        },\n        \"air-humidifier\": {\n          \"Identifier\": 22,\n          \"DefaultDescription\": \"Air Humidifier\",\n          \"UUID\": \"3FEB9075-C9AF-4629-ADBC-A853259C645A\"\n        },\n        \"window-covering\": {\n          \"Identifier\": 14,\n          \"DefaultDescription\": \"Window Covering\",\n          \"UUID\": \"2FB9EE1F-1C21-4D0B-9383-9B65F64DBF0E\"\n        },\n        \"shower-head\": {\n          \"Identifier\": 30,\n          \"DefaultDescription\": \"Shower Head\",\n          \"UUID\": \"39D2A5B4-F9A6-43F6-90E7-0019F0C0E99F\"\n        },\n        \"video-doorbell\": {\n          \"Identifier\": 18,\n          \"DefaultDescription\": \"Video Doorbell\",\n          \"UUID\": \"957A52E0-BE03-490C-8305-7B20C1CC17BA\"\n        },\n        \"air-conditioner\": {\n          \"Identifier\": 21,\n          \"DefaultDescription\": \"Air Conditioner\",\n          \"UUID\": \"18DDD63A-27F9-4341-B59B-759D3D114586\"\n        },\n        \"fan\": { \"Identifier\": 3, \"DefaultDescription\": \"Fan\", \"UUID\": \"151CB559-0DF9-40AA-8A67-12AF06C4449D\" },\n        \"sprinkler\": {\n          \"Identifier\": 28,\n          \"DefaultDescription\": \"Sprinkler\",\n          \"UUID\": \"94D3FBD5-0A74-4EE4-BE1A-C97E82ADFA33\"\n        },\n        \"speaker\": {\n          \"Identifier\": 26,\n          \"DefaultDescription\": \"Speaker\",\n          \"UUID\": \"C0F5EDC5-4003-464A-9E5D-0DB36677BC35\"\n        },\n        \"bridge\": { \"Identifier\": 2, \"DefaultDescription\": \"Bridge\", \"UUID\": \"61102194-9993-48BF-A1EF-6C7DC50F0C01\" },\n        \"television-streaming-stick\": {\n          \"Identifier\": 36,\n          \"DefaultDescription\": \"Television Streaming Stick\",\n          \"UUID\": \"B0C866C4-3E25-4F6A-8476-A8A3B579A86E\"\n        },\n        \"door\": { \"Identifier\": 12, \"DefaultDescription\": \"Door\", \"UUID\": \"DD4DE411-8F01-44EE-866A-1F96144DC1B6\" },\n        \"door-lock\": {\n          \"Identifier\": 6,\n          \"DefaultDescription\": \"Door Lock\",\n          \"UUID\": \"C25D5FCE-52EC-4599-A815-1192C5F08C7F\"\n        },\n        \"thermostat\": {\n          \"Identifier\": 9,\n          \"DefaultDescription\": \"Thermostat\",\n          \"UUID\": \"79668DCF-89FB-450D-94B5-AEE70B7B09F1\"\n        },\n        \"switch\": { \"Identifier\": 8, \"DefaultDescription\": \"Switch\", \"UUID\": \"2F4C3164-8DE4-4A4F-93BA-DD1D5068DF0B\" },\n        \"sensor\": { \"Identifier\": 10, \"DefaultDescription\": \"Sensor\", \"UUID\": \"772AFB8E-8D2F-455E-90E5-9852E6C4DD31\" },\n        \"air-dehumidifier\": {\n          \"Identifier\": 23,\n          \"DefaultDescription\": \"Air Dehumidifier\",\n          \"UUID\": \"1E15B639-DC98-41D4-A394-2E4A1D54AA3A\"\n        },\n        \"ip-camera\": {\n          \"Identifier\": 17,\n          \"DefaultDescription\": \"IP Camera\",\n          \"UUID\": \"C9EE63DB-2FF7-4514-826A-2FC2F0D4C9F0\"\n        },\n        \"programmable-switch\": {\n          \"Identifier\": 15,\n          \"DefaultDescription\": \"Programmable Switch\",\n          \"UUID\": \"3F9B944B-B8DF-4570-BAF5-CD31A8B321A7\"\n        },\n        \"target-controller\": {\n          \"Identifier\": 32,\n          \"DefaultDescription\": \"Target Controller\",\n          \"UUID\": \"770ADB51-8848-491A-BFA3-C34EA096CC92\"\n        },\n        \"wifi-router\": {\n          \"Identifier\": 33,\n          \"DefaultDescription\": \"Wi-Fi Router\",\n          \"UUID\": \"337635B4-552A-48AD-A38D-DD2D5E826C9A\"\n        },\n        \"range-extender\": {\n          \"Identifier\": 16,\n          \"DefaultDescription\": \"Range Extender\",\n          \"UUID\": \"8E33483E-2102-4BFE-9295-0A187D114188\"\n        },\n        \"security-system\": {\n          \"Identifier\": 11,\n          \"DefaultDescription\": \"Security System\",\n          \"UUID\": \"14D8FE28-2998-49E3-AC95-E3969BE2957C\"\n        }\n      },\n      \"AllowableSecuringWrites\": {\n        \"security-system-state.target\": [0, 1, 2],\n        \"lock-mechanism.target-state\": [1],\n        \"position.target\": [0],\n        \"door-state.target\": [1]\n      },\n      \"RequiresDeviceUnlock\": {\n        \"position.hold\": [\"door\", \"window\"],\n        \"lock-mechanism.current-state\": [\"garage-door-opener\", \"lock-mechanism\"],\n        \"position.state\": [\"door\", \"window\"],\n        \"position.target\": [\"door\", \"window\"],\n        \"lock-mechanism.target-state\": [\"garage-door-opener\", \"lock-mechanism\"],\n        \"door-state.current\": [\"garage-door-opener\"],\n        \"door-state.target\": [\"garage-door-opener\"],\n        \"position.current\": [\"door\", \"window\"],\n        \"security-system-state.current\": [\"security-system\"],\n        \"security-system-state.target\": [\"security-system\"]\n      },\n      \"Blacklist\": {\n        \"Characteristics\": [\n          \"accessory.identifier\",\n          \"cloud-relay.control-point\",\n          \"cloud-relay.current-state\",\n          \"cloud-relay.enabled\",\n          \"list-pairings\",\n          \"pair-setup\",\n          \"pair-verify\",\n          \"pairing-features\",\n          \"service-signature\"\n        ],\n        \"Services\": [\"cloud-relay\", \"pairing\", \"protocol-information\"]\n      },\n      \"BlacklistFromApplications\": {\n        \"Characteristics\": [\n          \"access-code-control-point\",\n          \"access-code-supported-configuration\",\n          \"accessory-flags\",\n          \"app-matching-identifier\",\n          \"characteristic-value-active-transition-count\",\n          \"characteristic-value-transition-control\",\n          \"configuration-state\",\n          \"display-order\",\n          \"hardware-finish\",\n          \"identifier\",\n          \"managed-network-enable\",\n          \"network-access-violation-control\",\n          \"network-client-control\",\n          \"network-client-status-control\",\n          \"nfc-access-control-point\",\n          \"nfc-access-supported-configuration\",\n          \"operating-state-response\",\n          \"password-setting\",\n          \"privilege\",\n          \"product-data\",\n          \"router-status\",\n          \"selected-audio-stream-configuration\",\n          \"service-signature\",\n          \"setup-data-stream-transport\",\n          \"supported-characteristic-value-transition-configuration\",\n          \"supported-data-stream-transport-configuration\",\n          \"supported-router-configuration\",\n          \"thread-control-point\",\n          \"wake-configuration\",\n          \"wan-configuration-list\",\n          \"wan-status-list\",\n          \"wifi-satellite-status\"\n        ],\n        \"Services\": [\n          \"access-code\",\n          \"access-control\",\n          \"assistant\",\n          \"audio-stream-management\",\n          \"camera-operating-mode\",\n          \"camera-recording-management\",\n          \"camera-rtp-stream-management\",\n          \"data-stream-transport-management\",\n          \"nfc-access\",\n          \"power-management\",\n          \"siri\",\n          \"siri-endpoint\",\n          \"smart-speaker\",\n          \"target-control\",\n          \"target-control-management\",\n          \"wifi-router\",\n          \"wifi-satellite\"\n        ]\n      }\n    },\n    \"HAP\": {\n      \"Base UUID\": \"-0000-1000-8000-0026BB765291\",\n      \"Characteristics\": {\n        \"siri-input-type\": {\n          \"ShortUUID\": \"00000132\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Siri Input Type\",\n          \"Properties\": 2,\n          \"MaxValue\": 1\n        },\n        \"access-code-control-point\": {\n          \"DefaultDescription\": \"Access Code Control Point\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000262\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 6\n        },\n        \"wan-status-list\": {\n          \"DefaultDescription\": \"WAN Status List\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000212\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"multifunction-button\": {\n          \"ShortUUID\": \"0000026B\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Multifunction Button\",\n          \"Properties\": 3,\n          \"MaxValue\": 1\n        },\n        \"in-use\": {\n          \"ShortUUID\": \"000000D2\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"In Use\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"wifi-configuration-control\": {\n          \"DefaultDescription\": \"Wi-Fi Configuration Control\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"0000022D\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 167\n        },\n        \"rotation.speed\": {\n          \"ShortUUID\": \"00000029\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Rotation Speed\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 100\n        },\n        \"supported-target-configuration\": {\n          \"DefaultDescription\": \"Supported Target Configuration\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000123\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"wake-configuration\": {\n          \"DefaultDescription\": \"Wake Configuration\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000222\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"rssi\": {\n          \"DefaultDescription\": \"Received Signal Strength Indication\",\n          \"Format\": \"int\",\n          \"ShortUUID\": \"0000023F\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"setup-data-stream-transport\": {\n          \"DefaultDescription\": \"Setup Data Stream Transport\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000131\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 6\n        },\n        \"slat.type\": {\n          \"ShortUUID\": \"000000C0\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Slat Type\",\n          \"Properties\": 2,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"temperature.units\": {\n          \"ShortUUID\": \"00000036\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Temperature Display Units\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"air-purifier.state.target\": {\n          \"ShortUUID\": \"000000A8\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Target Air Purifier State\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"density.voc\": {\n          \"ShortUUID\": \"000000C8\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Volatile Organic Compound Density\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1000,\n          \"Units\": \"micrograms/m^3\"\n        },\n        \"volume\": {\n          \"ShortUUID\": \"00000119\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Volume\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 100,\n          \"Units\": \"percentage\"\n        },\n        \"hue\": {\n          \"ShortUUID\": \"00000013\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Hue\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 360,\n          \"Units\": \"arcdegrees\"\n        },\n        \"logs\": {\n          \"DefaultDescription\": \"Logs\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"0000001F\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"characteristic-value-active-transition-count\": {\n          \"DefaultDescription\": \"Characteristic Value Active Transition Count\",\n          \"Format\": \"uint8\",\n          \"ShortUUID\": \"0000024B\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"firmware-update-readiness\": {\n          \"DefaultDescription\": \"Firmware Update Readiness\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000234\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"cloud-relay.enabled\": {\n          \"DefaultDescription\": \"Cloud Relay Enable Status\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"0000005B\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 7\n        },\n        \"selected-camera-recording-configuration\": {\n          \"DefaultDescription\": \"Selected Camera Recording Configuration\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000209\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 7\n        },\n        \"mac-transmission-counters\": {\n          \"DefaultDescription\": \"MAC Transmission Counters\",\n          \"Format\": \"data\",\n          \"ShortUUID\": \"00000248\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"characteristic-value-transition-control\": {\n          \"DefaultDescription\": \"Characteristic Value Transition Control\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000143\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 6\n        },\n        \"filter.change-indication\": {\n          \"ShortUUID\": \"000000AC\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Filter Change indication\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"position.current\": {\n          \"ShortUUID\": \"0000006D\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Current Position\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 100,\n          \"Units\": \"percentage\"\n        },\n        \"staged-firmware-version\": {\n          \"DefaultDescription\": \"Staged Firmware Version\",\n          \"Format\": \"string\",\n          \"ShortUUID\": \"00000249\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"smoke-detected\": {\n          \"ShortUUID\": \"00000076\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Smoke Detected\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"output-state\": {\n          \"ShortUUID\": \"00000074\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Programmable Switch Output State\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"remaining-duration\": {\n          \"ShortUUID\": \"000000D4\",\n          \"MinValue\": 0,\n          \"Format\": \"uint32\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Remaining Duration\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 3600,\n          \"Units\": \"seconds\"\n        },\n        \"manually-disabled\": {\n          \"DefaultDescription\": \"Manually disabled\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"00000227\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"horizontal-tilt.current\": {\n          \"ShortUUID\": \"0000006C\",\n          \"MinValue\": -90,\n          \"Format\": \"int\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Current Horizontal Tilt Angle\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 90,\n          \"Units\": \"arcdegrees\"\n        },\n        \"nfc-access-supported-configuration\": {\n          \"DefaultDescription\": \"NFC Access Supported Configuration\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000265\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"ping\": {\n          \"DefaultDescription\": \"Ping\",\n          \"Format\": \"data\",\n          \"ShortUUID\": \"0000023C\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"digital-zoom\": {\n          \"StepValue\": 0.10000000000000001,\n          \"DefaultDescription\": \"Digital Zoom\",\n          \"Format\": \"float\",\n          \"ShortUUID\": \"0000011D\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 7\n        },\n        \"swing-mode\": {\n          \"ShortUUID\": \"000000B6\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Swing Mode\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"access-code-supported-configuration\": {\n          \"DefaultDescription\": \"Access Code Supported Configuration\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000261\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"security-system-state.target\": {\n          \"ShortUUID\": \"00000067\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Security System Target State\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 3\n        },\n        \"fan.state.current\": {\n          \"ShortUUID\": \"000000AF\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Current Fan State\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 2\n        },\n        \"rotation.direction\": {\n          \"ShortUUID\": \"00000028\",\n          \"MinValue\": 0,\n          \"Format\": \"int\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Rotation Direction\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"sleep-discovery-mode\": {\n          \"ShortUUID\": \"000000E8\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Sleep Discovery Mode\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"volume-control-type\": {\n          \"ShortUUID\": \"000000E9\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Volume Control Type\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 3\n        },\n        \"input-source-type\": {\n          \"ShortUUID\": \"000000DB\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Input Source Type\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 10\n        },\n        \"charging-state\": {\n          \"ShortUUID\": \"0000008F\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Charging State\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 2\n        },\n        \"hardware-finish\": {\n          \"DefaultDescription\": \"Hardware Finish\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"0000026C\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"relative-humidity.target\": {\n          \"ShortUUID\": \"00000034\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Target Relative Humidity\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 100,\n          \"Units\": \"percentage\"\n        },\n        \"relative-humidity.dehumidifier-threshold\": {\n          \"ShortUUID\": \"000000C9\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Relative Humidity Dehumidifier Threshold\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 100,\n          \"Units\": \"percentage\"\n        },\n        \"color-temperature\": {\n          \"ShortUUID\": \"000000CE\",\n          \"MinValue\": 140,\n          \"Format\": \"int\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Color Temperature\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 500\n        },\n        \"pair-setup\": {\n          \"DefaultDescription\": \"Pair Setup\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"0000004C\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 6\n        },\n        \"supported-router-configuration\": {\n          \"DefaultDescription\": \"Supported Router Configuration\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000210\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"carbon-dioxide.detected\": {\n          \"ShortUUID\": \"00000092\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Carbon dioxide Detected\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"light-level.current\": {\n          \"ShortUUID\": \"0000006B\",\n          \"MinValue\": 0.0001,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Current Light Level\",\n          \"Properties\": 3,\n          \"MaxValue\": 100000,\n          \"Units\": \"lux\"\n        },\n        \"software.revision\": {\n          \"DefaultDescription\": \"Software Revision\",\n          \"Format\": \"string\",\n          \"ShortUUID\": \"00000054\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"event-transmission-counters\": {\n          \"DefaultDescription\": \"Event Transmission Counters\",\n          \"Format\": \"uint32\",\n          \"ShortUUID\": \"0000023E\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"is-configured\": {\n          \"ShortUUID\": \"000000D6\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Is Configured\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"wan-configuration-list\": {\n          \"DefaultDescription\": \"WAN Configuration List\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000211\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"security-system-state.current\": {\n          \"ShortUUID\": \"00000066\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Security System Current State\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 4\n        },\n        \"homekit-camera-active\": {\n          \"DefaultDescription\": \"HomeKit Camera Active\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"0000021B\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 39\n        },\n        \"optical-zoom\": {\n          \"StepValue\": 0.10000000000000001,\n          \"DefaultDescription\": \"Optical Zoom\",\n          \"Format\": \"float\",\n          \"ShortUUID\": \"0000011C\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 7\n        },\n        \"mute\": {\n          \"DefaultDescription\": \"Mute\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"0000011A\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 7\n        },\n        \"event-snapshots-active\": {\n          \"DefaultDescription\": \"Event Snapshots Active\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"00000223\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 39\n        },\n        \"service-signature\": {\n          \"DefaultDescription\": \"Service Signature\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"000000A5\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 6\n        },\n        \"temperature.current\": {\n          \"ShortUUID\": \"00000011\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Current Temperature\",\n          \"Properties\": 3,\n          \"StepValue\": 0.10000000000000001,\n          \"MaxValue\": 100,\n          \"Units\": \"celsius\"\n        },\n        \"cloud-relay.control-point\": {\n          \"DefaultDescription\": \"Cloud Relay Control Point\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"0000005E\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 7\n        },\n        \"supported-firmware-update-configuration\": {\n          \"DefaultDescription\": \"Supported Firmware Update Configuration\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000233\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"name\": {\n          \"DefaultDescription\": \"Name\",\n          \"MaxLength\": 64,\n          \"Format\": \"string\",\n          \"ShortUUID\": \"00000023\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"receiver-sensitivity\": {\n          \"DefaultDescription\": \"Receiver Sensitivity\",\n          \"Format\": \"int\",\n          \"ShortUUID\": \"00000244\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"active-identifier\": {\n          \"DefaultDescription\": \"Active Identifier\",\n          \"MinValue\": 0,\n          \"Format\": \"uint32\",\n          \"ShortUUID\": \"000000E7\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 7\n        },\n        \"density.so2\": {\n          \"ShortUUID\": \"000000C5\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Sulphur dioxide Density\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1000,\n          \"Units\": \"micrograms/m^3\"\n        },\n        \"relative-humidity.current\": {\n          \"ShortUUID\": \"00000010\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Current Relative Humidity\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 100,\n          \"Units\": \"percentage\"\n        },\n        \"obstruction-detected\": {\n          \"DefaultDescription\": \"Obstruction Detected\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"00000024\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"operating-state-response\": {\n          \"DefaultDescription\": \"Operating State Response\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000232\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"supported-diagnostics-snapshot\": {\n          \"DefaultDescription\": \"Supported Diagnostics Snapshot\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000238\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"on\": {\n          \"DefaultDescription\": \"Power State\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"00000025\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 7\n        },\n        \"supported-audio-recording-configuration\": {\n          \"DefaultDescription\": \"Supported Audio Recording Configuration\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000207\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"active\": {\n          \"ShortUUID\": \"000000B0\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Active\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"heating-cooling.current\": {\n          \"ShortUUID\": \"0000000F\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Current Heating Cooling State\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 2\n        },\n        \"accessory-flags\": {\n          \"DefaultDescription\": \"Accessory Flags\",\n          \"Format\": \"uint32\",\n          \"ShortUUID\": \"000000A6\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"motion-detected\": {\n          \"DefaultDescription\": \"Motion Detected\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"00000022\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"camera-operating-mode-indicator\": {\n          \"DefaultDescription\": \"Camera Operating Mode Indicator\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"0000021D\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 39\n        },\n        \"periodic-snapshots-active\": {\n          \"DefaultDescription\": \"Periodic Snapshots Active\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"00000225\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 39\n        },\n        \"service-label-index\": {\n          \"ShortUUID\": \"000000CB\",\n          \"MinValue\": 1,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Label Index\",\n          \"Properties\": 2,\n          \"StepValue\": 1,\n          \"MaxValue\": 255\n        },\n        \"lock-mechanism.target-state\": {\n          \"ShortUUID\": \"0000001E\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Lock Target State\",\n          \"Properties\": 23,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"accessory.identifier\": {\n          \"DefaultDescription\": \"Accessory Identifier\",\n          \"Format\": \"string\",\n          \"ShortUUID\": \"00000057\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"app-matching-identifier\": {\n          \"DefaultDescription\": \"Application Matching Identifier\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"000000A4\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"list-pairings\": {\n          \"DefaultDescription\": \"List Pairings\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000050\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 6\n        },\n        \"siri-listening\": {\n          \"ShortUUID\": \"00000256\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Siri Listening\",\n          \"Properties\": 7,\n          \"MaxValue\": 1\n        },\n        \"product-data\": {\n          \"DefaultDescription\": \"Product Data\",\n          \"Format\": \"data\",\n          \"ShortUUID\": \"00000220\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"water-level\": {\n          \"ShortUUID\": \"000000B5\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Current Water Level\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 100,\n          \"Units\": \"percentage\"\n        },\n        \"wifi-satellite-status\": {\n          \"ShortUUID\": \"0000021E\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Wi-Fi Satellite Status\",\n          \"Properties\": 3,\n          \"MaxValue\": 2\n        },\n        \"model\": {\n          \"DefaultDescription\": \"Model\",\n          \"MaxLength\": 64,\n          \"Format\": \"string\",\n          \"ShortUUID\": \"00000021\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"heater-cooler.state.target\": {\n          \"ShortUUID\": \"000000B2\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Target Heater-Cooler State\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 2\n        },\n        \"media-state.target\": {\n          \"ShortUUID\": \"00000137\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Target Media State\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 2\n        },\n        \"router-status\": {\n          \"ShortUUID\": \"0000020E\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Router Status\",\n          \"Properties\": 3,\n          \"MaxValue\": 1\n        },\n        \"power-mode-selection\": {\n          \"ShortUUID\": \"000000DF\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Power Mode Selection\",\n          \"Properties\": 4,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"battery-level\": {\n          \"ShortUUID\": \"00000068\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Battery Level\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 100,\n          \"Units\": \"percentage\"\n        },\n        \"firmware-update-status\": {\n          \"DefaultDescription\": \"Firmware Update Status\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000235\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"setup-stream-endpoint\": {\n          \"DefaultDescription\": \"Setup Endpoint\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000118\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 6\n        },\n        \"input-device-type\": {\n          \"ShortUUID\": \"000000DC\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Input Device Type\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 6\n        },\n        \"carbon-dioxide.level\": {\n          \"ShortUUID\": \"00000093\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Carbon dioxide Level\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 100000,\n          \"Units\": \"ppm\"\n        },\n        \"streaming-status\": {\n          \"DefaultDescription\": \"Streaming Status\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000120\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"lock-mechanism.last-known-action\": {\n          \"ShortUUID\": \"0000001C\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Lock Last Known Action\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 8\n        },\n        \"density.pm2_5\": {\n          \"ShortUUID\": \"000000C6\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"PM2.5 Density\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1000,\n          \"Units\": \"micrograms/m^3\"\n        },\n        \"air-purifier.state.current\": {\n          \"ShortUUID\": \"000000A9\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Current Air Purifier State\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 2\n        },\n        \"video-analysis-active\": {\n          \"DefaultDescription\": \"Video Analysis Active\",\n          \"Format\": \"uint8\",\n          \"ShortUUID\": \"00000229\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 7\n        },\n        \"slat.state.current\": {\n          \"ShortUUID\": \"000000AA\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Current Slat State\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 3\n        },\n        \"asset-update-readiness\": {\n          \"DefaultDescription\": \"Asset Update Readiness\",\n          \"Format\": \"uint32\",\n          \"ShortUUID\": \"00000269\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"button-event\": {\n          \"DefaultDescription\": \"Button Event\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000126\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"carbon-monoxide.peak-level\": {\n          \"ShortUUID\": \"00000091\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Carbon monoxide Peak Level\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 100,\n          \"Units\": \"ppm\"\n        },\n        \"air-particulate.density\": {\n          \"ShortUUID\": \"00000064\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Air Particulate Density\",\n          \"Properties\": 3,\n          \"MaxValue\": 1000,\n          \"Units\": \"micrograms/m^3\"\n        },\n        \"supported-characteristic-value-transition-configuration\": {\n          \"DefaultDescription\": \"Supported Characteristic Value Transition Configuration\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000144\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"selected-stream-configuration\": {\n          \"DefaultDescription\": \"Selected Stream Configuration\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000117\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 6\n        },\n        \"humidifier-dehumidifier.state.target\": {\n          \"ShortUUID\": \"000000B4\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Target Humidifier-Dehumidifier State\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 2\n        },\n        \"airplay-enable\": {\n          \"ShortUUID\": \"0000025B\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"AirPlay Enable\",\n          \"Properties\": 7,\n          \"MaxValue\": 1\n        },\n        \"heart-beat\": {\n          \"DefaultDescription\": \"Heart Beat\",\n          \"Format\": \"uint32\",\n          \"ShortUUID\": \"0000024A\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"sleep-interval\": {\n          \"ShortUUID\": \"0000023A\",\n          \"MinValue\": 0,\n          \"Format\": \"uint32\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Sleep Interval\",\n          \"StepValue\": 1,\n          \"Properties\": 3\n        },\n        \"pair-verify\": {\n          \"DefaultDescription\": \"Pair Verify\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"0000004E\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 6\n        },\n        \"supported-video-stream-configuration\": {\n          \"DefaultDescription\": \"Supported Video Stream Configuration\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000114\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"tilt.current\": {\n          \"ShortUUID\": \"000000C1\",\n          \"MinValue\": -90,\n          \"Format\": \"int\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Current Tilt Angle\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 90,\n          \"Units\": \"arcdegrees\"\n        },\n        \"supported-audio-stream-configuration\": {\n          \"DefaultDescription\": \"Supported Audio Stream Configuration\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000115\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"lock-management.control-point\": {\n          \"DefaultDescription\": \"Lock Control Point\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000019\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 4\n        },\n        \"hardware.revision\": {\n          \"DefaultDescription\": \"Hardware Revision\",\n          \"Format\": \"string\",\n          \"ShortUUID\": \"00000053\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"transmit-power\": {\n          \"DefaultDescription\": \"Transmit Power\",\n          \"Format\": \"int\",\n          \"ShortUUID\": \"00000242\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"density.ozone\": {\n          \"ShortUUID\": \"000000C3\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Ozone Density\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1000,\n          \"Units\": \"micrograms/m^3\"\n        },\n        \"brightness\": {\n          \"ShortUUID\": \"00000008\",\n          \"MinValue\": 0,\n          \"Format\": \"int\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Brightness\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 100,\n          \"Units\": \"percentage\"\n        },\n        \"humidifier-dehumidifier.state.current\": {\n          \"ShortUUID\": \"000000B3\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Current Humidifier-Dehumidifier State\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 3\n        },\n        \"carbon-monoxide.detected\": {\n          \"ShortUUID\": \"00000069\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Carbon monoxide Detected\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"network-access-violation-control\": {\n          \"DefaultDescription\": \"Network Access Violation Control\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"0000021F\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 167\n        },\n        \"data-stream-hap-transport\": {\n          \"DefaultDescription\": \"Data Stream HAP Transport\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000138\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 6\n        },\n        \"door-state.current\": {\n          \"ShortUUID\": \"0000000E\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Current Door State\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 4\n        },\n        \"pairing-features\": {\n          \"DefaultDescription\": \"Pairing Features\",\n          \"Format\": \"uint8\",\n          \"ShortUUID\": \"0000004F\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 6\n        },\n        \"cca-energy-detect-threshold\": {\n          \"DefaultDescription\": \"CCA Energy Detect Threshold\",\n          \"Format\": \"int\",\n          \"ShortUUID\": \"00000246\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"filter.life-level\": {\n          \"ShortUUID\": \"000000AB\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Filter Life Level\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 100\n        },\n        \"selected-audio-stream-configuration\": {\n          \"DefaultDescription\": \"Selected Audio Stream Configuration\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000128\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 6\n        },\n        \"density.pm10\": {\n          \"ShortUUID\": \"000000C7\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"PM10 Density\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1000,\n          \"Units\": \"micrograms/m^3\"\n        },\n        \"volume-selector\": {\n          \"ShortUUID\": \"000000EA\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Volume Selector\",\n          \"Properties\": 4,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"version\": {\n          \"DefaultDescription\": \"Version\",\n          \"MaxLength\": 64,\n          \"Format\": \"string\",\n          \"ShortUUID\": \"00000037\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"administrator-only-access\": {\n          \"DefaultDescription\": \"Administrator Only Access\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"00000001\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 7\n        },\n        \"configuration-state\": {\n          \"DefaultDescription\": \"Configuration State\",\n          \"Format\": \"uint16\",\n          \"ShortUUID\": \"00000263\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"setup-transfer-transport\": {\n          \"DefaultDescription\": \"Setup Transfer Transport\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000201\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 132\n        },\n        \"thread-control-point\": {\n          \"DefaultDescription\": \"Thread Control Point\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000704\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 4\n        },\n        \"identifier\": {\n          \"DefaultDescription\": \"Identifier\",\n          \"MinValue\": 0,\n          \"Format\": \"uint32\",\n          \"ShortUUID\": \"000000E6\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"firmware.revision\": {\n          \"DefaultDescription\": \"Firmware Revision\",\n          \"Format\": \"string\",\n          \"ShortUUID\": \"00000052\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"carbon-dioxide.peak-level\": {\n          \"ShortUUID\": \"00000094\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Carbon dioxide Peak Level\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 100000,\n          \"Units\": \"ppm\"\n        },\n        \"carbon-monoxide.level\": {\n          \"ShortUUID\": \"00000090\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Carbon monoxide Level\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 100,\n          \"Units\": \"ppm\"\n        },\n        \"target-list\": {\n          \"DefaultDescription\": \"Target List Configuration\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000124\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 134\n        },\n        \"network-client-status-control\": {\n          \"DefaultDescription\": \"Network Client Status Control\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"0000020D\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 134\n        },\n        \"valve-type\": {\n          \"ShortUUID\": \"000000D5\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Valve Type\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 3\n        },\n        \"mac-retransmission-maximum\": {\n          \"DefaultDescription\": \"MAC Retransmission Maximum\",\n          \"Format\": \"uint8\",\n          \"ShortUUID\": \"00000247\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"configured-name\": {\n          \"DefaultDescription\": \"Configured Name\",\n          \"Format\": \"string\",\n          \"ShortUUID\": \"000000E3\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"network-client-control\": {\n          \"DefaultDescription\": \"Network Client Control\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"0000020C\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 167\n        },\n        \"heating-cooling.target\": {\n          \"ShortUUID\": \"00000033\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Target Heating Cooling State\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 3\n        },\n        \"lock-physical-controls\": {\n          \"ShortUUID\": \"000000A7\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Lock Physical Controls\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"third-party-camera-active\": {\n          \"DefaultDescription\": \"Third Party Camera Active\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"0000021C\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"filter.reset-indication\": {\n          \"ShortUUID\": \"000000AD\",\n          \"MinValue\": 1,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Filter Reset Change Indication\",\n          \"Properties\": 4,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"air-quality\": {\n          \"ShortUUID\": \"00000095\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Current Air Quality\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 5\n        },\n        \"density.no2\": {\n          \"ShortUUID\": \"000000C4\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Nitrogen dioxide Density\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1000,\n          \"Units\": \"micrograms/m^3\"\n        },\n        \"supported-data-stream-transport-configuration\": {\n          \"DefaultDescription\": \"Supported Data Stream Transport Configuration\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000130\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"position.target\": {\n          \"ShortUUID\": \"0000007C\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Target Position\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 100,\n          \"Units\": \"percentage\"\n        },\n        \"image-rotation\": {\n          \"ShortUUID\": \"0000011E\",\n          \"MinValue\": 0,\n          \"Format\": \"int\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Image Rotation\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 360,\n          \"Units\": \"arcdegrees\"\n        },\n        \"cloud-relay.current-state\": {\n          \"ShortUUID\": \"0000005C\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Cloud Relay Current State\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 5\n        },\n        \"status-jammed\": {\n          \"ShortUUID\": \"00000078\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Status Jammed\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"vertical-tilt.target\": {\n          \"ShortUUID\": \"0000007D\",\n          \"MinValue\": -90,\n          \"Format\": \"int\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Target Vertical Tilt Angle\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 90,\n          \"Units\": \"arcdegrees\"\n        },\n        \"picture-mode\": {\n          \"ShortUUID\": \"000000E2\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Picture Mode\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 13\n        },\n        \"input-event\": {\n          \"ShortUUID\": \"00000073\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Programmable Switch Event\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 2\n        },\n        \"selected-diagnostics-modes\": {\n          \"DefaultDescription\": \"Selected Diagnostics Modes\",\n          \"Format\": \"uint32\",\n          \"ShortUUID\": \"0000024D\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 6\n        },\n        \"identify\": {\n          \"DefaultDescription\": \"Identify\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"00000014\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 4\n        },\n        \"outlet-in-use\": {\n          \"DefaultDescription\": \"Outlet In Use\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"00000026\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"service-label-namespace\": {\n          \"ShortUUID\": \"000000CD\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Label Namespace\",\n          \"Properties\": 2,\n          \"StepValue\": 1,\n          \"MaxValue\": 4\n        },\n        \"leak-detected\": {\n          \"ShortUUID\": \"00000070\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Leak Detected\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"lock-mechanism.current-state\": {\n          \"ShortUUID\": \"0000001D\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Lock Current State\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 3\n        },\n        \"media-state.current\": {\n          \"ShortUUID\": \"000000E0\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Current Media State\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 5\n        },\n        \"display-order\": {\n          \"DefaultDescription\": \"Display Order\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000136\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"contact-state\": {\n          \"ShortUUID\": \"0000006A\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Contact Sensor State\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"data-stream-hap-transport-interrupt\": {\n          \"DefaultDescription\": \"Data Stream HAP Transport Interrupt\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000139\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"siri-enable\": {\n          \"ShortUUID\": \"00000255\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Siri Enable\",\n          \"Properties\": 7,\n          \"MaxValue\": 1\n        },\n        \"horizontal-tilt.target\": {\n          \"ShortUUID\": \"0000007B\",\n          \"MinValue\": -90,\n          \"Format\": \"int\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Target Horizontal Tilt Angle\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 90,\n          \"Units\": \"arcdegrees\"\n        },\n        \"supported-transfer-transport-configuration\": {\n          \"DefaultDescription\": \"Supported Transfer Transport Configuration\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000202\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"relative-humidity.humidifier-threshold\": {\n          \"ShortUUID\": \"000000CA\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Relative Humidity Humidifier Threshold\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 100,\n          \"Units\": \"percentage\"\n        },\n        \"position.state\": {\n          \"ShortUUID\": \"00000072\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Position State\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 2\n        },\n        \"status-fault\": {\n          \"ShortUUID\": \"00000077\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Status Fault\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"password-setting\": {\n          \"DefaultDescription\": \"Password Setting\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"000000E4\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 7\n        },\n        \"security-system.alarm-type\": {\n          \"ShortUUID\": \"0000008E\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Security System Alarm Type\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"event-retransmission-maximum\": {\n          \"DefaultDescription\": \"Event Retransmission Maximum\",\n          \"Format\": \"uint8\",\n          \"ShortUUID\": \"0000023D\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"cca-signal-detect-threshold\": {\n          \"DefaultDescription\": \"CCA Signal Detect Threshold\",\n          \"Format\": \"int\",\n          \"ShortUUID\": \"00000245\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"supported-diagnostics-modes\": {\n          \"DefaultDescription\": \"Supported Diagnostics Modes\",\n          \"Format\": \"uint32\",\n          \"ShortUUID\": \"0000024C\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"temperature.cooling-threshold\": {\n          \"ShortUUID\": \"0000000D\",\n          \"MinValue\": 10,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Cooling Threshold Temperature\",\n          \"Properties\": 7,\n          \"StepValue\": 0.10000000000000001,\n          \"MaxValue\": 35,\n          \"Units\": \"celsius\"\n        },\n        \"snr\": {\n          \"DefaultDescription\": \"Signal-to-noise Ratio\",\n          \"Format\": \"int\",\n          \"ShortUUID\": \"00000241\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"thread-openthread-version\": {\n          \"DefaultDescription\": \"Thread OpenThread Version\",\n          \"Format\": \"string\",\n          \"ShortUUID\": \"00000706\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"privilege\": {\n          \"ShortUUID\": \"000000E5\",\n          \"MinValue\": 0,\n          \"Format\": \"uint16\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Access Control Level\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 2\n        },\n        \"siri-endpoint-session-status\": {\n          \"DefaultDescription\": \"Siri Endpoint Session Status\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000254\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"nfc-access-control-point\": {\n          \"DefaultDescription\": \"NFC Access Control Point\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000264\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 6\n        },\n        \"siri-touch-to-use\": {\n          \"ShortUUID\": \"00000257\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Siri Touch To Use\",\n          \"Properties\": 7,\n          \"MaxValue\": 1\n        },\n        \"transmit-power-maximum\": {\n          \"DefaultDescription\": \"Maximum Transmit Power\",\n          \"Format\": \"int\",\n          \"ShortUUID\": \"00000243\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"serial-number\": {\n          \"ShortUUID\": \"00000030\",\n          \"Format\": \"string\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Serial Number\",\n          \"MaxLength\": 64,\n          \"Properties\": 2,\n          \"MinLength\": 1\n        },\n        \"visibility-state.target\": {\n          \"ShortUUID\": \"00000134\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Target Visibility State\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"visibility-state.current\": {\n          \"ShortUUID\": \"00000135\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Current Visibility State\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 3\n        },\n        \"vertical-tilt.current\": {\n          \"ShortUUID\": \"0000006E\",\n          \"MinValue\": -90,\n          \"Format\": \"int\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Current Vertical Tilt Angle\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 90,\n          \"Units\": \"arcdegrees\"\n        },\n        \"door-state.target\": {\n          \"ShortUUID\": \"00000032\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Target Door State\",\n          \"Properties\": 23,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"supported-rtp-configuration\": {\n          \"DefaultDescription\": \"Supported RTP Configuration\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000116\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"heater-cooler.state.current\": {\n          \"ShortUUID\": \"000000B1\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Current Heater-Cooler State\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 3\n        },\n        \"fan.state.target\": {\n          \"ShortUUID\": \"000000BF\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Target Fan State\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"status-tampered\": {\n          \"ShortUUID\": \"0000007A\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Status Tampered\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"temperature.target\": {\n          \"ShortUUID\": \"00000035\",\n          \"MinValue\": 10,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Target Temperature\",\n          \"Properties\": 7,\n          \"StepValue\": 0.10000000000000001,\n          \"MaxValue\": 38,\n          \"Units\": \"celsius\"\n        },\n        \"thread-status\": {\n          \"ShortUUID\": \"00000703\",\n          \"MinValue\": 0,\n          \"Format\": \"uint16\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Thread Status\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 6\n        },\n        \"tilt.target\": {\n          \"ShortUUID\": \"000000C2\",\n          \"MinValue\": -90,\n          \"Format\": \"int\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Target Tilt Angle\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 90,\n          \"Units\": \"arcdegrees\"\n        },\n        \"status-lo-batt\": {\n          \"ShortUUID\": \"00000079\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Status Low Battery\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"managed-network-enable\": {\n          \"ShortUUID\": \"00000215\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Managed Network Enable\",\n          \"Properties\": 39,\n          \"MaxValue\": 1\n        },\n        \"air-particulate.size\": {\n          \"ShortUUID\": \"00000065\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Air Particulate Size\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"saturation\": {\n          \"ShortUUID\": \"0000002F\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Saturation\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 100,\n          \"Units\": \"percentage\"\n        },\n        \"siri-light-on-use\": {\n          \"ShortUUID\": \"00000258\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Siri Light On Use\",\n          \"Properties\": 7,\n          \"MaxValue\": 1\n        },\n        \"status-active\": {\n          \"DefaultDescription\": \"Status Active\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"00000075\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"supported-camera-recording-configuration\": {\n          \"DefaultDescription\": \"Supported Camera Recording Configuration\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000205\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"activity-interval\": {\n          \"ShortUUID\": \"0000023B\",\n          \"MinValue\": 0,\n          \"Format\": \"uint32\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Activity Interval\",\n          \"StepValue\": 1,\n          \"Properties\": 3\n        },\n        \"set-duration\": {\n          \"ShortUUID\": \"000000D3\",\n          \"MinValue\": 0,\n          \"Format\": \"uint32\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Set Duration\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 3600,\n          \"Units\": \"seconds\"\n        },\n        \"wifi-capabilities\": {\n          \"DefaultDescription\": \"Wi-Fi Capabilities\",\n          \"Format\": \"uint32\",\n          \"ShortUUID\": \"0000022C\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"occupancy-detected\": {\n          \"ShortUUID\": \"00000071\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Occupancy Detected\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"audio-feedback\": {\n          \"DefaultDescription\": \"Audio Feedback\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"00000005\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 7\n        },\n        \"supported-video-recording-configuration\": {\n          \"DefaultDescription\": \"Supported Video Recording Configuration\",\n          \"Format\": \"tlv8\",\n          \"ShortUUID\": \"00000206\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 3\n        },\n        \"current-transport\": {\n          \"DefaultDescription\": \"Current Transport\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"0000022B\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"manufacturer\": {\n          \"DefaultDescription\": \"Manufacturer\",\n          \"MaxLength\": 64,\n          \"Format\": \"string\",\n          \"ShortUUID\": \"00000020\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"thread-node-capabilities\": {\n          \"ShortUUID\": \"00000702\",\n          \"MinValue\": 0,\n          \"Format\": \"uint16\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Thread Node Capabilities\",\n          \"Properties\": 2,\n          \"StepValue\": 1,\n          \"MaxValue\": 31\n        },\n        \"night-vision\": {\n          \"DefaultDescription\": \"Night Vision\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"0000011B\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 39\n        },\n        \"closed-captions\": {\n          \"ShortUUID\": \"000000DD\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Closed Captions\",\n          \"Properties\": 7,\n          \"StepValue\": 1,\n          \"MaxValue\": 1\n        },\n        \"lock-management.auto-secure-timeout\": {\n          \"Properties\": 7,\n          \"DefaultDescription\": \"Lock Management Auto Security Timeout\",\n          \"Format\": \"uint32\",\n          \"ShortUUID\": \"0000001A\",\n          \"Units\": \"seconds\",\n          \"LocalizationKey\": \"\"\n        },\n        \"recording-audio-active\": {\n          \"DefaultDescription\": \"recording audio active\",\n          \"Format\": \"uint8\",\n          \"ShortUUID\": \"00000226\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 39\n        },\n        \"program-mode\": {\n          \"ShortUUID\": \"000000D1\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Program Mode\",\n          \"Properties\": 3,\n          \"StepValue\": 1,\n          \"MaxValue\": 2\n        },\n        \"image-mirroring\": {\n          \"DefaultDescription\": \"Image Mirroring\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"0000011F\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 7\n        },\n        \"siri-engine-revision\": {\n          \"DefaultDescription\": \"Siri Engine Version\",\n          \"Format\": \"string\",\n          \"ShortUUID\": \"0000025A\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"position.hold\": {\n          \"DefaultDescription\": \"Hold Position\",\n          \"Format\": \"bool\",\n          \"ShortUUID\": \"0000006F\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 4\n        },\n        \"remote-key\": {\n          \"ShortUUID\": \"000000E1\",\n          \"MinValue\": 0,\n          \"Format\": \"uint8\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Remote Key\",\n          \"Properties\": 4,\n          \"StepValue\": 1,\n          \"MaxValue\": 16\n        },\n        \"supported-asset-types\": {\n          \"DefaultDescription\": \"Supported Asset Types\",\n          \"Format\": \"uint32\",\n          \"ShortUUID\": \"00000268\",\n          \"LocalizationKey\": \"\",\n          \"Properties\": 2\n        },\n        \"temperature.heating-threshold\": {\n          \"ShortUUID\": \"00000012\",\n          \"MinValue\": 0,\n          \"Format\": \"float\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Heating Threshold Temperature\",\n          \"Properties\": 7,\n          \"StepValue\": 0.10000000000000001,\n          \"MaxValue\": 25,\n          \"Units\": \"celsius\"\n        }\n      },\n      \"Properties\": {\n        \"hidden\": { \"LocalizationKey\": \"\", \"DefaultDescription\": \"Hidden\", \"Position\": 6 },\n        \"notify\": { \"LocalizationKey\": \"\", \"DefaultDescription\": \"Notify\", \"Position\": 0 },\n        \"write\": { \"LocalizationKey\": \"\", \"DefaultDescription\": \"Write\", \"Position\": 2 },\n        \"timedWrite\": { \"LocalizationKey\": \"\", \"DefaultDescription\": \"Timed Write Required\", \"Position\": 5 },\n        \"aa\": { \"LocalizationKey\": \"\", \"DefaultDescription\": \"Additional Authorization Needed\", \"Position\": 4 },\n        \"read\": { \"LocalizationKey\": \"\", \"DefaultDescription\": \"Read\", \"Position\": 1 },\n        \"adminOnly\": { \"LocalizationKey\": \"\", \"DefaultDescription\": \"Admin Only\", \"Position\": 8 },\n        \"broadcast\": { \"LocalizationKey\": \"\", \"DefaultDescription\": \"Broadcast State Changes\", \"Position\": 3 },\n        \"writeResponse\": { \"LocalizationKey\": \"\", \"DefaultDescription\": \"Write Response Needed\", \"Position\": 7 }\n      },\n      \"Units\": {\n        \"lux\": { \"DefaultDescription\": \"Lux\", \"LocalizationKey\": \"\" },\n        \"micrograms/m^3\": { \"DefaultDescription\": \"Micrograms Per Cubic Meter\", \"LocalizationKey\": \"\" },\n        \"celsius\": { \"DefaultDescription\": \"Celsius\", \"LocalizationKey\": \"\" },\n        \"seconds\": { \"DefaultDescription\": \"Seconds\", \"LocalizationKey\": \"\" },\n        \"fahrenheit\": { \"DefaultDescription\": \"Fahrenheit\", \"LocalizationKey\": \"\" },\n        \"ppm\": { \"DefaultDescription\": \"Parts Per Million\", \"LocalizationKey\": \"\" },\n        \"percentage\": { \"DefaultDescription\": \"Percentage\", \"LocalizationKey\": \"\" },\n        \"arcdegrees\": { \"DefaultDescription\": \"ArcDegrees\", \"LocalizationKey\": \"\" }\n      },\n      \"SupportsAuthorizationData\": {\n        \"door-state.target\": [\"garage-door-opener\"],\n        \"lock-mechanism.target-state\": [\"garage-door-opener\", \"lock-mechanism\"]\n      },\n      \"Services\": {\n        \"assistant\": {\n          \"Characteristics\": { \"Required\": [\"active\", \"identifier\", \"name\"] },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"0000026A\",\n          \"DefaultDescription\": \"Assistant\"\n        },\n        \"stateful-programmable-switch\": {\n          \"Characteristics\": { \"Required\": [\"input-event\", \"output-state\"], \"Optional\": [\"name\"] },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000088\",\n          \"DefaultDescription\": \"Stateful Programmable Switch\"\n        },\n        \"camera-operating-mode\": {\n          \"Characteristics\": {\n            \"Required\": [\"event-snapshots-active\", \"homekit-camera-active\"],\n            \"Optional\": [\n              \"camera-operating-mode-indicator\",\n              \"manually-disabled\",\n              \"night-vision\",\n              \"periodic-snapshots-active\",\n              \"third-party-camera-active\"\n            ]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"0000021A\",\n          \"DefaultDescription\": \"Camera Operating Mode\"\n        },\n        \"humidifier-dehumidifier\": {\n          \"Characteristics\": {\n            \"Required\": [\n              \"active\",\n              \"humidifier-dehumidifier.state.current\",\n              \"humidifier-dehumidifier.state.target\",\n              \"relative-humidity.current\"\n            ],\n            \"Optional\": [\n              \"lock-physical-controls\",\n              \"name\",\n              \"relative-humidity.dehumidifier-threshold\",\n              \"relative-humidity.humidifier-threshold\",\n              \"rotation.speed\",\n              \"swing-mode\",\n              \"water-level\"\n            ]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"000000BD\",\n          \"DefaultDescription\": \"Humidifier-Dehumidifier\"\n        },\n        \"stateless-programmable-switch\": {\n          \"Characteristics\": { \"Required\": [\"input-event\"], \"Optional\": [\"name\", \"service-label-index\"] },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000089\",\n          \"DefaultDescription\": \"Stateless Programmable Switch\"\n        },\n        \"nfc-access\": {\n          \"Characteristics\": {\n            \"Required\": [\"configuration-state\", \"nfc-access-control-point\", \"nfc-access-supported-configuration\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000266\",\n          \"DefaultDescription\": \"NFC Access Service\"\n        },\n        \"sensor.motion\": {\n          \"Characteristics\": {\n            \"Required\": [\"motion-detected\"],\n            \"Optional\": [\"name\", \"status-active\", \"status-fault\", \"status-lo-batt\", \"status-tampered\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000085\",\n          \"DefaultDescription\": \"Motion Sensor\"\n        },\n        \"speaker\": {\n          \"Characteristics\": {\n            \"Required\": [\"mute\"],\n            \"Optional\": [\"active\", \"volume\", \"volume-control-type\", \"volume-selector\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000113\",\n          \"DefaultDescription\": \"Speaker\"\n        },\n        \"metrics\": {\n          \"Characteristics\": { \"Required\": [\"active\"] },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000270\",\n          \"DefaultDescription\": \"Accessory Metrics\"\n        },\n        \"input-source\": {\n          \"Characteristics\": {\n            \"Required\": [\"configured-name\", \"input-source-type\", \"is-configured\", \"name\", \"visibility-state.current\"],\n            \"Optional\": [\"identifier\", \"input-device-type\", \"visibility-state.target\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"000000D9\",\n          \"DefaultDescription\": \"Input Source\"\n        },\n        \"accessory-runtime-information\": {\n          \"Characteristics\": {\n            \"Required\": [\"ping\"],\n            \"Optional\": [\"activity-interval\", \"heart-beat\", \"sleep-interval\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000239\",\n          \"DefaultDescription\": \"Accessory Runtime Information\"\n        },\n        \"sensor.light\": {\n          \"Characteristics\": {\n            \"Required\": [\"light-level.current\"],\n            \"Optional\": [\"name\", \"status-active\", \"status-fault\", \"status-lo-batt\", \"status-tampered\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000084\",\n          \"DefaultDescription\": \"Light Sensor\"\n        },\n        \"fan\": {\n          \"DefaultDescription\": \"Fan\",\n          \"Characteristics\": { \"Required\": [\"on\"], \"Optional\": [\"name\", \"rotation.direction\", \"rotation.speed\"] },\n          \"ShortUUID\": \"00000040\",\n          \"LocalizationKey\": \"\",\n          \"BTLE_ShortUUID\": \"FECB\"\n        },\n        \"filter-maintenance\": {\n          \"Characteristics\": {\n            \"Required\": [\"filter.change-indication\"],\n            \"Optional\": [\"filter.life-level\", \"filter.reset-indication\", \"name\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"000000BA\",\n          \"DefaultDescription\": \"Filter Maintenance\"\n        },\n        \"sensor.carbon-dioxide\": {\n          \"Characteristics\": {\n            \"Required\": [\"carbon-dioxide.detected\"],\n            \"Optional\": [\n              \"carbon-dioxide.level\",\n              \"carbon-dioxide.peak-level\",\n              \"name\",\n              \"status-active\",\n              \"status-fault\",\n              \"status-lo-batt\",\n              \"status-tampered\"\n            ]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000097\",\n          \"DefaultDescription\": \"Carbon dioxide Sensor\"\n        },\n        \"valve\": {\n          \"Characteristics\": {\n            \"Required\": [\"active\", \"in-use\", \"valve-type\"],\n            \"Optional\": [\n              \"is-configured\",\n              \"name\",\n              \"remaining-duration\",\n              \"service-label-index\",\n              \"set-duration\",\n              \"status-fault\"\n            ]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"000000D0\",\n          \"DefaultDescription\": \"Valve\"\n        },\n        \"thread-transport\": {\n          \"Characteristics\": {\n            \"Required\": [\"current-transport\", \"thread-control-point\", \"thread-node-capabilities\", \"thread-status\"],\n            \"Optional\": [\n              \"cca-energy-detect-threshold\",\n              \"cca-signal-detect-threshold\",\n              \"event-retransmission-maximum\",\n              \"event-transmission-counters\",\n              \"mac-retransmission-maximum\",\n              \"mac-transmission-counters\",\n              \"receiver-sensitivity\",\n              \"rssi\",\n              \"snr\",\n              \"thread-openthread-version\",\n              \"transmit-power\",\n              \"transmit-power-maximum\"\n            ]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000701\",\n          \"DefaultDescription\": \"Thread Transport\"\n        },\n        \"air-purifier\": {\n          \"Characteristics\": {\n            \"Required\": [\"active\", \"air-purifier.state.current\", \"air-purifier.state.target\"],\n            \"Optional\": [\"lock-physical-controls\", \"name\", \"rotation.speed\", \"swing-mode\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"000000BB\",\n          \"DefaultDescription\": \"Air Purifier\"\n        },\n        \"irrigation-system\": {\n          \"Characteristics\": {\n            \"Required\": [\"active\", \"program-mode\", \"in-use\"],\n            \"Optional\": [\"remaining-duration\", \"name\", \"status-fault\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"000000CF\",\n          \"DefaultDescription\": \"Irrigation-System\"\n        },\n        \"wifi-router\": {\n          \"Characteristics\": {\n            \"Required\": [\n              \"configured-name\",\n              \"managed-network-enable\",\n              \"network-access-violation-control\",\n              \"network-client-control\",\n              \"network-client-status-control\",\n              \"router-status\",\n              \"supported-router-configuration\",\n              \"wan-configuration-list\",\n              \"wan-status-list\"\n            ]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"0000020A\",\n          \"DefaultDescription\": \"Wi-Fi Router\"\n        },\n        \"garage-door-opener\": {\n          \"DefaultDescription\": \"Garage Door Opener\",\n          \"Characteristics\": {\n            \"Required\": [\"door-state.current\", \"door-state.target\", \"obstruction-detected\"],\n            \"Optional\": [\"lock-mechanism.current-state\", \"lock-mechanism.target-state\", \"name\"]\n          },\n          \"ShortUUID\": \"00000041\",\n          \"LocalizationKey\": \"\",\n          \"BTLE_ShortUUID\": \"FECE\"\n        },\n        \"cloud-relay\": {\n          \"Characteristics\": {\n            \"Required\": [\"cloud-relay.control-point\", \"cloud-relay.current-state\", \"cloud-relay.enabled\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"0000005A\",\n          \"DefaultDescription\": \"Cloud Relay\"\n        },\n        \"diagnostics\": {\n          \"Characteristics\": {\n            \"Required\": [\"supported-diagnostics-snapshot\"],\n            \"Optional\": [\"selected-diagnostics-modes\", \"supported-diagnostics-modes\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000237\",\n          \"DefaultDescription\": \"Diagnostics\"\n        },\n        \"target-control\": {\n          \"Characteristics\": { \"Required\": [\"active\", \"active-identifier\", \"button-event\"], \"Optional\": [\"name\"] },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000125\",\n          \"DefaultDescription\": \"Target Control\"\n        },\n        \"sensor.leak\": {\n          \"Characteristics\": {\n            \"Required\": [\"leak-detected\"],\n            \"Optional\": [\"name\", \"status-active\", \"status-fault\", \"status-lo-batt\", \"status-tampered\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000083\",\n          \"DefaultDescription\": \"Leak Sensor\"\n        },\n        \"asset-update\": {\n          \"Characteristics\": { \"Required\": [\"asset-update-readiness\", \"supported-asset-types\"] },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000267\",\n          \"DefaultDescription\": \"Asset Update\"\n        },\n        \"sensor.temperature\": {\n          \"Characteristics\": {\n            \"Required\": [\"temperature.current\"],\n            \"Optional\": [\"name\", \"status-active\", \"status-fault\", \"status-lo-batt\", \"status-tampered\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"0000008A\",\n          \"DefaultDescription\": \"Temperature Sensor\"\n        },\n        \"sensor.carbon-monoxide\": {\n          \"Characteristics\": {\n            \"Required\": [\"carbon-monoxide.detected\"],\n            \"Optional\": [\n              \"carbon-monoxide.level\",\n              \"carbon-monoxide.peak-level\",\n              \"name\",\n              \"status-active\",\n              \"status-fault\",\n              \"status-lo-batt\",\n              \"status-tampered\"\n            ]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"0000007F\",\n          \"DefaultDescription\": \"Carbon monoxide Sensor\"\n        },\n        \"data-stream-transport-management\": {\n          \"Characteristics\": {\n            \"Required\": [\"setup-data-stream-transport\", \"supported-data-stream-transport-configuration\", \"version\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000129\",\n          \"DefaultDescription\": \"Data Stream Transport Management\"\n        },\n        \"sensor.contact\": {\n          \"AllowAssociatedService\": 1,\n          \"Characteristics\": {\n            \"Required\": [\"contact-state\"],\n            \"Optional\": [\"name\", \"status-active\", \"status-fault\", \"status-lo-batt\", \"status-tampered\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000080\",\n          \"DefaultDescription\": \"Contact Sensor\"\n        },\n        \"doorbell\": {\n          \"Characteristics\": {\n            \"Required\": [\"input-event\"],\n            \"Optional\": [\"brightness\", \"mute\", \"name\", \"operating-state-response\", \"volume\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000121\",\n          \"DefaultDescription\": \"Doorbell\"\n        },\n        \"protocol-information\": {\n          \"Characteristics\": { \"Required\": [\"version\"] },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"000000A2\",\n          \"DefaultDescription\": \"Protocol Information\"\n        },\n        \"window\": {\n          \"Characteristics\": {\n            \"Required\": [\"position.current\", \"position.state\", \"position.target\"],\n            \"Optional\": [\"name\", \"obstruction-detected\", \"position.hold\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"0000008B\",\n          \"DefaultDescription\": \"Window\"\n        },\n        \"wifi-satellite\": {\n          \"Characteristics\": { \"Required\": [\"wifi-satellite-status\"] },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"0000020F\",\n          \"DefaultDescription\": \"Wi-Fi Satellite\"\n        },\n        \"pairing\": {\n          \"DefaultDescription\": \"Pairing\",\n          \"Characteristics\": { \"Required\": [\"list-pairings\", \"pair-setup\", \"pair-verify\", \"pairing-features\"] },\n          \"ShortUUID\": \"00000055\",\n          \"LocalizationKey\": \"\",\n          \"BTLE_ShortUUID\": \"FED4\"\n        },\n        \"sensor.smoke\": {\n          \"Characteristics\": {\n            \"Required\": [\"smoke-detected\"],\n            \"Optional\": [\"name\", \"status-active\", \"status-fault\", \"status-lo-batt\", \"status-tampered\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000087\",\n          \"DefaultDescription\": \"Smoke Sensor\"\n        },\n        \"slats\": {\n          \"Characteristics\": {\n            \"Required\": [\"slat.state.current\", \"slat.type\"],\n            \"Optional\": [\"name\", \"swing-mode\", \"tilt.current\", \"tilt.target\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"000000B9\",\n          \"DefaultDescription\": \"Slats\"\n        },\n        \"battery\": {\n          \"Characteristics\": {\n            \"Required\": [\"status-lo-batt\"],\n            \"Optional\": [\"battery-level\", \"charging-state\", \"name\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000096\",\n          \"DefaultDescription\": \"Battery\"\n        },\n        \"thermostat\": {\n          \"DefaultDescription\": \"Thermostat\",\n          \"Characteristics\": {\n            \"Required\": [\n              \"heating-cooling.current\",\n              \"heating-cooling.target\",\n              \"temperature.current\",\n              \"temperature.target\",\n              \"temperature.units\"\n            ],\n            \"Optional\": [\n              \"name\",\n              \"relative-humidity.current\",\n              \"relative-humidity.target\",\n              \"temperature.cooling-threshold\",\n              \"temperature.heating-threshold\"\n            ]\n          },\n          \"ShortUUID\": \"0000004A\",\n          \"LocalizationKey\": \"\",\n          \"BTLE_ShortUUID\": \"FED1\"\n        },\n        \"lock-mechanism\": {\n          \"DefaultDescription\": \"Lock Mechanism\",\n          \"Characteristics\": {\n            \"Required\": [\"lock-mechanism.current-state\", \"lock-mechanism.target-state\"],\n            \"Optional\": [\"name\"]\n          },\n          \"ShortUUID\": \"00000045\",\n          \"LocalizationKey\": \"\",\n          \"BTLE_ShortUUID\": \"FED0\"\n        },\n        \"microphone\": {\n          \"Characteristics\": { \"Required\": [\"mute\"], \"Optional\": [\"volume\"] },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000112\",\n          \"DefaultDescription\": \"Microphone\"\n        },\n        \"target-control-management\": {\n          \"Characteristics\": { \"Required\": [\"supported-target-configuration\", \"target-list\"] },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000122\",\n          \"DefaultDescription\": \"Target Control Management\"\n        },\n        \"lock-management\": {\n          \"DefaultDescription\": \"Lock Management\",\n          \"Characteristics\": {\n            \"Required\": [\"lock-management.control-point\", \"version\"],\n            \"Optional\": [\n              \"administrator-only-access\",\n              \"audio-feedback\",\n              \"door-state.current\",\n              \"lock-management.auto-secure-timeout\",\n              \"lock-mechanism.last-known-action\",\n              \"logs\",\n              \"motion-detected\"\n            ]\n          },\n          \"ShortUUID\": \"00000044\",\n          \"LocalizationKey\": \"\",\n          \"BTLE_ShortUUID\": \"FECF\"\n        },\n        \"sensor.occupancy\": {\n          \"Characteristics\": {\n            \"Required\": [\"occupancy-detected\"],\n            \"Optional\": [\"name\", \"status-active\", \"status-fault\", \"status-lo-batt\", \"status-tampered\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000086\",\n          \"DefaultDescription\": \"Occupancy Sensor\"\n        },\n        \"siri-endpoint\": {\n          \"Characteristics\": {\n            \"Required\": [\"siri-endpoint-session-status\", \"version\"],\n            \"Optional\": [\"active-identifier\", \"manually-disabled\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000253\",\n          \"DefaultDescription\": \"Siri Endpoint\"\n        },\n        \"siri\": {\n          \"Characteristics\": {\n            \"Required\": [\"siri-input-type\"],\n            \"Optional\": [\n              \"multifunction-button\",\n              \"siri-enable\",\n              \"siri-engine-revision\",\n              \"siri-light-on-use\",\n              \"siri-listening\",\n              \"siri-touch-to-use\"\n            ]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000133\",\n          \"DefaultDescription\": \"Siri\"\n        },\n        \"audio-stream-management\": {\n          \"Characteristics\": {\n            \"Required\": [\"supported-audio-stream-configuration\", \"selected-audio-stream-configuration\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000127\",\n          \"DefaultDescription\": \"Audio Stream Management\"\n        },\n        \"smart-speaker\": {\n          \"Characteristics\": {\n            \"Required\": [\"media-state.current\", \"media-state.target\"],\n            \"Optional\": [\"airplay-enable\", \"configured-name\", \"mute\", \"name\", \"volume\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000228\",\n          \"DefaultDescription\": \"Speaker\"\n        },\n        \"faucet\": {\n          \"Characteristics\": { \"Required\": [\"active\"], \"Optional\": [\"name\", \"status-fault\"] },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"000000D7\",\n          \"DefaultDescription\": \"Faucet\"\n        },\n        \"door\": {\n          \"Characteristics\": {\n            \"Required\": [\"position.current\", \"position.state\", \"position.target\"],\n            \"Optional\": [\"name\", \"obstruction-detected\", \"position.hold\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000081\",\n          \"DefaultDescription\": \"Door\"\n        },\n        \"security-system\": {\n          \"Characteristics\": {\n            \"Required\": [\"security-system-state.current\", \"security-system-state.target\"],\n            \"Optional\": [\"name\", \"security-system.alarm-type\", \"status-fault\", \"status-tampered\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"0000007E\",\n          \"DefaultDescription\": \"Security System\"\n        },\n        \"camera-rtp-stream-management\": {\n          \"Characteristics\": {\n            \"Required\": [\n              \"selected-stream-configuration\",\n              \"setup-stream-endpoint\",\n              \"streaming-status\",\n              \"supported-audio-stream-configuration\",\n              \"supported-rtp-configuration\",\n              \"supported-video-stream-configuration\"\n            ],\n            \"Optional\": [\"active\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000110\",\n          \"DefaultDescription\": \"Camera Stream Management\"\n        },\n        \"sensor.air-quality\": {\n          \"Characteristics\": {\n            \"Required\": [\"air-quality\"],\n            \"Optional\": [\n              \"density.no2\",\n              \"density.ozone\",\n              \"density.pm10\",\n              \"density.pm2_5\",\n              \"density.so2\",\n              \"density.voc\",\n              \"name\",\n              \"status-active\",\n              \"status-fault\",\n              \"status-lo-batt\",\n              \"status-tampered\"\n            ]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"0000008D\",\n          \"DefaultDescription\": \"Air Quality Sensor\"\n        },\n        \"television\": {\n          \"Characteristics\": {\n            \"Required\": [\"active\", \"active-identifier\", \"configured-name\", \"remote-key\", \"sleep-discovery-mode\"],\n            \"Optional\": [\n              \"brightness\",\n              \"closed-captions\",\n              \"display-order\",\n              \"media-state.current\",\n              \"media-state.target\",\n              \"name\",\n              \"picture-mode\",\n              \"power-mode-selection\"\n            ]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"000000D8\",\n          \"DefaultDescription\": \"Television\"\n        },\n        \"transfer-transport-management\": {\n          \"Characteristics\": { \"Required\": [\"supported-transfer-transport-configuration\", \"setup-transfer-transport\"] },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000203\",\n          \"DefaultDescription\": \"Transfer Transport Management\"\n        },\n        \"heater-cooler\": {\n          \"Characteristics\": {\n            \"Required\": [\"active\", \"heater-cooler.state.current\", \"heater-cooler.state.target\", \"temperature.current\"],\n            \"Optional\": [\n              \"lock-physical-controls\",\n              \"name\",\n              \"rotation.speed\",\n              \"swing-mode\",\n              \"temperature.cooling-threshold\",\n              \"temperature.heating-threshold\",\n              \"temperature.units\"\n            ]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"000000BC\",\n          \"DefaultDescription\": \"Heater-Cooler\"\n        },\n        \"accessory-information\": {\n          \"DefaultDescription\": \"Accessory Information Service\",\n          \"Characteristics\": {\n            \"Required\": [\"identify\", \"manufacturer\", \"model\", \"name\", \"serial-number\"],\n            \"Optional\": [\n              \"accessory-flags\",\n              \"app-matching-identifier\",\n              \"configured-name\",\n              \"firmware.revision\",\n              \"hardware-finish\",\n              \"hardware.revision\",\n              \"product-data\",\n              \"software.revision\"\n            ]\n          },\n          \"ShortUUID\": \"0000003E\",\n          \"LocalizationKey\": \"\",\n          \"BTLE_ShortUUID\": \"FED3\"\n        },\n        \"outlet\": {\n          \"BTLE_ShortUUID\": \"FECC\",\n          \"Characteristics\": { \"Required\": [\"on\"], \"Optional\": [\"name\", \"outlet-in-use\"] },\n          \"AllowAssociatedService\": 1,\n          \"ShortUUID\": \"00000047\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Outlet\"\n        },\n        \"sensor.humidity\": {\n          \"Characteristics\": {\n            \"Required\": [\"relative-humidity.current\"],\n            \"Optional\": [\"name\", \"status-active\", \"status-fault\", \"status-lo-batt\", \"status-tampered\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000082\",\n          \"DefaultDescription\": \"Humidity Sensor\"\n        },\n        \"fanv2\": {\n          \"Characteristics\": {\n            \"Required\": [\"active\"],\n            \"Optional\": [\n              \"fan.state.current\",\n              \"fan.state.target\",\n              \"lock-physical-controls\",\n              \"name\",\n              \"rotation.direction\",\n              \"rotation.speed\",\n              \"swing-mode\"\n            ]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"000000B7\",\n          \"DefaultDescription\": \"Fan\"\n        },\n        \"access-code\": {\n          \"Characteristics\": {\n            \"Required\": [\"access-code-control-point\", \"access-code-supported-configuration\", \"configuration-state\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000260\",\n          \"DefaultDescription\": \"Access Code\"\n        },\n        \"lightbulb\": {\n          \"DefaultDescription\": \"Lightbulb\",\n          \"Characteristics\": {\n            \"Required\": [\"on\"],\n            \"Optional\": [\n              \"brightness\",\n              \"characteristic-value-active-transition-count\",\n              \"characteristic-value-transition-control\",\n              \"color-temperature\",\n              \"hue\",\n              \"name\",\n              \"saturation\",\n              \"supported-characteristic-value-transition-configuration\"\n            ]\n          },\n          \"ShortUUID\": \"00000043\",\n          \"LocalizationKey\": \"\",\n          \"BTLE_ShortUUID\": \"FED2\"\n        },\n        \"service-label\": {\n          \"Characteristics\": { \"Required\": [\"service-label-namespace\"] },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"000000CC\",\n          \"DefaultDescription\": \"Label\"\n        },\n        \"camera-recording-management\": {\n          \"Characteristics\": {\n            \"Required\": [\n              \"active\",\n              \"supported-camera-recording-configuration\",\n              \"supported-video-recording-configuration\",\n              \"supported-audio-recording-configuration\",\n              \"selected-camera-recording-configuration\"\n            ],\n            \"Optional\": [\"recording-audio-active\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000204\",\n          \"DefaultDescription\": \"Camera Recording Management\"\n        },\n        \"switch\": {\n          \"BTLE_ShortUUID\": \"FECD\",\n          \"Characteristics\": { \"Required\": [\"on\"], \"Optional\": [\"name\"] },\n          \"AllowAssociatedService\": 1,\n          \"ShortUUID\": \"00000049\",\n          \"LocalizationKey\": \"\",\n          \"DefaultDescription\": \"Switch\"\n        },\n        \"access-control\": {\n          \"Characteristics\": { \"Required\": [\"privilege\"], \"Optional\": [\"password-setting\"] },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"000000DA\",\n          \"DefaultDescription\": \"Access Control\"\n        },\n        \"power-management\": {\n          \"Characteristics\": { \"Required\": [\"wake-configuration\"], \"Optional\": [] },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"00000221\",\n          \"DefaultDescription\": \"Power Management\"\n        },\n        \"wifi-transport\": {\n          \"Characteristics\": {\n            \"Required\": [\"current-transport\", \"wifi-capabilities\"],\n            \"Optional\": [\"wifi-configuration-control\"]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"0000022A\",\n          \"DefaultDescription\": \"Wi-Fi Transport\"\n        },\n        \"window-covering\": {\n          \"Characteristics\": {\n            \"Required\": [\"position.current\", \"position.state\", \"position.target\"],\n            \"Optional\": [\n              \"horizontal-tilt.current\",\n              \"horizontal-tilt.target\",\n              \"name\",\n              \"obstruction-detected\",\n              \"position.hold\",\n              \"vertical-tilt.current\",\n              \"vertical-tilt.target\"\n            ]\n          },\n          \"LocalizationKey\": \"\",\n          \"ShortUUID\": \"0000008C\",\n          \"DefaultDescription\": \"Window Covering\"\n        }\n      }\n    },\n    \"Version\": 880,\n    \"SchemaVersion\": 1,\n    \"Assistant\": {\n      \"Characteristics\": {\n        \"CONTROL_LOCK\": { \"Format\": \"int\", \"ReadWrite\": \"lock-physical-controls\" },\n        \"HEATING_COOLING_MODE\": {\n          \"Read\": \"heating-cooling.current\",\n          \"Values\": { \"COOL\": 2, \"AUTO\": 3, \"HEAT\": 1, \"OFF\": 0 },\n          \"Format\": \"string\",\n          \"Write\": \"heating-cooling.target\"\n        },\n        \"OUTLET_IN_USE\": { \"Format\": \"bool\", \"Read\": \"outlet-in-use\" },\n        \"HEATING_THRESHOLD\": {\n          \"Format\": \"float\",\n          \"SupportsLocalization\": 1,\n          \"ReadWrite\": \"temperature.heating-threshold\"\n        },\n        \"CARBON_MONOXIDE_PEAK_LEVEL\": { \"Format\": \"float\", \"Read\": \"carbon-monoxide.peak-level\" },\n        \"COOLING_THRESHOLD\": {\n          \"Format\": \"float\",\n          \"SupportsLocalization\": 1,\n          \"ReadWrite\": \"temperature.cooling-threshold\"\n        },\n        \"HEATER_COOLER_MODE\": {\n          \"OutValues\": { \"3\": \"COOLING\", \"1\": \"IDLE\", \"2\": \"HEATING\", \"0\": \"INACTIVE\" },\n          \"Read\": \"heater-cooler.state.current\",\n          \"Format\": \"string\",\n          \"Values\": { \"AUTO\": 0, \"HEAT_AUTO\": 1, \"COOL_AUTO\": 2 },\n          \"Write\": \"heater-cooler.state.target\"\n        },\n        \"PROGRAM_MODE\": { \"Format\": \"int\", \"Read\": \"program-mode\" },\n        \"FILTER_CHANGE\": {\n          \"Values\": { \"CHANGE\": 1, \"NO_CHANGE\": 0 },\n          \"Format\": \"string\",\n          \"Read\": \"filter.change-indication\"\n        },\n        \"AIR_PARTICULATE_DENSITY\": { \"Format\": \"float\", \"Read\": \"air-particulate.density\" },\n        \"TILT\": { \"Write\": \"tilt.target\", \"Format\": \"int\", \"Read\": \"tilt.current\" },\n        \"DURATION\": { \"Format\": \"int\", \"ReadWrite\": \"set-duration\" },\n        \"SATURATION\": { \"Format\": \"float\", \"ReadWrite\": \"saturation\" },\n        \"CARBON_DIOXIDE_DETECTED\": {\n          \"Values\": { \"ABNORMAL\": 1, \"NORMAL\": 0 },\n          \"Format\": \"string\",\n          \"Read\": \"carbon-dioxide.detected\"\n        },\n        \"AMBIENT_LIGHT_LEVEL\": { \"Format\": \"float\", \"Read\": \"light-level.current\" },\n        \"CARBON_DIOXIDE_LEVEL\": { \"Format\": \"float\", \"Read\": \"carbon-dioxide.level\" },\n        \"CARBON_MONOXIDE_DETECTED\": { \"Format\": \"bool\", \"Read\": \"carbon-monoxide.detected\" },\n        \"IN_USE\": { \"Format\": \"int\", \"Read\": \"in-use\" },\n        \"IDENTIFY\": { \"Write\": \"identify\", \"Format\": \"bool\" },\n        \"ROTATION_SPEED\": { \"Format\": \"float\", \"ReadWrite\": \"rotation.speed\" },\n        \"HUMIDIFIER_THRESHOLD\": { \"Format\": \"float\", \"ReadWrite\": \"relative-humidity.humidifier-threshold\" },\n        \"NITROGEN_DIOXIDE_DENSITY\": { \"Format\": \"float\", \"Read\": \"density.no2\" },\n        \"REMAINING_DURATION\": { \"Format\": \"int\", \"Read\": \"remaining-duration\" },\n        \"CONTACT_DETECTED\": { \"Values\": { \"0\": \"0\", \"1\": \"1\" }, \"Format\": \"int\", \"Read\": \"contact-state\" },\n        \"HUMIDIFIER_DEHUMIDIFIER_MODE\": {\n          \"OutValues\": { \"3\": \"DEHUMIDIFYING\", \"1\": \"IDLE\", \"2\": \"HUMIDIFYING\", \"0\": \"INACTIVE\" },\n          \"Read\": \"humidifier-dehumidifier.state.current\",\n          \"Format\": \"string\",\n          \"Values\": { \"AUTO\": 0, \"HUMIDIFY_AUTO\": 1, \"DEHUMIDIFY_AUTO\": 2 },\n          \"Write\": \"humidifier-dehumidifier.state.target\"\n        },\n        \"SLAT_OPERATING_MODE\": {\n          \"OutValues\": { \"3\": \"JAMMED\", \"1\": \"FIXED\", \"2\": \"SWINGING\", \"0\": \"INACTIVE\" },\n          \"Read\": \"slat.state.current\",\n          \"Format\": \"string\",\n          \"Values\": { \"AUTO\": 1, \"MANUAL\": 0 }\n        },\n        \"BRIGHTNESS\": { \"Format\": \"int\", \"ReadWrite\": \"brightness\" },\n        \"FAN_OPERATING_MODE\": {\n          \"OutValues\": { \"0\": \"INACTIVE\", \"1\": \"IDLE\", \"2\": \"BLOWING\" },\n          \"Read\": \"fan.state.current\",\n          \"Format\": \"string\",\n          \"Values\": { \"AUTO\": 1, \"MANUAL\": 0 },\n          \"Write\": \"fan.state.target\"\n        },\n        \"CARBON_DIOXIDE_PEAK_LEVEL\": { \"Format\": \"float\", \"Read\": \"carbon-dioxide.peak-level\" },\n        \"ROTATION_DIRECTION\": {\n          \"Values\": { \"COUNTERCLOCKWISE\": 1, \"CLOCKWISE\": 0 },\n          \"Format\": \"string\",\n          \"ReadWrite\": \"rotation.direction\"\n        },\n        \"AIR_PURIFIER_OPERATING_MODE\": {\n          \"OutValues\": { \"0\": \"INACTIVE\", \"1\": \"IDLE\", \"2\": \"PURIFYING_AIR\" },\n          \"Read\": \"air-purifier.state.current\",\n          \"Format\": \"string\",\n          \"Values\": { \"AUTO\": 1, \"MANUAL\": 0 },\n          \"Write\": \"air-purifier.state.target\"\n        },\n        \"OCCUPANCY_DETECTED\": {\n          \"Values\": { \"OCCUPANCY_DETECTED\": 1, \"OCCUPANCY_NOT_DETECTED\": 0 },\n          \"Format\": \"string\",\n          \"Read\": \"occupancy-detected\"\n        },\n        \"DEHUMIDIFIER_THRESHOLD\": { \"Format\": \"float\", \"ReadWrite\": \"relative-humidity.dehumidifier-threshold\" },\n        \"SMOKE_DETECTED\": { \"Format\": \"bool\", \"Read\": \"smoke-detected\" },\n        \"TEMPERATURE\": {\n          \"Read\": \"temperature.current\",\n          \"SupportsLocalization\": 1,\n          \"Format\": \"float\",\n          \"Write\": \"temperature.target\"\n        },\n        \"POSITION\": { \"Write\": \"position.target\", \"Format\": \"int\", \"Read\": \"position.current\" },\n        \"RAISE\": {\n          \"OutValues\": { \"3\": 3, \"1\": 0, \"4\": 4, \"2\": 2, \"0\": 1 },\n          \"Read\": \"door-state.current\",\n          \"Format\": \"int\",\n          \"Values\": { \"0\": 1, \"1\": 0 },\n          \"Write\": \"door-state.target\"\n        },\n        \"LOCK\": {\n          \"Read\": \"lock-mechanism.current-state\",\n          \"Values\": { \"0\": 0, \"1\": 1 },\n          \"Format\": \"int\",\n          \"Write\": \"lock-mechanism.target-state\"\n        },\n        \"LOW_BATTERY\": {\n          \"Values\": { \"BATTERY_NORMAL\": 0, \"BATTERY_LOW\": 1 },\n          \"Format\": \"string\",\n          \"Read\": \"status-lo-batt\"\n        },\n        \"HUMIDITY\": { \"Write\": \"relative-humidity.target\", \"Format\": \"float\", \"Read\": \"relative-humidity.current\" },\n        \"HUE\": { \"Format\": \"float\", \"ReadWrite\": \"hue\" },\n        \"MOTION_DETECTED\": { \"Format\": \"bool\", \"Read\": \"motion-detected\" },\n        \"SECURITY_SYSTEM_STATE\": {\n          \"Read\": \"security-system-state.current\",\n          \"Values\": { \"DISARM\": 3, \"ALARM_TRIGGERED\": 4, \"NIGHT_ARM\": 2, \"AWAY_ARM\": 1, \"STAY_ARM\": 0 },\n          \"Format\": \"string\",\n          \"Write\": \"security-system-state.target\"\n        },\n        \"PARTICULATE_MATTER_2_5_DENSITY\": { \"Format\": \"float\", \"Read\": \"density.pm2_5\" },\n        \"FILTER_LIFE\": { \"Format\": \"float\", \"ReadWrite\": \"filter.life-level\" },\n        \"VOLATILE_ORGANIC_COMPOUND_DENSITY\": { \"Format\": \"float\", \"Read\": \"density.voc\" },\n        \"CHARGING_STATE\": {\n          \"Values\": { \"NOT_CHARGEABLE\": 2, \"CHARGING\": 1, \"NOT_CHARGING\": 0 },\n          \"Format\": \"string\",\n          \"Read\": \"charging-state\"\n        },\n        \"CARBON_MONOXIDE_LEVEL\": { \"Format\": \"float\", \"Read\": \"carbon-monoxide.level\" },\n        \"PARTICULATE_MATTER_10_DENSITY\": { \"Format\": \"float\", \"Read\": \"density.pm10\" },\n        \"LEAK_DETECTED\": {\n          \"Values\": { \"LEAK_NOT_DETECTED\": 0, \"LEAK_DETECTED\": 1 },\n          \"Format\": \"string\",\n          \"Read\": \"leak-detected\"\n        },\n        \"OZONE_DENSITY\": { \"Format\": \"float\", \"Read\": \"density.ozone\" },\n        \"AIR_QUALITY_RATING\": {\n          \"Values\": { \"GOOD\": 2, \"POOR\": 5, \"INFERIOR\": 4, \"EXCELLENT\": 1, \"FAIR\": 3, \"UNKNOWN\": 0 },\n          \"Format\": \"string\",\n          \"Read\": \"air-quality\"\n        },\n        \"OBSTRUCTION_DETECTED\": { \"Format\": \"bool\", \"Read\": \"obstruction-detected\" },\n        \"SWING_MODE\": { \"Format\": \"bool\", \"ReadWrite\": \"swing-mode\" },\n        \"POWER\": { \"Format\": \"bool\", \"ReadWrite\": \"on\" },\n        \"BATTERY_LEVEL\": { \"Format\": \"int\", \"Read\": \"battery-level\" },\n        \"SULPHUR_DIOXIDE_DENSITY\": { \"Format\": \"float\", \"Read\": \"density.so2\" },\n        \"WATER_LEVEL\": { \"Format\": \"float\", \"Read\": \"water-level\" }\n      },\n      \"Services\": {\n        \"LEAK_SENSOR\": \"sensor.leak\",\n        \"TELEVISION\": \"television\",\n        \"AIR_QUALITY_SENSOR\": \"sensor.air-quality\",\n        \"HEATER_COOLER\": \"heater-cooler\",\n        \"LIGHTBULB\": \"lightbulb\",\n        \"HUMIDIFIER_DEHUMIDIFIER\": \"humidifier-dehumidifier\",\n        \"HUMIDITY_SENSOR\": \"sensor.humidity\",\n        \"LIGHT_SENSOR\": \"sensor.light\",\n        \"CARBON_DIOXIDE_SENSOR\": \"sensor.carbon-dioxide\",\n        \"OUTLET\": \"outlet\",\n        \"FAUCET\": \"faucet\",\n        \"GARAGE_DOOR_OPENER\": \"garage-door-opener\",\n        \"SHADES\": \"window-covering\",\n        \"AIR_PURIFIER\": \"air-purifier\",\n        \"SLAT\": \"slats\",\n        \"SWITCH\": \"switch\",\n        \"IRRIGATION_SYSTEM\": \"irrigation-system\",\n        \"CARBON_MONOXIDE_SENSOR\": \"sensor.carbon-monoxide\",\n        \"DOOR_LOCK\": \"lock-mechanism\",\n        \"SECURITY_SYSTEM\": \"security-system\",\n        \"MOTORIZED_WINDOW\": \"window\",\n        \"TEMPERATURE_SENSOR\": \"sensor.temperature\",\n        \"BATTERY_SERVICE\": \"battery\",\n        \"CONTACT_SENSOR\": \"sensor.contact\",\n        \"FILTER_MAINTENANCE\": \"filter-maintenance\",\n        \"VALVE\": \"valve\",\n        \"MOTION_SENSOR\": \"sensor.motion\",\n        \"VENTILATION_FAN\": \"fan\",\n        \"OCCUPANCY_SENSOR\": \"sensor.occupancy\",\n        \"SMOKE_SENSOR\": \"sensor.smoke\",\n        \"THERMOSTAT\": \"thermostat\",\n        \"MOTORIZED_DOOR\": \"door\"\n      },\n      \"Units\": {\n        \"PERCENT\": \"percentage\",\n        \"CELSIUS\": \"celsius\",\n        \"FAHRENHEIT\": \"fahrenheit\",\n        \"ARC_DEGREES\": \"arcdegrees\",\n        \"LUX\": \"lux\",\n        \"SECONDS\": \"seconds\"\n      }\n    }\n  },\n  \"SchemaVersion\": 1\n}\n"
  },
  {
    "path": "codegen/src/main.rs",
    "content": "use handlebars::{Context, Handlebars, Helper, Output, RenderContext, RenderError, Renderable};\nuse serde::{Deserialize, Serialize};\nuse serde_json::{json, Value};\nuse std::{\n    collections::HashMap,\n    fs::{self, File},\n    io::Write,\n};\n\n#[derive(Debug, Clone, Serialize, Deserialize)]\nstruct SystemMetadata {\n    #[serde(rename = \"Version\")]\n    pub version: usize,\n    #[serde(rename = \"SchemaVersion\")]\n    pub schema_version: usize,\n    #[serde(rename = \"PlistDictionary\")]\n    pub plist_dictionary: SystemPlistDictionary,\n}\n\n#[derive(Debug, Clone, Serialize, Deserialize)]\nstruct SystemPlistDictionary {\n    #[serde(rename = \"Version\")]\n    pub version: usize,\n    #[serde(rename = \"SchemaVersion\")]\n    pub schema_version: usize,\n    #[serde(rename = \"HomeKit\")]\n    pub homekit: HomeKit,\n    #[serde(rename = \"HAP\")]\n    pub hap: Hap,\n    #[serde(rename = \"Assistant\")]\n    pub assistant: Assistant,\n}\n\n#[derive(Debug, Clone, Serialize, Deserialize)]\nstruct HomeKit {\n    #[serde(rename = \"Categories\")]\n    pub categories: HashMap<String, HomeKitCategory>,\n}\n\n#[derive(Debug, Clone, Serialize, Deserialize)]\nstruct HomeKitCategory {\n    #[serde(rename = \"DefaultDescription\")]\n    pub name: String,\n    #[serde(rename = \"Identifier\")]\n    pub number: u8,\n    #[serde(rename = \"UUID\")]\n    pub uuid: String,\n}\n\n#[derive(Debug, Clone, Serialize, Deserialize)]\nstruct Hap {\n    #[serde(rename = \"Base UUID\")]\n    pub base_uuid: String,\n    #[serde(rename = \"Characteristics\")]\n    pub characteristics: HashMap<String, HapCharacteristic>,\n    #[serde(rename = \"Services\")]\n    pub services: HashMap<String, HapService>,\n    #[serde(rename = \"Properties\")]\n    pub properties: HashMap<String, HapProperty>,\n}\n\n#[derive(Debug, Clone, Serialize, Deserialize)]\nstruct HapCharacteristic {\n    #[serde(rename = \"ShortUUID\")]\n    pub short_uuid: String,\n    #[serde(rename = \"DefaultDescription\")]\n    pub name: String,\n    #[serde(rename = \"Format\")]\n    pub format: String,\n    #[serde(rename = \"MinValue\")]\n    pub min_value: Option<Value>,\n    #[serde(rename = \"MaxValue\")]\n    pub max_value: Option<Value>,\n    #[serde(rename = \"StepValue\")]\n    pub step_value: Option<Value>,\n    #[serde(rename = \"MaxLength\")]\n    pub max_length: Option<Value>,\n    #[serde(rename = \"Units\")]\n    pub units: Option<String>,\n    #[serde(rename = \"Properties\")]\n    pub properties: usize,\n}\n\n#[derive(Debug, Clone, Serialize, Deserialize)]\nstruct HapService {\n    #[serde(rename = \"ShortUUID\")]\n    pub short_uuid: String,\n    #[serde(rename = \"DefaultDescription\")]\n    pub name: String,\n    #[serde(rename = \"Characteristics\")]\n    pub characteristics: HapServiceCharacteristicRelation,\n}\n\n#[derive(Debug, Clone, Serialize, Deserialize)]\nstruct HapServiceCharacteristicRelation {\n    #[serde(rename = \"Required\")]\n    pub required_characteristics: Vec<String>,\n    #[serde(rename = \"Optional\")]\n    pub optional_characteristics: Option<Vec<String>>,\n}\n\n#[derive(Debug, Clone, Serialize, Deserialize)]\nstruct HapProperty {\n    #[serde(rename = \"DefaultDescription\")]\n    pub name: String,\n    #[serde(rename = \"Position\")]\n    pub number: u8,\n}\n\n#[derive(Debug, Clone, Serialize, Deserialize)]\nstruct Assistant {\n    #[serde(rename = \"Characteristics\")]\n    pub characteristics: HashMap<String, AssistantCharacteristic>,\n}\n\n#[derive(Debug, Clone, Serialize, Deserialize)]\nstruct AssistantCharacteristic {\n    #[serde(rename = \"Format\")]\n    pub format: String,\n    #[serde(rename = \"Read\")]\n    pub read: Option<String>,\n    #[serde(rename = \"Write\")]\n    pub write: Option<String>,\n    #[serde(rename = \"ReadWrite\")]\n    pub read_write: Option<String>,\n    #[serde(rename = \"Values\")]\n    pub values: Option<HashMap<String, Value>>,\n    #[serde(rename = \"OutValues\")]\n    pub out_values: Option<HashMap<String, Value>>,\n}\n\n#[derive(Debug, Clone, Serialize, Deserialize)]\nstruct RenderMetadata {\n    pub categories: HashMap<String, HomeKitCategory>,\n    pub sorted_categories: Vec<HomeKitCategory>,\n    pub characteristics: HashMap<String, HapCharacteristic>,\n    pub sorted_characteristics: Vec<HapCharacteristic>,\n    pub services: HashMap<String, HapService>,\n    pub sorted_services: Vec<HapService>,\n    pub properties: HashMap<String, HapProperty>,\n    pub assistant_characteristics: HashMap<String, AssistantCharacteristic>,\n    pub characteristic_in_values: HashMap<String, HashMap<String, Value>>,\n    pub characteristic_out_values: HashMap<String, HashMap<String, Value>>,\n}\n\nimpl From<SystemMetadata> for RenderMetadata {\n    fn from(v: SystemMetadata) -> Self {\n        let mut m = v.plist_dictionary;\n\n        // rename mislabeled services\n        let mut accessory_information_service = m.hap.services.get_mut(\"accessory-information\").unwrap();\n        accessory_information_service.name = \"Accessory Information\".to_string();\n        let mut fan_v2_service = m.hap.services.get_mut(\"fanv2\").unwrap();\n        fan_v2_service.name = \"Fan v2\".to_string();\n        let mut smart_speaker_service = m.hap.services.get_mut(\"smart-speaker\").unwrap();\n        smart_speaker_service.name = \"Smart Speaker\".to_string();\n\n        let mut sorted_categories = m.homekit.categories.iter().map(|(_, v)| v.clone()).collect::<Vec<_>>();\n        sorted_categories.sort_by(|a, b| a.number.partial_cmp(&b.number).unwrap());\n\n        let mut sorted_characteristics = m.hap.characteristics.iter().map(|(_, v)| v.clone()).collect::<Vec<_>>();\n        sorted_characteristics.sort_by(|a, b| a.name.cmp(&b.name));\n\n        let mut sorted_services = m.hap.services.iter().map(|(_, v)| v.clone()).collect::<Vec<_>>();\n        sorted_services.sort_by(|a, b| a.name.cmp(&b.name));\n\n        let mut characteristic_in_values = HashMap::new();\n        let mut characteristic_out_values = HashMap::new();\n\n        for (_, characteristic) in m.assistant.characteristics.clone() {\n            if let (Some(ref read_name), Some(ref values), &None) =\n                (&characteristic.read, &characteristic.values, &characteristic.out_values)\n            {\n                characteristic_in_values.insert(read_name.clone(), values.clone());\n            }\n\n            if let (Some(ref read_write_name), Some(ref values), &None) = (\n                &characteristic.read_write,\n                &characteristic.values,\n                &characteristic.out_values,\n            ) {\n                characteristic_in_values.insert(read_write_name.clone(), values.clone());\n            }\n\n            if let (Some(read_name), Some(out_values)) = (characteristic.read, characteristic.out_values) {\n                characteristic_out_values.insert(read_name, out_values);\n            }\n\n            if let (Some(write_name), Some(values)) = (characteristic.write, characteristic.values) {\n                characteristic_in_values.insert(write_name, values);\n            }\n        }\n\n        Self {\n            categories: m.homekit.categories,\n            sorted_categories,\n            characteristics: m.hap.characteristics,\n            sorted_characteristics,\n            services: m.hap.services,\n            sorted_services,\n            properties: m.hap.properties,\n            assistant_characteristics: m.assistant.characteristics,\n            characteristic_in_values,\n            characteristic_out_values,\n        }\n    }\n}\n\nfn if_eq_helper<'reg, 'rc>(\n    h: &Helper<'reg, 'rc>,\n    r: &'reg Handlebars,\n    c: &Context,\n    rc: &mut RenderContext<'reg>,\n    out: &mut dyn Output,\n) -> Result<(), RenderError> {\n    let first = h.param(0).unwrap().value();\n    let second = h.param(1).unwrap().value();\n    let tmpl = if first == second { h.template() } else { h.inverse() };\n    match tmpl {\n        Some(ref t) => t.render(r, c, rc, out),\n        None => Ok(()),\n    }\n}\n\nfn trim_helper(\n    h: &Helper,\n    _: &Handlebars,\n    _: &Context,\n    _: &mut RenderContext,\n    out: &mut dyn Output,\n) -> Result<(), RenderError> {\n    let param = h.param(0).unwrap().value();\n    if let Some(s) = param.as_str() {\n        let trim = s.replace(\" \", \"\").replace(\".\", \"_\");\n        out.write(&trim)?;\n    }\n    Ok(())\n}\n\nfn file_name_helper(\n    h: &Helper,\n    _: &Handlebars,\n    _: &Context,\n    _: &mut RenderContext,\n    out: &mut dyn Output,\n) -> Result<(), RenderError> {\n    let param = h.param(0).unwrap().value();\n    if let Some(s) = param.as_str() {\n        let name = s.replace(\" \", \"_\").replace(\".\", \"_\").to_lowercase();\n        out.write(&name)?;\n    }\n    Ok(())\n}\n\nfn type_helper(\n    h: &Helper,\n    _: &Handlebars,\n    _: &Context,\n    _: &mut RenderContext,\n    out: &mut dyn Output,\n) -> Result<(), RenderError> {\n    let param = h.param(0).unwrap().value();\n    if let Some(s) = param.as_str() {\n        match s {\n            \"bool\" => {\n                out.write(\"bool\")?;\n            },\n            \"uint8\" => {\n                out.write(\"u8\")?;\n            },\n            \"uint16\" => {\n                out.write(\"u16\")?;\n            },\n            \"uint32\" => {\n                out.write(\"u32\")?;\n            },\n            \"uint64\" => {\n                out.write(\"u64\")?;\n            },\n            \"int\" => {\n                out.write(\"i32\")?;\n            },\n            \"int32\" => {\n                out.write(\"i32\")?;\n            },\n            \"float\" => {\n                out.write(\"f32\")?;\n            },\n            \"string\" => {\n                out.write(\"String\")?;\n            },\n            \"tlv8\" => {\n                out.write(\"Vec<u8>\")?;\n            },\n            \"data\" => {\n                out.write(\"Vec<u8>\")?;\n            },\n            _ => {\n                return Err(RenderError::new(\"Unknown Characteristic format\"));\n            },\n        }\n    }\n    Ok(())\n}\n\nfn format_helper(\n    h: &Helper,\n    _: &Handlebars,\n    _: &Context,\n    _: &mut RenderContext,\n    out: &mut dyn Output,\n) -> Result<(), RenderError> {\n    let param = h.param(0).unwrap().value();\n    if let Some(s) = param.as_str() {\n        match s {\n            \"bool\" => {\n                out.write(\"Format::Bool\")?;\n            },\n            \"uint8\" => {\n                out.write(\"Format::UInt8\")?;\n            },\n            \"uint16\" => {\n                out.write(\"Format::UInt16\")?;\n            },\n            \"uint32\" => {\n                out.write(\"Format::UInt32\")?;\n            },\n            \"uint64\" => {\n                out.write(\"Format::UInt64\")?;\n            },\n            \"int\" => {\n                out.write(\"Format::Int32\")?;\n            },\n            \"int32\" => {\n                out.write(\"Format::Int32\")?;\n            },\n            \"float\" => {\n                out.write(\"Format::Float\")?;\n            },\n            \"string\" => {\n                out.write(\"Format::String\")?;\n            },\n            \"tlv8\" => {\n                out.write(\"Format::Tlv8\")?;\n            },\n            \"data\" => {\n                out.write(\"Format::Data\")?;\n            },\n            _ => {\n                return Err(RenderError::new(\"Unknown Characteristic format\"));\n            },\n        }\n    }\n    Ok(())\n}\n\nfn unit_helper(\n    h: &Helper,\n    _: &Handlebars,\n    _: &Context,\n    _: &mut RenderContext,\n    out: &mut dyn Output,\n) -> Result<(), RenderError> {\n    let param = h.param(0).unwrap().value();\n    if let Some(s) = param.as_str() {\n        match s {\n            \"celsius\" => {\n                out.write(\"Unit::Celsius\")?;\n            },\n            \"fahrenheit\" => {\n                out.write(\"Unit::Celsius\")?;\n            },\n            \"percentage\" => {\n                out.write(\"Unit::Percentage\")?;\n            },\n            \"arcdegrees\" => {\n                out.write(\"Unit::ArcDegrees\")?;\n            },\n\n            \"lux\" => {\n                out.write(\"Unit::Lux\")?;\n            },\n            \"seconds\" => {\n                out.write(\"Unit::Seconds\")?;\n            },\n            \"ppm\" => {\n                out.write(\"Unit::PartsPerMillion\")?;\n            },\n            \"micrograms/m^3\" => {\n                out.write(\"Unit::MicrogramsPerCubicMeter\")?;\n            },\n            _ => {\n                return Err(RenderError::new(\"Unknown Characteristic unit\"));\n            },\n        }\n    }\n    Ok(())\n}\n\nfn category_helper(\n    h: &Helper,\n    _: &Handlebars,\n    _: &Context,\n    _: &mut RenderContext,\n    out: &mut dyn Output,\n) -> Result<(), RenderError> {\n    let param = h.param(0).unwrap().value().as_str().unwrap();\n\n    match param.to_lowercase().as_str() {\n        \"air quality sensor\"\n        | \"carbon dioxide sensor\"\n        | \"carbon monoxide sensor\"\n        | \"contact sensor\"\n        | \"humidity sensor\"\n        | \"leak sensor\"\n        | \"light sensor\"\n        | \"motion sensor\"\n        | \"occupancy sensor\"\n        | \"smoke sensor\"\n        | \"temperature sensor\" => {\n            out.write(\"AccessoryCategory::Sensor\")?;\n        },\n        \"doorbell\" => {\n            out.write(\"AccessoryCategory::VideoDoorbell\")?;\n        },\n        \"fan v2\" => {\n            out.write(\"AccessoryCategory::Fan\")?;\n        },\n        \"heater-cooler\" => {\n            out.write(\"AccessoryCategory::AirHeater /* or AccessoryCategory::AirConditioner */\")?;\n        },\n        \"humidifier-dehumidifier\" => {\n            out.write(\"AccessoryCategory::AirHumidifier /* or AccessoryCategory::AirDehumidifier */\")?;\n        },\n        \"irrigation-system\" => {\n            out.write(\"AccessoryCategory::Sprinkler\")?;\n        },\n        \"smart speaker\" => {\n            out.write(\"AccessoryCategory::Speaker\")?;\n        },\n        \"stateful programmable switch\" | \"stateless programmable switch\" => {\n            out.write(\"AccessoryCategory::ProgrammableSwitch\")?;\n        },\n        \"wi-fi satellite\" => {\n            out.write(\"AccessoryCategory::WiFiRouter\")?;\n        },\n        _ => {\n            let param = param.replace(\"-\", \" \");\n            let name = param\n                .to_lowercase()\n                .split(\" \")\n                .into_iter()\n                .map(|word| {\n                    let mut c = word.chars().collect::<Vec<char>>();\n                    c[0] = c[0].to_uppercase().nth(0).unwrap();\n                    c.into_iter().collect::<String>()\n                })\n                .collect::<String>();\n            let name = name.replace(\" \", \"\").replace(\".\", \"_\");\n            out.write(&format!(\"AccessoryCategory::{}\", name))?;\n        },\n    }\n\n    Ok(())\n}\n\nfn uuid_helper(\n    h: &Helper,\n    _: &Handlebars,\n    _: &Context,\n    _: &mut RenderContext,\n    out: &mut dyn Output,\n) -> Result<(), RenderError> {\n    let param = h.param(0).unwrap().value();\n    if let Some(s) = param.as_str() {\n        out.write(&shorten_uuid(&s))?;\n    }\n    Ok(())\n}\n\nfn in_values_helper(\n    h: &Helper,\n    _: &Handlebars,\n    _: &Context,\n    _: &mut RenderContext,\n    out: &mut dyn Output,\n) -> Result<(), RenderError> {\n    let param = h.param(0).unwrap().value().as_object().unwrap();\n    let mut values = param\n        .into_iter()\n        .map(|(key, val)| (key.clone(), val.clone().to_string().replace(\"\\\"\", \"\")))\n        .collect::<Vec<(String, String)>>();\n    values.sort_by(|a, b| a.1.cmp(&b.1));\n\n    let mut output = String::from(\"vec![\\n\");\n    for (key, val) in values {\n        output.push_str(&format!(\"\\t\\t\\t\\t{}, // {}\\n\", val, key));\n    }\n    output.push_str(\"\\t\\t\\t]\");\n    out.write(&output)?;\n\n    Ok(())\n}\n\nfn out_values_helper(\n    h: &Helper,\n    _: &Handlebars,\n    _: &Context,\n    _: &mut RenderContext,\n    out: &mut dyn Output,\n) -> Result<(), RenderError> {\n    let param = h.param(0).unwrap().value().as_object().unwrap();\n    let mut values = param\n        .into_iter()\n        .map(|(key, val)| (val.clone().to_string().replace(\"\\\"\", \"\"), key.clone()))\n        .collect::<Vec<(String, String)>>();\n    values.sort_by(|a, b| a.1.cmp(&b.1));\n\n    let mut output = String::from(\"vec![\\n\");\n    for (key, val) in values {\n        output.push_str(&format!(\"\\t\\t\\t\\t{}, // {}\\n\", val, key));\n    }\n    output.push_str(\"\\t\\t\\t]\");\n    out.write(&output)?;\n\n    Ok(())\n}\n\nfn in_values_enum_helper(\n    h: &Helper,\n    _: &Handlebars,\n    _: &Context,\n    _: &mut RenderContext,\n    out: &mut dyn Output,\n) -> Result<(), RenderError> {\n    let param = h.param(0).unwrap().value().as_object().unwrap();\n    let mut values = param\n        .into_iter()\n        .map(|(key, val)| (key.clone(), val.clone().to_string().replace(\"\\\"\", \"\")))\n        .collect::<Vec<(String, String)>>();\n    values.sort_by(|a, b| a.1.cmp(&b.1));\n\n    let mut output = String::from(\"\\npub enum Value {\\n\");\n    for (key, val) in values {\n        let key = key\n            .to_lowercase()\n            .split(\"_\")\n            .into_iter()\n            .map(|word| {\n                let mut c = word.chars().collect::<Vec<char>>();\n\n                if c.len() == 1 && c[0].is_numeric() {\n                    format!(\"Num{}\", c[0])\n                } else {\n                    c[0] = c[0].to_uppercase().nth(0).unwrap();\n                    c.into_iter().collect::<String>()\n                }\n            })\n            .collect::<String>();\n\n        output.push_str(&format!(\"\\t{} = {},\\n\", key, val));\n    }\n    output.push_str(\"}\\n\");\n    out.write(&output)?;\n\n    Ok(())\n}\n\nfn out_values_enum_helper(\n    h: &Helper,\n    _: &Handlebars,\n    _: &Context,\n    _: &mut RenderContext,\n    out: &mut dyn Output,\n) -> Result<(), RenderError> {\n    let param = h.param(0).unwrap().value().as_object().unwrap();\n    let mut values = param\n        .into_iter()\n        .map(|(key, val)| (val.clone().to_string().replace(\"\\\"\", \"\"), key.clone()))\n        .collect::<Vec<(String, String)>>();\n    values.sort_by(|a, b| a.1.cmp(&b.1));\n\n    let mut output = String::from(\"\\npub enum Value {\\n\");\n    for (key, val) in values {\n        let key = key\n            .to_lowercase()\n            .split(\"_\")\n            .into_iter()\n            .map(|word| {\n                let mut c = word.chars().collect::<Vec<char>>();\n\n                if c.len() == 1 && c[0].is_numeric() {\n                    format!(\"Num{}\", c[0])\n                } else {\n                    c[0] = c[0].to_uppercase().nth(0).unwrap();\n                    c.into_iter().collect::<String>()\n                }\n            })\n            .collect::<String>();\n\n        output.push_str(&format!(\"\\t{} = {},\\n\", key, val));\n    }\n    output.push_str(\"}\\n\");\n    out.write(&output)?;\n\n    Ok(())\n}\n\nfn perms_helper(\n    h: &Helper,\n    _: &Handlebars,\n    _: &Context,\n    _: &mut RenderContext,\n    out: &mut dyn Output,\n) -> Result<(), RenderError> {\n    let perms = vec![\n        (1 << 0, \"\\n\\t\\t\\t\\tPerm::Events,\".to_string()),\n        (1 << 1, \"\\n\\t\\t\\t\\tPerm::PairedRead,\".to_string()),\n        (1 << 2, \"\\n\\t\\t\\t\\tPerm::PairedWrite,\".to_string()),\n        // Relevant for Bluetooth.\n        // (1 << 3, \"\\n\\t\\t\\t\\tPerm::Broadcast,\".to_string()),\n        // aa set by homed just signals that aa may be supported. Setting up aa will always require a custom made app\n        // though. (1 << 4, \"\\n\\t\\t\\t\\tPerm::AdditionalAuthorization,\".to_string()),\n        (1 << 5, \"\\n\\t\\t\\t\\tPerm::TimedWrite,\".to_string()),\n        (1 << 6, \"\\n\\t\\t\\t\\tPerm::Hidden,\".to_string()),\n        (1 << 7, \"\\n\\t\\t\\t\\tPerm::WriteResponse,\".to_string()),\n    ];\n\n    let properties_bitmap = h.param(0).unwrap().value().as_u64().unwrap();\n\n    for (bitmap, name) in perms {\n        // if it stays the same, the bit is set\n        if (bitmap | properties_bitmap) == properties_bitmap {\n            out.write(&name)?;\n        }\n    }\n\n    Ok(())\n}\n\nfn float_helper(\n    h: &Helper,\n    _: &Handlebars,\n    _: &Context,\n    _: &mut RenderContext,\n    out: &mut dyn Output,\n) -> Result<(), RenderError> {\n    let format = h.param(0).unwrap().value().as_str().unwrap();\n    if format == \"float\" {\n        out.write(\" as f32\")?;\n    }\n    Ok(())\n}\n\nfn array_length_helper(\n    h: &Helper,\n    _: &Handlebars,\n    _: &Context,\n    _: &mut RenderContext,\n    out: &mut dyn Output,\n) -> Result<(), RenderError> {\n    let array = h.param(0).unwrap().value().as_array().unwrap();\n    out.write(&format!(\"{}\", array.len()))?;\n    Ok(())\n}\n\nfn shorten_uuid(id: &str) -> String { id.trim_start_matches('0').to_owned() }\n\nfn snake_case_helper(\n    h: &Helper,\n    _: &Handlebars,\n    _: &Context,\n    _: &mut RenderContext,\n    out: &mut dyn Output,\n) -> Result<(), RenderError> {\n    let param = h.param(0).unwrap().value().as_str().unwrap();\n    let name = param\n        .replace(\" \", \"_\")\n        .replace(\".\", \"_\")\n        .replace(\"-\", \"_\")\n        .to_lowercase();\n    out.write(&name)?;\n    Ok(())\n}\n\nfn pascal_case_helper(\n    h: &Helper,\n    _: &Handlebars,\n    _: &Context,\n    _: &mut RenderContext,\n    out: &mut dyn Output,\n) -> Result<(), RenderError> {\n    let param = h.param(0).unwrap().value().as_str().unwrap().to_owned();\n    let param = param.replace(\"-\", \" \");\n    let name = param\n        .to_lowercase()\n        .split(\" \")\n        .into_iter()\n        .map(|word| {\n            let mut c = word.chars().collect::<Vec<char>>();\n            c[0] = c[0].to_uppercase().nth(0).unwrap();\n            c.into_iter().collect::<String>()\n        })\n        .collect::<String>();\n    let name = name.replace(\" \", \"\").replace(\".\", \"_\");\n    out.write(&name)?;\n    Ok(())\n}\n\nstatic CATEGORIES: &'static str = \"// this file is auto-generated by hap-codegen\\n\nuse serde::{Deserialize, Serialize};\n\n/// HAP accessory category.\n#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq)]\npub enum AccessoryCategory {\n{{#each sorted_categories as |c|}}\\\n\\t{{pascal_case c.DefaultDescription}} = {{c.Identifier}},\n{{/each}}\\\n}\n\";\n\nstatic HAP_TYPE: &'static str = \"// this file is auto-generated by hap-codegen\\n\nuse serde::{\n    de::{self, Deserialize, Deserializer},\n    ser::{Serialize, Serializer},\n};\nuse std::str::FromStr;\nuse uuid::Uuid;\n\nuse crate::Error;\n\n/// HAP service and characteristic type representation.\n#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]\npub enum HapType {\n    Unknown,\n    Custom(Uuid),\n{{#each sorted_characteristics as |c|}}\\\n\\t{{pascal_case c.DefaultDescription}},\n{{/each}}\\\n{{#each sorted_services as |s|}}\\\n\\t{{pascal_case s.DefaultDescription}},\n{{/each}}\\\n}\n\nimpl ToString for HapType {\n    fn to_string(&self) -> String {\n        match self {\n            HapType::Unknown => \\\"unknown\\\".into(),\n            HapType::Custom(uuid) => uuid.to_hyphenated().to_string(),\n{{#each sorted_characteristics as |c|}}\\\n\\t\\t\\tHapType::{{pascal_case c.DefaultDescription}} => \\\"{{uuid c.ShortUUID}}\\\".into(),\n{{/each}}\\\n{{#each sorted_services as |s|}}\\\n\\t\\t\\tHapType::{{pascal_case s.DefaultDescription}} => \\\"{{uuid s.ShortUUID}}\\\".into(),\n{{/each}}\\\n\\t\\t}\n    }\n}\n\nimpl FromStr for HapType {\n    type Err = Error;\n\n    fn from_str(s: &str) -> Result<Self, Self::Err> {\n        if let Ok(uuid) = Uuid::parse_str(s) {\n            return Ok(HapType::Custom(uuid));\n        }\n\n        match s {\n            \\\"unknown\\\" => Ok(HapType::Unknown),\n{{#each sorted_characteristics as |c|}}\\\n\\t\\t\\t\\\"{{uuid c.ShortUUID}}\\\" => Ok(HapType::{{pascal_case c.DefaultDescription}}),\n{{/each}}\\\n{{#each sorted_services as |s|}}\\\n\\t\\t\\t\\\"{{uuid s.ShortUUID}}\\\" => Ok(HapType::{{pascal_case s.DefaultDescription}}),\n{{/each}}\\\n\\t\\t\\t_ => Err(Error::InvalidHapTypeString(s.to_string())),\n\\t\\t}\n    }\n}\n\nimpl Default for HapType {\n    fn default() -> HapType { HapType::Unknown }\n}\n\nimpl<'de> Deserialize<'de> for HapType {\n    fn deserialize<D>(deserializer: D) -> Result<HapType, D::Error>\n    where\n        D: Deserializer<'de>,\n    {\n        let s = String::deserialize(deserializer)?;\n        let hap_type = HapType::from_str(&s).map_err(de::Error::custom)?;\n        Ok(hap_type)\n    }\n}\n\nimpl Serialize for HapType {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        serializer.serialize_str(&self.to_string())\n    }\n}\n\";\n\nstatic CHARACTERISTIC: &'static str = \"// this file is auto-generated by hap-codegen\\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// {{characteristic.DefaultDescription}} characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct {{pascal_case characteristic.DefaultDescription}}Characteristic(Characteristic<{{type characteristic.Format}}>);\n{{#if in_values includeZero=true}}{{in_values_enum in_values}}{{/if}}{{#if out_values includeZero=true}}{{out_values_enum out_values}}{{/if}}\nimpl {{pascal_case characteristic.DefaultDescription}}Characteristic {\n    /// Creates a new {{characteristic.DefaultDescription}} characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<{{type characteristic.Format}}> {\n            id,\n            accessory_id,\n            hap_type: HapType::{{pascal_case characteristic.DefaultDescription}},\n            format: {{format characteristic.Format}},\n            perms: vec![{{perms characteristic.Properties}}\n            ],\\\n            {{#if characteristic.Units}}\\n\\t\\t\\tunit: Some({{unit characteristic.Units}}),{{/if}}\\\n            {{#if characteristic.MaxValue includeZero=true}}\\n\\t\\t\\tmax_value: Some({{characteristic.MaxValue}}{{float characteristic.Format}}),{{/if}}\\\n            {{#if characteristic.MinValue includeZero=true}}\\n\\t\\t\\tmin_value: Some({{characteristic.MinValue}}{{float characteristic.Format}}),{{/if}}\\\n            {{#if characteristic.StepValue includeZero=true}}\\n\\t\\t\\tstep_value: Some({{characteristic.StepValue}}{{float characteristic.Format}}),{{/if}}\\\n            {{#if characteristic.MaxLength includeZero=true}}\\n\\t\\t\\tmax_len: Some({{characteristic.MaxLength}}{{float characteristic.Format}}),{{/if}}\\\n            {{#if in_values includeZero=true}}\\n\\t\\t\\tvalid_values: Some({{in_values in_values}}),{{/if}}{{#if out_values includeZero=true}}\\n\\t\\t\\tvalid_values: Some({{out_values out_values}}),{{/if}}\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for {{pascal_case characteristic.DefaultDescription}}Characteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for {{pascal_case characteristic.DefaultDescription}}Characteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<{{type characteristic.Format}}> for {{pascal_case characteristic.DefaultDescription}}Characteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<{{type characteristic.Format}}>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<{{type characteristic.Format}}>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<{{type characteristic.Format}}> for {{pascal_case characteristic.DefaultDescription}}Characteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<{{type characteristic.Format}}>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<{{type characteristic.Format}}>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n\";\n\nstatic CHARACTERISTIC_MOD: &'static str = \"// this file is auto-generated by hap-codegen\n{{#each characteristics as |c|}}\\n/// {{c.name}} characteristic definition.\\npub mod {{c.file_name}};{{/each}}\n\";\n\nstatic SERVICE: &'static str = \"// this file is auto-generated by hap-codegen\\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n{{#each required_characteristics as |r|}}\\\n\\t\\t{{snake_case r.DefaultDescription}}::{{pascal_case r.DefaultDescription}}Characteristic,\n{{/each}}\\\n{{#each optional_characteristics as |r|}}\\\n\\t\\t{{snake_case r.DefaultDescription}}::{{pascal_case r.DefaultDescription}}Characteristic,\n{{/each}}\\\n\\t},\n    HapType,\n};\n\n/// {{service.DefaultDescription}} service.\n#[derive(Debug, Default)]\npub struct {{pascal_case service.DefaultDescription}}Service {\n    /// Instance ID of the {{service.DefaultDescription}} service.\n    id: u64,\n    /// [`HapType`](HapType) of the {{service.DefaultDescription}} service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n{{#each required_characteristics as |r|}}\\\n\\t/// {{r.DefaultDescription}} characteristic (required).\n\\tpub {{snake_case r.DefaultDescription}}: {{pascal_case r.DefaultDescription}}Characteristic,\n{{/each}}\\\n\\n{{#each optional_characteristics as |o|}}\\\n\\t/// {{o.DefaultDescription}} characteristic (optional).\n\\tpub {{snake_case o.DefaultDescription}}: Option<{{pascal_case o.DefaultDescription}}Characteristic>,\n{{/each}}\\\n}\n\nimpl {{pascal_case service.DefaultDescription}}Service {\n    /// Creates a new {{service.DefaultDescription}} service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::{{pascal_case service.DefaultDescription}},\n{{#each required_characteristics as |r|}}\\\n\\t\\t\\t{{snake_case r.DefaultDescription}}: {{pascal_case r.DefaultDescription}}Characteristic::new(id + 1 + {{@index}}, accessory_id),\n{{/each}}\\\n{{#each optional_characteristics as |o|}}\\\n\\t\\t\\t{{snake_case o.DefaultDescription}}: Some({{pascal_case o.DefaultDescription}}Characteristic::new(id + 1 + {{@index}} + {{array_length ../required_characteristics}}, accessory_id)),\n{{/each}}\\\n        \\t\\t\\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for {{pascal_case service.DefaultDescription}}Service {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n{{#each required_characteristics as |r|}}\\\n\\t\\t\\t&self.{{snake_case r.DefaultDescription}},\n{{/each}}\\\n        \\t\\t];\n{{#each optional_characteristics as |r|}}\\\n\\t\\tif let Some(c) = &self.{{snake_case r.DefaultDescription}} {\n\\t\\t    characteristics.push(c);\n\\t\\t}\n{{/each}}\\\n        \\t\\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n{{#each required_characteristics as |r|}}\\\n\\t\\t\\t&mut self.{{snake_case r.DefaultDescription}},\n{{/each}}\\\n        \\t\\t];\n{{#each optional_characteristics as |r|}}\\\n\\t\\tif let Some(c) = &mut self.{{snake_case r.DefaultDescription}} {\n\\t\\t    characteristics.push(c);\n\\t\\t}\n{{/each}}\\\n        \\t\\tcharacteristics\n    }\n}\n\nimpl Serialize for {{pascal_case service.DefaultDescription}}Service {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\\\"HapService\\\", 5)?;\n        state.serialize_field(\\\"iid\\\", &self.get_id())?;\n        state.serialize_field(\\\"type\\\", &self.get_type())?;\n        state.serialize_field(\\\"hidden\\\", &self.get_hidden())?;\n        state.serialize_field(\\\"primary\\\", &self.get_primary())?;\n        state.serialize_field(\\\"characteristics\\\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n\";\n\nstatic SERVICE_MOD: &'static str = \"// this file is auto-generated by hap-codegen\n{{#each services as |s|}}\\n/// {{s.name}} service definition.\\npub mod {{s.file_name}};{{/each}}\n\";\n\nstatic ACCESSORY: &'static str = \"// this file is auto-generated by hap-codegen\\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\\taccessory::{AccessoryInformation, HapAccessory},\n\\tservice::{HapService, accessory_information::AccessoryInformationService, {{snake_case service.DefaultDescription}}::{{pascal_case service.DefaultDescription}}Service},\n\\tHapType,\n\\tResult,\n};\n\n/// {{service.DefaultDescription}} accessory.\n#[derive(Debug, Default)]\npub struct {{pascal_case service.DefaultDescription}}Accessory {\n    /// ID of the {{service.DefaultDescription}} accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// {{service.DefaultDescription}} service.\n    pub {{snake_case service.DefaultDescription}}: {{pascal_case service.DefaultDescription}}Service,\n}\n\nimpl {{pascal_case service.DefaultDescription}}Accessory {\n    /// Creates a new {{service.DefaultDescription}} accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let {{snake_case service.DefaultDescription}}_id = accessory_information.get_characteristics().len() as u64;\n        let mut {{snake_case service.DefaultDescription}} = {{pascal_case service.DefaultDescription}}Service::new(1 + {{snake_case service.DefaultDescription}}_id + 1, id);\n        {{snake_case service.DefaultDescription}}.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            {{snake_case service.DefaultDescription}},\n        })\n    }\n}\n\nimpl HapAccessory for {{pascal_case service.DefaultDescription}}Accessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.{{snake_case service.DefaultDescription}},\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.{{snake_case service.DefaultDescription}},\n        ]\n    }\n}\n\nimpl Serialize for {{pascal_case service.DefaultDescription}}Accessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\\\"HapAccessory\\\", 2)?;\n        state.serialize_field(\\\"aid\\\", &self.get_id())?;\n        state.serialize_field(\\\"services\\\", &self.get_services())?;\n        state.end()\n    }\n}\n\";\n\nstatic ACCESSORY_MOD: &'static str = \"// this file is auto-generated by hap-codegen\n{{#each accessories as |a|}}\\n/// {{a.name}} accessory definition.\\npub mod {{a.file_name}};{{/each}}\n\";\n\nstatic EXAMPLE: &'static str = \"\\\nuse tokio;\n\nuse hap::{\n    accessory::{AccessoryCategory, AccessoryInformation, {{snake_case service.DefaultDescription}}::{{pascal_case service.DefaultDescription}}Accessory},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let {{snake_case service.DefaultDescription}} = {{pascal_case service.DefaultDescription}}Accessory::new(1, AccessoryInformation {\n        name: \\\"Acme {{service.DefaultDescription}}\\\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \\\"Acme {{service.DefaultDescription}}\\\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: {{category service.DefaultDescription}},\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory({{snake_case service.DefaultDescription}}).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\\\"RUST_LOG\\\", \\\"hap=debug\\\");\n    env_logger::init();\n\n    handle.await\n}\n\";\n\n/// Services for which accessories need some level of manual adjustment and therefore we don't want to auto-generate an\n/// accesory for.\nconst NON_IDIOMATIC_SERVICES: &'static [&'static str] = &[\n    \"access code\",\n    \"accessory information\",\n    \"accessory metrics\",\n    \"access control\",\n    \"accessory runtime information\",\n    \"asset update\",\n    \"assistant\",\n    \"audio stream management\",\n    \"battery\",\n    \"camera operating mode\",\n    \"camera recording management\",\n    \"camera stream management\",\n    \"cloud relay\",\n    \"data stream transport management\",\n    \"diagnostics\",\n    \"doorbell\",\n    \"faucet\",\n    \"filter maintenance\",\n    \"heater-cooler\",\n    \"input source\",\n    \"irrigation-system\",\n    \"label\",\n    \"lightbulb\",\n    \"lock management\",\n    \"lock mechanism\",\n    \"microphone\",\n    \"nfc access service\",\n    \"pairing\",\n    \"power management\",\n    \"protocol information\",\n    \"siri\",\n    \"siri endpoint\",\n    \"slats\",\n    \"speaker\",\n    \"target control management\",\n    \"target control\",\n    \"television\",\n    \"thread transport\",\n    \"transfer transport management\",\n    \"valve\",\n    \"wi-fi transport\",\n];\n\n/// Services for which we can auto-generate an accessory, but want to skip the example generation because the example\n/// needs some level of manual adjustment.\nconst SKIP_EXAMPLE_GENERATION: &'static [&'static str] = &[\"humidifier-dehumidifier\"];\n\n/// Example file names that are generated or edited manually and therefore shouldn't be overridden by codegen.\nconst MANUALLY_GENERATED_EXAMPLES: &'static [&'static str] = &[\n    \"adding_accessories_dynamically.rs\",\n    \"async_callbacks.rs\",\n    \"bridged_accessories.rs\",\n    \"callbacks.rs\",\n    \"cooler.rs\",\n    \"custom_characteristics_services_accessories.rs\",\n    \"custom_multi_sensor.rs\",\n    \"dehumidifier.rs\",\n    \"faucet.rs\",\n    \"heater.rs\",\n    \"humidifier.rs\",\n    \"irrigation_system.rs\",\n    \"lightbulb.rs\",\n    \"lock.rs\",\n    \"setting_values_after_server_start.rs\",\n    \"shower_head.rs\",\n    \"storing_arbitrary_bytes.rs\",\n    \"sprinkler.rs\",\n    \"television.rs\",\n];\n\n// TODO - manual overrides for valve type & media state values\n\nfn main() {\n    let metadata_file = File::open(\"codegen/gen/system.json\").unwrap();\n\n    let metadata: SystemMetadata = serde_json::from_reader(&metadata_file).unwrap();\n    let metadata = RenderMetadata::from(metadata);\n\n    let mut handlebars = Handlebars::new();\n    handlebars.register_helper(\"if_eq\", Box::new(if_eq_helper));\n    handlebars.register_helper(\"trim\", Box::new(trim_helper));\n    handlebars.register_helper(\"file_name\", Box::new(file_name_helper));\n    handlebars.register_helper(\"format\", Box::new(format_helper));\n    handlebars.register_helper(\"type\", Box::new(type_helper));\n    handlebars.register_helper(\"unit\", Box::new(unit_helper));\n    handlebars.register_helper(\"category\", Box::new(category_helper));\n    handlebars.register_helper(\"uuid\", Box::new(uuid_helper));\n    handlebars.register_helper(\"in_values\", Box::new(in_values_helper));\n    handlebars.register_helper(\"out_values\", Box::new(out_values_helper));\n    handlebars.register_helper(\"in_values_enum\", Box::new(in_values_enum_helper));\n    handlebars.register_helper(\"out_values_enum\", Box::new(out_values_enum_helper));\n    handlebars.register_helper(\"perms\", Box::new(perms_helper));\n    handlebars.register_helper(\"float\", Box::new(float_helper));\n    handlebars.register_helper(\"array_length\", Box::new(array_length_helper));\n    handlebars.register_helper(\"snake_case\", Box::new(snake_case_helper));\n    handlebars.register_helper(\"pascal_case\", Box::new(pascal_case_helper));\n    handlebars.register_template_string(\"categories\", CATEGORIES).unwrap();\n    handlebars.register_template_string(\"hap_type\", HAP_TYPE).unwrap(); // PascalCase camelCase\n    handlebars\n        .register_template_string(\"characteristic\", CHARACTERISTIC)\n        .unwrap();\n    handlebars\n        .register_template_string(\"characteristic_mod\", CHARACTERISTIC_MOD)\n        .unwrap();\n    handlebars.register_template_string(\"service\", SERVICE).unwrap();\n    handlebars.register_template_string(\"service_mod\", SERVICE_MOD).unwrap();\n    handlebars.register_template_string(\"accessory\", ACCESSORY).unwrap();\n    handlebars\n        .register_template_string(\"accessory_mod\", ACCESSORY_MOD)\n        .unwrap();\n    handlebars.register_template_string(\"example\", EXAMPLE).unwrap();\n\n    let categories = handlebars.render(\"categories\", &metadata).unwrap();\n    let categories_path = \"src/accessory/category.rs\".to_owned();\n    let mut categories_file = File::create(&categories_path).unwrap();\n    categories_file.write_all(categories.as_bytes()).unwrap();\n\n    let hap_type = handlebars.render(\"hap_type\", &metadata).unwrap();\n    let hap_type_path = \"src/hap_type.rs\".to_owned();\n    let mut hap_type_file = File::create(&hap_type_path).unwrap();\n    hap_type_file.write_all(hap_type.as_bytes()).unwrap();\n\n    let characteristic_base_path = \"src/characteristic/generated/\";\n    if std::path::Path::new(&characteristic_base_path).exists() {\n        fs::remove_dir_all(&characteristic_base_path).unwrap();\n    }\n    fs::create_dir_all(&characteristic_base_path).unwrap();\n    let mut characteristic_names = vec![];\n    for (c_name, c) in &metadata.characteristics {\n        let in_values = metadata.characteristic_in_values.get(c_name);\n        let out_values = metadata.characteristic_out_values.get(c_name);\n\n        let characteristic = handlebars\n            .render(\n                \"characteristic\",\n                &json!({ \"characteristic\": c, \"in_values\": in_values, \"out_values\": out_values }),\n            )\n            .unwrap();\n\n        let characteristic_file_name = c\n            .name\n            .replace(\" \", \"_\")\n            .replace(\".\", \"_\")\n            .replace(\"-\", \"_\")\n            .to_lowercase();\n        let mut characteristic_path = String::from(characteristic_base_path);\n        characteristic_path.push_str(&characteristic_file_name);\n        characteristic_path.push_str(\".rs\");\n        let mut characteristic_file = File::create(&characteristic_path).unwrap();\n        characteristic_file.write_all(characteristic.as_bytes()).unwrap();\n        characteristic_names.push(json!({ \"name\": c.name, \"file_name\": characteristic_file_name }));\n    }\n    characteristic_names.sort_by(|a, b| {\n        a.get(\"file_name\")\n            .unwrap()\n            .as_str()\n            .unwrap()\n            .cmp(&b.get(\"file_name\").unwrap().as_str().unwrap())\n    });\n    let characteristic_mod = handlebars\n        .render(\n            \"characteristic_mod\",\n            &json!({ \"characteristics\": characteristic_names }),\n        )\n        .unwrap();\n    let mut characteristic_mod_file = File::create(&format!(\"{}mod.rs\", characteristic_base_path)).unwrap();\n    characteristic_mod_file\n        .write_all(characteristic_mod.as_bytes())\n        .unwrap();\n\n    let service_base_path = \"src/service/generated/\";\n    let accessory_base_path = \"src/accessory/generated/\";\n    if std::path::Path::new(&service_base_path).exists() {\n        fs::remove_dir_all(&service_base_path).unwrap();\n    }\n    if std::path::Path::new(&accessory_base_path).exists() {\n        fs::remove_dir_all(&accessory_base_path).unwrap();\n    }\n    for entry in fs::read_dir(\"examples\").unwrap() {\n        let entry = entry.unwrap();\n\n        if entry.file_type().unwrap().is_file()\n            && !MANUALLY_GENERATED_EXAMPLES.contains(&entry.file_name().to_str().unwrap())\n        {\n            fs::remove_file(entry.path()).unwrap();\n        }\n    }\n    fs::create_dir_all(&service_base_path).unwrap();\n    fs::create_dir_all(&accessory_base_path).unwrap();\n    let mut service_names = vec![];\n    let mut accessory_names = vec![];\n    for s in &metadata.sorted_services {\n        let mut required_characteristics = Vec::new();\n        let mut optional_characteristics = Vec::new();\n\n        for c in &s.characteristics.required_characteristics {\n            required_characteristics.push(metadata.characteristics.get(c).unwrap().clone());\n        }\n\n        if let Some(o_cs) = &s.characteristics.optional_characteristics {\n            for c in o_cs {\n                optional_characteristics.push(metadata.characteristics.get(c).unwrap().clone());\n            }\n        }\n\n        let service = handlebars\n            .render(\n                \"service\",\n                &json!({\n                    \"service\": s,\n                    \"required_characteristics\": &required_characteristics,\n                    \"optional_characteristics\": &optional_characteristics,\n                }),\n            )\n            .unwrap();\n\n        let service_file_name = s\n            .name\n            .replace(\" \", \"_\")\n            .replace(\".\", \"_\")\n            .replace(\"-\", \"_\")\n            .to_lowercase();\n        let mut service_path = String::from(service_base_path);\n        service_path.push_str(&service_file_name);\n        service_path.push_str(\".rs\");\n        let mut service_file = File::create(&service_path).unwrap();\n        service_file.write_all(service.as_bytes()).unwrap();\n\n        service_names.push(json!({ \"name\": s.name.clone(), \"file_name\": service_file_name.clone() }));\n\n        if !NON_IDIOMATIC_SERVICES.contains(&s.name.to_lowercase().as_str()) {\n            let accessory = handlebars\n                .render(\n                    \"accessory\",\n                    &json!({\"service\": s, \"characteristics\": &metadata.characteristics}),\n                )\n                .unwrap();\n            let mut accessory_path = String::from(accessory_base_path);\n            accessory_path.push_str(&service_file_name);\n            accessory_path.push_str(\".rs\");\n            let mut accessory_file = File::create(&accessory_path).unwrap();\n            accessory_file.write_all(accessory.as_bytes()).unwrap();\n\n            if !SKIP_EXAMPLE_GENERATION.contains(&s.name.to_lowercase().as_str()) {\n                let example = handlebars.render(\"example\", &json!({ \"service\": s })).unwrap();\n                let mut example_path = String::from(\"examples/\");\n                example_path.push_str(&service_file_name);\n                example_path.push_str(\".rs\");\n                let mut example_file = File::create(&example_path).unwrap();\n                example_file.write_all(example.as_bytes()).unwrap();\n            }\n\n            accessory_names.push(json!({ \"name\": s.name.clone(), \"file_name\": service_file_name }));\n        }\n    }\n    let service_mod = handlebars\n        .render(\"service_mod\", &json!({ \"services\": service_names }))\n        .unwrap();\n    let mut service_mod_file = File::create(&format!(\"{}mod.rs\", service_base_path)).unwrap();\n    service_mod_file.write_all(service_mod.as_bytes()).unwrap();\n    let accessory_mod = handlebars\n        .render(\"accessory_mod\", &json!({ \"accessories\": accessory_names }))\n        .unwrap();\n    let mut accessory_mod_file = File::create(&format!(\"{}mod.rs\", accessory_base_path)).unwrap();\n    accessory_mod_file.write_all(accessory_mod.as_bytes()).unwrap();\n}\n"
  },
  {
    "path": "examples/adding_accessories_dynamically.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{bridge::BridgeAccessory, lightbulb::LightbulbAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let bridge = BridgeAccessory::new(1, AccessoryInformation {\n        name: \"Acme Bridge\".into(),\n        ..Default::default()\n    })?;\n    let lightbulb = LightbulbAccessory::new(2, AccessoryInformation {\n        name: \"Acme Lightbulb\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Bridge\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Bridge,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(bridge).await?;\n    server.add_accessory(lightbulb).await?;\n\n    let handle = server.run_handle();\n\n    let stream_of_new_accessories = async {\n        tokio::time::sleep(std::time::Duration::from_secs(60)).await;\n\n        for i in 0..20 {\n            let lightbulb = LightbulbAccessory::new(i + 3, AccessoryInformation {\n                name: format!(\"Another Lightbulb {}\", i + 1),\n                ..Default::default()\n            })?;\n\n            server.add_accessory(lightbulb).await?;\n\n            tokio::time::sleep(std::time::Duration::from_secs(2)).await;\n        }\n\n        Ok(())\n    };\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    futures::try_join!(handle, stream_of_new_accessories)?;\n\n    Ok(())\n}\n"
  },
  {
    "path": "examples/air_purifier.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{air_purifier::AirPurifierAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let air_purifier = AirPurifierAccessory::new(1, AccessoryInformation {\n        name: \"Acme Air Purifier\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Air Purifier\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::AirPurifier,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(air_purifier).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/air_quality_sensor.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{air_quality_sensor::AirQualitySensorAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let air_quality_sensor = AirQualitySensorAccessory::new(1, AccessoryInformation {\n        name: \"Acme Air Quality Sensor\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Air Quality Sensor\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Sensor,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(air_quality_sensor).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/async_callbacks.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{lightbulb::LightbulbAccessory, AccessoryCategory, AccessoryInformation},\n    characteristic::AsyncCharacteristicCallbacks,\n    futures::future::FutureExt,\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let mut lightbulb = LightbulbAccessory::new(1, AccessoryInformation {\n        name: \"Acme Lightbulb\".into(),\n        ..Default::default()\n    })?;\n\n    lightbulb.lightbulb.power_state.on_read_async(Some(|| {\n        async {\n            println!(\"power_state characteristic read\");\n            Ok(None)\n        }\n        .boxed()\n    }));\n    lightbulb\n        .lightbulb\n        .power_state\n        .on_update_async(Some(|current_val: bool, new_val: bool| {\n            async move {\n                println!(\"power_state characteristic updated from {} to {}\", current_val, new_val);\n                Ok(())\n            }\n            .boxed()\n        }));\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Lightbulb\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Lightbulb,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(lightbulb).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/bridged_accessories.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{bridge::BridgeAccessory, lightbulb::LightbulbAccessory, AccessoryCategory, AccessoryInformation},\n    characteristic::CharacteristicCallbacks,\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let bridge = BridgeAccessory::new(1, AccessoryInformation {\n        name: \"Acme Bridge\".into(),\n        ..Default::default()\n    })?;\n    let mut lightbulb_1 = LightbulbAccessory::new(2, AccessoryInformation {\n        name: \"Lightbulb 1\".into(),\n        ..Default::default()\n    })?;\n    let mut lightbulb_2 = LightbulbAccessory::new(3, AccessoryInformation {\n        name: \"Lightbulb 2\".into(),\n        ..Default::default()\n    })?;\n    let mut lightbulb_3 = LightbulbAccessory::new(4, AccessoryInformation {\n        name: \"Lightbulb 3\".into(),\n        ..Default::default()\n    })?;\n\n    lightbulb_1\n        .lightbulb\n        .power_state\n        .on_update(Some(|current_val: &bool, new_val: &bool| {\n            println!(\n                \"Lightbulb 1: power_state characteristic updated from {} to {}\",\n                current_val, new_val\n            );\n            Ok(())\n        }));\n    lightbulb_2\n        .lightbulb\n        .power_state\n        .on_update(Some(|current_val: &bool, new_val: &bool| {\n            println!(\n                \"Lightbulb 2: power_state characteristic updated from {} to {}\",\n                current_val, new_val\n            );\n            Ok(())\n        }));\n    lightbulb_3\n        .lightbulb\n        .power_state\n        .on_update(Some(|current_val: &bool, new_val: &bool| {\n            println!(\n                \"Lightbulb 3: power_state characteristic updated from {} to {}\",\n                current_val, new_val\n            );\n            Ok(())\n        }));\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Bridge\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Bridge,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(bridge).await?;\n    server.add_accessory(lightbulb_1).await?;\n    server.add_accessory(lightbulb_2).await?;\n    server.add_accessory(lightbulb_3).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/callbacks.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{lightbulb::LightbulbAccessory, AccessoryCategory, AccessoryInformation},\n    characteristic::CharacteristicCallbacks,\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let mut lightbulb = LightbulbAccessory::new(1, AccessoryInformation {\n        name: \"Acme Lightbulb\".into(),\n        ..Default::default()\n    })?;\n\n    lightbulb.lightbulb.power_state.on_read(Some(|| {\n        println!(\"power_state characteristic read\");\n        Ok(None)\n    }));\n    lightbulb\n        .lightbulb\n        .power_state\n        .on_update(Some(|current_val: &bool, new_val: &bool| {\n            println!(\"power_state characteristic updated from {} to {}\", current_val, new_val);\n            Ok(())\n        }));\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Lightbulb\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Lightbulb,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(lightbulb).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/carbon_dioxide_sensor.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{carbon_dioxide_sensor::CarbonDioxideSensorAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let carbon_dioxide_sensor = CarbonDioxideSensorAccessory::new(1, AccessoryInformation {\n        name: \"Acme Carbon dioxide Sensor\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Carbon dioxide Sensor\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Sensor,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(carbon_dioxide_sensor).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/carbon_monoxide_sensor.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{carbon_monoxide_sensor::CarbonMonoxideSensorAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let carbon_monoxide_sensor = CarbonMonoxideSensorAccessory::new(1, AccessoryInformation {\n        name: \"Acme Carbon monoxide Sensor\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Carbon monoxide Sensor\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Sensor,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(carbon_monoxide_sensor).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/contact_sensor.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{contact_sensor::ContactSensorAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let contact_sensor = ContactSensorAccessory::new(1, AccessoryInformation {\n        name: \"Acme Contact Sensor\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Contact Sensor\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Sensor,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(contact_sensor).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/cooler.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{heater_cooler::HeaterCoolerAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let cooler = HeaterCoolerAccessory::new(1, AccessoryInformation {\n        name: \"Acme Cooler\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Cooler\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::AirConditioner,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(cooler).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/custom_characteristics_services_accessories.rs",
    "content": "use serde::{\n    ser::{SerializeStruct, Serializer},\n    Serialize,\n};\nuse tokio;\nuse uuid::Uuid;\n\nuse hap::{\n    accessory::{AccessoryCategory, AccessoryInformation, HapAccessory},\n    characteristic::{Characteristic, Format, HapCharacteristic, Perm},\n    server::{IpServer, Server},\n    service::{accessory_information::AccessoryInformationService, HapService},\n    storage::{FileStorage, Storage},\n    Config,\n    HapType,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n// creating a custom service\n\n/// Foo service.\n#[derive(Debug, Default)]\npub struct FooService {\n    /// Instance ID of the Foo service.\n    id: u64,\n    /// [`HapType`](HapType) of the Foo service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n    /// Foo Number characteristic (required).\n    pub foo_number: Characteristic<u8>,\n    /// Foo Name characteristic (required).\n    pub foo_name: Characteristic<String>,\n}\n\nimpl HapService for FooService {\n    fn get_id(&self) -> u64 { self.id }\n\n    fn set_id(&mut self, id: u64) { self.id = id; }\n\n    fn get_type(&self) -> HapType { self.hap_type }\n\n    fn set_type(&mut self, hap_type: HapType) { self.hap_type = hap_type; }\n\n    fn get_hidden(&self) -> bool { self.hidden }\n\n    fn set_hidden(&mut self, hidden: bool) { self.hidden = hidden; }\n\n    fn get_primary(&self) -> bool { self.primary }\n\n    fn set_primary(&mut self, primary: bool) { self.primary = primary; }\n\n    fn get_linked_services(&self) -> Vec<u64> { self.linked_services.clone() }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) { self.linked_services = linked_services; }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> { vec![&self.foo_number, &self.foo_name] }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        vec![&mut self.foo_number, &mut self.foo_name]\n    }\n}\n\nimpl serde::ser::Serialize for FooService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n\n// creating a custom accessory\n\n/// Foo accessory.\n#[derive(Debug, Default)]\npub struct FooAccessory {\n    /// ID of the Foo accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Foo service.\n    pub foo: FooService,\n}\n\nimpl HapAccessory for FooAccessory {\n    fn get_id(&self) -> u64 { self.id }\n\n    fn set_id(&mut self, id: u64) { self.id = id; }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> { vec![&self.accessory_information, &self.foo] }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> { vec![&mut self.accessory_information, &mut self.foo] }\n}\n\nimpl Serialize for FooAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    // Custom Foo Number characteristic.\n    let foo_number = Characteristic::<u8>::new(\n        8,\n        1,\n        HapType::Custom(Uuid::parse_str(\"2db3ac3f-8b9c-4431-8d87-670351dc872a\").unwrap()),\n        Format::UInt8,\n        vec![Perm::PairedRead],\n        Some(\"Foo Number Characteristic\".to_string()),\n        None,\n        42,\n        None,\n        None,\n        None,\n        None,\n        None,\n        None,\n        None,\n        None,\n        None,\n        None,\n    );\n\n    // Custom Foo Name characteristic.\n    let foo_name = Characteristic::<String>::new(\n        9,\n        1,\n        HapType::Custom(Uuid::parse_str(\"497c968e-261f-445d-bcac-69ae7bb8979b\").unwrap()),\n        Format::String,\n        vec![Perm::PairedRead],\n        Some(\"Foo Name Characteristic\".to_string()),\n        None,\n        \"Horst\".to_string(),\n        None,\n        None,\n        None,\n        None,\n        None,\n        None,\n        None,\n        None,\n        None,\n        None,\n    );\n\n    // Custom Foo service.\n    let foo_service = FooService {\n        id: 7, // accessory information service ends at IID 6, so we start counting at 7\n        hap_type: HapType::Custom(Uuid::parse_str(\"d5bb0a60-92f0-483e-811d-97d4b2b502ff\").unwrap()),\n        hidden: false,\n        primary: true,\n        linked_services: vec![],\n        foo_number,\n        foo_name,\n    };\n\n    // Custom Foo accessory.\n    let mut foo_accessory = FooAccessory {\n        id: 1,\n        accessory_information: AccessoryInformation {\n            name: \"Acme Foo\".into(),\n            ..Default::default()\n        }\n        .to_service(1, 1)?,\n        foo: foo_service,\n    };\n\n    foo_accessory.foo.foo_number.on_read(Some(|| {\n        println!(\"foo_number characteristic read\");\n        Ok(None)\n    }));\n\n    foo_accessory.foo.foo_name.on_read(Some(|| {\n        println!(\"foo_name characteristic read\");\n        Ok(None)\n    }));\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Foo\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Other,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(foo_accessory).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/custom_multi_sensor.rs",
    "content": "use serde::{\n    ser::{SerializeStruct, Serializer},\n    Serialize,\n};\nuse tokio;\n\nuse hap::{\n    accessory::{AccessoryCategory, AccessoryInformation, HapAccessory},\n    server::{IpServer, Server},\n    service::{\n        accessory_information::AccessoryInformationService,\n        humidity_sensor::HumiditySensorService,\n        temperature_sensor::TemperatureSensorService,\n        HapService,\n    },\n    storage::{FileStorage, Storage},\n    Config,\n    HapType,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n/// Multi Sensor accessory.\n#[derive(Debug, Default)]\npub struct MultiSensorAccessory {\n    /// ID of the Multi Sensor accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Temperature Sensor service.\n    pub temperature_sensor: TemperatureSensorService,\n    /// Humidity Sensor service.\n    pub humidity_sensor: HumiditySensorService,\n}\n\nimpl HapAccessory for MultiSensorAccessory {\n    fn get_id(&self) -> u64 { self.id }\n\n    fn set_id(&mut self, id: u64) { self.id = id; }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.temperature_sensor,\n            &self.humidity_sensor,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.temperature_sensor,\n            &mut self.humidity_sensor,\n        ]\n    }\n}\n\nimpl Serialize for MultiSensorAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let multi_sensor = MultiSensorAccessory {\n        id: 1,\n        accessory_information: AccessoryInformation {\n            name: \"Acme Temperature & Humidity Sensor\".into(),\n            ..Default::default()\n        }\n        .to_service(1, 1)?,\n        // accessory information service ends at IID 6, so we start counting at 7\n        temperature_sensor: TemperatureSensorService::new(7, 1),\n        // teperature sensor service ends at IID 13, so we start counting at 14\n        humidity_sensor: HumiditySensorService::new(14, 1),\n    };\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Temperature & Humidity Sensor\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Sensor,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(multi_sensor).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/dehumidifier.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{humidifier_dehumidifier::HumidifierDehumidifierAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let dehumidifier = HumidifierDehumidifierAccessory::new(1, AccessoryInformation {\n        name: \"Acme Dehumidifier\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Dehumidifier\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::AirDehumidifier,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(dehumidifier).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/door.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{door::DoorAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let door = DoorAccessory::new(1, AccessoryInformation {\n        name: \"Acme Door\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Door\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Door,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(door).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/fan.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{fan::FanAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let fan = FanAccessory::new(1, AccessoryInformation {\n        name: \"Acme Fan\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Fan\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Fan,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(fan).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/fan_v2.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{fan_v2::FanV2Accessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let fan_v2 = FanV2Accessory::new(1, AccessoryInformation {\n        name: \"Acme Fan v2\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Fan v2\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Fan,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(fan_v2).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/faucet.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{faucet::FaucetAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let faucet = FaucetAccessory::new(1, AccessoryInformation {\n        name: \"Acme Faucet\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Faucet\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Faucet,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(faucet).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/garage_door_opener.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{garage_door_opener::GarageDoorOpenerAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let garage_door_opener = GarageDoorOpenerAccessory::new(1, AccessoryInformation {\n        name: \"Acme Garage Door Opener\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Garage Door Opener\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::GarageDoorOpener,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(garage_door_opener).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/heater.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{heater_cooler::HeaterCoolerAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let heater = HeaterCoolerAccessory::new(1, AccessoryInformation {\n        name: \"Acme Heater\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Heater\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::AirHeater,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(heater).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/humidifier.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{humidifier_dehumidifier::HumidifierDehumidifierAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let humidifier = HumidifierDehumidifierAccessory::new(1, AccessoryInformation {\n        name: \"Acme Humidifier\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Humidifier-Dehumidifier\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::AirDehumidifier,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(humidifier).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/humidity_sensor.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{humidity_sensor::HumiditySensorAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let humidity_sensor = HumiditySensorAccessory::new(1, AccessoryInformation {\n        name: \"Acme Humidity Sensor\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Humidity Sensor\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Sensor,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(humidity_sensor).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/irrigation_system.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{irrigation_system::IrrigationSystemAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let irrigation_system = IrrigationSystemAccessory::new(1, AccessoryInformation {\n        name: \"Acme Irrigation-System\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Irrigation-System\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Sprinkler,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(irrigation_system).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/leak_sensor.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{leak_sensor::LeakSensorAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let leak_sensor = LeakSensorAccessory::new(1, AccessoryInformation {\n        name: \"Acme Leak Sensor\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Leak Sensor\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Sensor,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(leak_sensor).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/light_sensor.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{light_sensor::LightSensorAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let light_sensor = LightSensorAccessory::new(1, AccessoryInformation {\n        name: \"Acme Light Sensor\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Light Sensor\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Sensor,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(light_sensor).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/lightbulb.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{lightbulb::LightbulbAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let lightbulb = LightbulbAccessory::new(1, AccessoryInformation {\n        name: \"Acme Lightbulb\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Lightbulb\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Lightbulb,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(lightbulb).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/lock.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{lock::LockAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let lock = LockAccessory::new(1, AccessoryInformation {\n        name: \"Acme Lock\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Lock\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::DoorLock,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(lock).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/motion_sensor.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{motion_sensor::MotionSensorAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let motion_sensor = MotionSensorAccessory::new(1, AccessoryInformation {\n        name: \"Acme Motion Sensor\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Motion Sensor\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Sensor,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(motion_sensor).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/occupancy_sensor.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{occupancy_sensor::OccupancySensorAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let occupancy_sensor = OccupancySensorAccessory::new(1, AccessoryInformation {\n        name: \"Acme Occupancy Sensor\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Occupancy Sensor\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Sensor,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(occupancy_sensor).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/outlet.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{outlet::OutletAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let outlet = OutletAccessory::new(1, AccessoryInformation {\n        name: \"Acme Outlet\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Outlet\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Outlet,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(outlet).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/security_system.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{security_system::SecuritySystemAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let security_system = SecuritySystemAccessory::new(1, AccessoryInformation {\n        name: \"Acme Security System\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Security System\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::SecuritySystem,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(security_system).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/setting_values_after_server_start.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{motion_sensor::MotionSensorAccessory, AccessoryCategory, AccessoryInformation},\n    serde_json::Value,\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    HapType,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let sensor = MotionSensorAccessory::new(1, AccessoryInformation {\n        name: \"Acme Sensor\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Sensor\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 63]),\n                category: AccessoryCategory::Sensor,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    let sensor_ptr = server.add_accessory(sensor).await?;\n\n    let handle = server.run_handle();\n\n    let value_set_interval = async move {\n        let mut interval = tokio::time::interval(std::time::Duration::from_secs(2));\n\n        tokio::time::sleep(std::time::Duration::from_secs(60)).await;\n\n        loop {\n            interval.tick().await;\n\n            let mut motion_sensor_accessory = sensor_ptr.lock().await;\n            let motion_sensor_service = motion_sensor_accessory.get_mut_service(HapType::MotionSensor).unwrap();\n            let motion_detected_characteristic = motion_sensor_service\n                .get_mut_characteristic(HapType::MotionDetected)\n                .unwrap();\n\n            motion_detected_characteristic.set_value(Value::Bool(true)).await?;\n\n            tokio::time::sleep(std::time::Duration::from_secs(1)).await;\n\n            motion_detected_characteristic.set_value(Value::Bool(false)).await?;\n        }\n\n        #[allow(unreachable_code)]\n        Ok(())\n    };\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    futures::try_join!(handle, value_set_interval)?;\n\n    Ok(())\n}\n"
  },
  {
    "path": "examples/shower_head.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{shower_head::ShowerHeadAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let shower_head = ShowerHeadAccessory::new(1, AccessoryInformation {\n        name: \"Acme Shower Head\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Shower Head\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::ShowerHead,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(shower_head).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/smart_speaker.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{smart_speaker::SmartSpeakerAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let smart_speaker = SmartSpeakerAccessory::new(1, AccessoryInformation {\n        name: \"Acme Smart Speaker\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Smart Speaker\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Speaker,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(smart_speaker).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/smoke_sensor.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{smoke_sensor::SmokeSensorAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let smoke_sensor = SmokeSensorAccessory::new(1, AccessoryInformation {\n        name: \"Acme Smoke Sensor\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Smoke Sensor\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Sensor,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(smoke_sensor).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/stateful_programmable_switch.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{\n        stateful_programmable_switch::StatefulProgrammableSwitchAccessory,\n        AccessoryCategory,\n        AccessoryInformation,\n    },\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let stateful_programmable_switch = StatefulProgrammableSwitchAccessory::new(1, AccessoryInformation {\n        name: \"Acme Stateful Programmable Switch\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Stateful Programmable Switch\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::ProgrammableSwitch,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(stateful_programmable_switch).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/stateless_programmable_switch.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{\n        stateless_programmable_switch::StatelessProgrammableSwitchAccessory,\n        AccessoryCategory,\n        AccessoryInformation,\n    },\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let stateless_programmable_switch = StatelessProgrammableSwitchAccessory::new(1, AccessoryInformation {\n        name: \"Acme Stateless Programmable Switch\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Stateless Programmable Switch\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::ProgrammableSwitch,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(stateless_programmable_switch).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/storing_arbitrary_bytes.rs",
    "content": "use serde::{Deserialize, Serialize};\nuse std::sync::Arc;\nuse tokio::sync::Mutex;\n\nuse hap::{\n    accessory::{lightbulb::LightbulbAccessory, AccessoryCategory, AccessoryInformation},\n    characteristic::AsyncCharacteristicCallbacks,\n    futures::future::FutureExt,\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[derive(Debug, Serialize, Deserialize)]\nstruct LightbulbState {\n    pub power_state: bool,\n}\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let mut lightbulb = LightbulbAccessory::new(1, AccessoryInformation {\n        name: \"Acme Stateful Lightbulb\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Stateful Lightbulb\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Lightbulb,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let state = Arc::new(Mutex::new(match storage.load_bytes(\"state.json\").await {\n        Ok(state_bytes) => {\n            let state = serde_json::from_slice(&state_bytes)?;\n            state\n        },\n        Err(_) => {\n            let state = LightbulbState { power_state: false };\n            let state_bytes = serde_json::to_vec(&state)?;\n            storage.save_bytes(\"state.json\", &state_bytes).await?;\n            state\n        },\n    }));\n\n    let state_ = state.clone();\n    lightbulb.lightbulb.power_state.on_read_async(Some(move || {\n        let state = state_.clone();\n        async move {\n            let power_state = state.lock().await.power_state;\n\n            println!(\"power_state characteristic read from state: {}\", &power_state);\n\n            // have the controller read the value from state\n            Ok(Some(power_state))\n        }\n        .boxed()\n    }));\n\n    // TODO - creating another FileStorage instance on the same underlying directory isn't that elegant\n    let state_storage = Arc::new(Mutex::new(FileStorage::current_dir().await?));\n    let state_ = state.clone();\n    let state_storage_ = state_storage.clone();\n    lightbulb\n        .lightbulb\n        .power_state\n        .on_update_async(Some(move |current_val: bool, new_val: bool| {\n            let state = state_.clone();\n            let storage = state_storage_.clone();\n            async move {\n                if current_val != new_val {\n                    let mut s = state.lock().await;\n                    s.power_state = new_val;\n\n                    // persist the new value\n                    let state_bytes = serde_json::to_vec(&*s)?;\n                    storage.lock().await.save_bytes(\"state.json\", &state_bytes).await?;\n                }\n\n                println!(\"power_state characteristic updated from {} to {}\", current_val, new_val);\n\n                Ok(())\n            }\n            .boxed()\n        }));\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(lightbulb).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/switch.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{switch::SwitchAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let switch = SwitchAccessory::new(1, AccessoryInformation {\n        name: \"Acme Switch\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Switch\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Switch,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(switch).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/television.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{television::TelevisionAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let television = TelevisionAccessory::new(1, AccessoryInformation {\n        name: \"Acme Television\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Television\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Television,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(television).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/temperature_sensor.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{temperature_sensor::TemperatureSensorAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let temperature_sensor = TemperatureSensorAccessory::new(1, AccessoryInformation {\n        name: \"Acme Temperature Sensor\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Temperature Sensor\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Sensor,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(temperature_sensor).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/thermostat.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{thermostat::ThermostatAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let thermostat = ThermostatAccessory::new(1, AccessoryInformation {\n        name: \"Acme Thermostat\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Thermostat\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Thermostat,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(thermostat).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/wi_fi_router.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{wi_fi_router::WiFiRouterAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let wi_fi_router = WiFiRouterAccessory::new(1, AccessoryInformation {\n        name: \"Acme Wi-Fi Router\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Wi-Fi Router\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::WiFiRouter,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(wi_fi_router).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/wi_fi_satellite.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{wi_fi_satellite::WiFiSatelliteAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let wi_fi_satellite = WiFiSatelliteAccessory::new(1, AccessoryInformation {\n        name: \"Acme Wi-Fi Satellite\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Wi-Fi Satellite\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::WiFiRouter,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(wi_fi_satellite).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/window.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{window::WindowAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let window = WindowAccessory::new(1, AccessoryInformation {\n        name: \"Acme Window\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Window\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::Window,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(window).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "examples/window_covering.rs",
    "content": "use tokio;\n\nuse hap::{\n    accessory::{window_covering::WindowCoveringAccessory, AccessoryCategory, AccessoryInformation},\n    server::{IpServer, Server},\n    storage::{FileStorage, Storage},\n    Config,\n    MacAddress,\n    Pin,\n    Result,\n};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let window_covering = WindowCoveringAccessory::new(1, AccessoryInformation {\n        name: \"Acme Window Covering\".into(),\n        ..Default::default()\n    })?;\n\n    let mut storage = FileStorage::current_dir().await?;\n\n    let config = match storage.load_config().await {\n        Ok(mut config) => {\n            config.redetermine_local_ip();\n            storage.save_config(&config).await?;\n            config\n        },\n        Err(_) => {\n            let config = Config {\n                pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n                name: \"Acme Window Covering\".into(),\n                device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n                category: AccessoryCategory::WindowCovering,\n                ..Default::default()\n            };\n            storage.save_config(&config).await?;\n            config\n        },\n    };\n\n    let server = IpServer::new(config, storage).await?;\n    server.add_accessory(window_covering).await?;\n\n    let handle = server.run_handle();\n\n    std::env::set_var(\"RUST_LOG\", \"hap=debug\");\n    env_logger::init();\n\n    handle.await\n}\n"
  },
  {
    "path": "rls.toml",
    "content": "build_on_save = true\n"
  },
  {
    "path": "rustfmt.toml",
    "content": "edition = \"2018\"\nunstable_features = true\nversion = \"Two\"\n\ncomment_width = 120\nfn_single_line = true\nformat_code_in_doc_comments = true\nformat_macro_bodies = true\nformat_macro_matchers = true\nimports_granularity = \"Crate\"\nimports_layout = \"HorizontalVertical\"\nmatch_arm_blocks = false\nmatch_block_trailing_comma = true\nmax_width = 120\noverflow_delimited_expr = true\nreorder_impl_items = true\nuse_field_init_shorthand = true\nuse_try_shorthand = true\nwrap_comments = true\n\nignore = [\n  \"src/accessory/generated/*\",\n  \"src/accessory/category.rs\",\n  \"src/characteristic/generated/*\",\n  \"src/service/generated/*\",\n  \"src/hap_type.rs\",\n]\n"
  },
  {
    "path": "src/accessory/category.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::{Deserialize, Serialize};\n\n/// HAP accessory category.\n#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq)]\npub enum AccessoryCategory {\n\tOther = 1,\n\tBridge = 2,\n\tFan = 3,\n\tGarageDoorOpener = 4,\n\tLightbulb = 5,\n\tDoorLock = 6,\n\tOutlet = 7,\n\tSwitch = 8,\n\tThermostat = 9,\n\tSensor = 10,\n\tSecuritySystem = 11,\n\tDoor = 12,\n\tWindow = 13,\n\tWindowCovering = 14,\n\tProgrammableSwitch = 15,\n\tRangeExtender = 16,\n\tIpCamera = 17,\n\tVideoDoorbell = 18,\n\tAirPurifier = 19,\n\tAirHeater = 20,\n\tAirConditioner = 21,\n\tAirHumidifier = 22,\n\tAirDehumidifier = 23,\n\tAppleTv = 24,\n\tSpeaker = 26,\n\tAirport = 27,\n\tSprinkler = 28,\n\tFaucet = 29,\n\tShowerHead = 30,\n\tTelevision = 31,\n\tTargetController = 32,\n\tWiFiRouter = 33,\n\tAudioReceiver = 34,\n\tTelevisionSetTopBox = 35,\n\tTelevisionStreamingStick = 36,\n}\n"
  },
  {
    "path": "src/accessory/defined/bridge.rs",
    "content": "use serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    accessory::{AccessoryInformation, HapAccessory},\n    service::{accessory_information::AccessoryInformationService, HapService},\n    HapType,\n    Result,\n};\n\n/// Bridge Accessory.\n#[derive(Debug, Default)]\npub struct BridgeAccessory {\n    /// ID of the Bridge Accessory.\n    id: u64,\n\n    /// Accessory Information Service.\n    pub accessory_information: AccessoryInformationService,\n}\n\nimpl BridgeAccessory {\n    /// Creates a new Bridge Accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n\n        Ok(Self {\n            id,\n            accessory_information,\n        })\n    }\n}\n\nimpl HapAccessory for BridgeAccessory {\n    fn get_id(&self) -> u64 { self.id }\n\n    fn set_id(&mut self, id: u64) { self.id = id; }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> { vec![&self.accessory_information] }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> { vec![&mut self.accessory_information] }\n}\n\nimpl Serialize for BridgeAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/defined/faucet.rs",
    "content": "use futures::executor;\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    accessory::{AccessoryInformation, HapAccessory},\n    characteristic::HapCharacteristic,\n    service::{accessory_information::AccessoryInformationService, valve::ValveService, HapService},\n    HapType,\n    Result,\n};\n\n/// Faucet Accessory.\n#[derive(Debug, Default)]\npub struct FaucetAccessory {\n    /// ID of the Faucet Accessory.\n    id: u64,\n\n    /// Accessory Information Service.\n    pub accessory_information: AccessoryInformationService,\n    /// Valve Service.\n    pub valve: ValveService,\n}\n\nimpl FaucetAccessory {\n    /// Creates a new Faucet Accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n\n        let valve_id = 2 + accessory_information.get_characteristics().len() as u64;\n        let mut valve = ValveService::new(valve_id, id);\n        valve.set_primary(true);\n        executor::block_on(valve.valve_type.set_value(3.into()))?; // 3 is FAUCET\n\n        Ok(Self {\n            id,\n            accessory_information,\n            valve,\n        })\n    }\n}\n\nimpl HapAccessory for FaucetAccessory {\n    fn get_id(&self) -> u64 { self.id }\n\n    fn set_id(&mut self, id: u64) { self.id = id; }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> { vec![&self.accessory_information, &self.valve] }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![&mut self.accessory_information, &mut self.valve]\n    }\n}\n\nimpl Serialize for FaucetAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/defined/heater_cooler.rs",
    "content": "use serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    accessory::{AccessoryInformation, HapAccessory},\n    service::{accessory_information::AccessoryInformationService, heater_cooler::HeaterCoolerService, HapService},\n    HapType,\n    Result,\n};\n\n/// Heater-Cooler Accessory.\n#[derive(Debug, Default)]\npub struct HeaterCoolerAccessory {\n    /// ID of the Heater-Cooler Accessory.\n    id: u64,\n\n    /// Accessory Information Service.\n    pub accessory_information: AccessoryInformationService,\n    /// Heater-Cooler Service.\n    pub heater_cooler: HeaterCoolerService,\n}\n\nimpl HeaterCoolerAccessory {\n    /// Creates a new Heater-Cooler Accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let heater_cooler_id = accessory_information.get_characteristics().len() as u64;\n        let mut heater_cooler = HeaterCoolerService::new(1 + heater_cooler_id + 1, id);\n        heater_cooler.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            heater_cooler,\n        })\n    }\n}\n\nimpl HapAccessory for HeaterCoolerAccessory {\n    fn get_id(&self) -> u64 { self.id }\n\n    fn set_id(&mut self, id: u64) { self.id = id; }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> { vec![&self.accessory_information, &self.heater_cooler] }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![&mut self.accessory_information, &mut self.heater_cooler]\n    }\n}\n\nimpl Serialize for HeaterCoolerAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/defined/irrigation_system.rs",
    "content": "use futures::executor;\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    accessory::{AccessoryInformation, HapAccessory},\n    characteristic::HapCharacteristic,\n    service::{accessory_information::AccessoryInformationService, valve::ValveService, HapService},\n    HapType,\n    Result,\n};\n\n/// Irrigation-System Accessory.\n#[derive(Debug, Default)]\npub struct IrrigationSystemAccessory {\n    /// ID of the Irrigation-System Accessory.\n    id: u64,\n\n    /// Accessory Information Service.\n    pub accessory_information: AccessoryInformationService,\n    /// Valve Service.\n    pub valve: ValveService,\n}\n\nimpl IrrigationSystemAccessory {\n    /// Creates a new Irrigation-System Accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n\n        // adding multiple valves here would result in an irrigation system with multiple \"Zones\"\n        let valve_id = 2 + accessory_information.get_characteristics().len() as u64;\n        let mut valve = ValveService::new(valve_id, id);\n        valve.set_primary(true);\n        executor::block_on(valve.valve_type.set_value(1.into()))?; // 1 is IRRIGATION/SPRINKLER\n\n        Ok(Self {\n            id,\n            accessory_information,\n            valve,\n        })\n    }\n}\n\nimpl HapAccessory for IrrigationSystemAccessory {\n    fn get_id(&self) -> u64 { self.id }\n\n    fn set_id(&mut self, id: u64) { self.id = id; }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> { vec![&self.accessory_information, &self.valve] }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![&mut self.accessory_information, &mut self.valve]\n    }\n}\n\nimpl Serialize for IrrigationSystemAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/defined/lightbulb.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    accessory::{AccessoryInformation, HapAccessory},\n    service::{accessory_information::AccessoryInformationService, lightbulb::LightbulbService, HapService},\n    HapType,\n    Result,\n};\n\n/// Lightbulb Accessory.\n#[derive(Debug, Default)]\npub struct LightbulbAccessory {\n    /// ID of the Lightbulb Accessory.\n    id: u64,\n\n    /// Accessory Information Service.\n    pub accessory_information: AccessoryInformationService,\n    /// Lightbulb Service.\n    pub lightbulb: LightbulbService,\n}\n\nimpl LightbulbAccessory {\n    /// Creates a new Lightbulb Accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let lightbulb_id = accessory_information.get_characteristics().len() as u64;\n        let mut lightbulb = LightbulbService::new(1 + lightbulb_id + 1, id);\n        lightbulb.set_primary(true);\n\n        // TODO - this has to do with adaptive lighting and the controller refuses to pair until we figured it out\n        lightbulb.characteristic_value_active_transition_count = None;\n        lightbulb.characteristic_value_transition_control = None;\n        lightbulb.supported_characteristic_value_transition_configuration = None;\n\n        Ok(Self {\n            id,\n            accessory_information,\n            lightbulb,\n        })\n    }\n}\n\nimpl HapAccessory for LightbulbAccessory {\n    fn get_id(&self) -> u64 { self.id }\n\n    fn set_id(&mut self, id: u64) { self.id = id; }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> { vec![&self.accessory_information, &self.lightbulb] }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![&mut self.accessory_information, &mut self.lightbulb]\n    }\n}\n\nimpl Serialize for LightbulbAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/defined/lock.rs",
    "content": "use serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    accessory::{AccessoryInformation, HapAccessory},\n    service::{\n        accessory_information::AccessoryInformationService,\n        lock_management::LockManagementService,\n        lock_mechanism::LockMechanismService,\n        HapService,\n    },\n    HapType,\n    Result,\n};\n\n/// Lock Accessory.\n#[derive(Default)]\npub struct LockAccessory {\n    /// ID of the Lock Accessory.\n    id: u64,\n\n    /// Accessory Information Service.\n    pub accessory_information: AccessoryInformationService,\n    /// Lock Mechanism Service.\n    pub lock_mechanism: LockMechanismService,\n    /// Lock Management Service.\n    pub lock_management: LockManagementService,\n}\n\nimpl LockAccessory {\n    /// Creates a new Lock Accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n\n        let lock_mechanism_id = 2 + accessory_information.get_characteristics().len() as u64;\n        let mut lock_mechanism = LockMechanismService::new(lock_mechanism_id, id);\n        lock_mechanism.set_primary(true);\n\n        let lock_management_id = 3 + lock_mechanism_id + lock_mechanism.get_characteristics().len() as u64;\n        let mut lock_management = LockManagementService::new(lock_management_id, id);\n        lock_management.set_primary(true);\n\n        // TODO - figure out how to auto-set reasonable default values for tlv8 characteristics\n        lock_management.logs = None;\n\n        Ok(Self {\n            id,\n            accessory_information,\n            lock_mechanism,\n            lock_management,\n        })\n    }\n}\n\nimpl HapAccessory for LockAccessory {\n    fn get_id(&self) -> u64 { self.id }\n\n    fn set_id(&mut self, id: u64) { self.id = id; }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![&self.accessory_information, &self.lock_mechanism, &self.lock_management]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.lock_mechanism,\n            &mut self.lock_management,\n        ]\n    }\n}\n\nimpl Serialize for LockAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/defined/mod.rs",
    "content": "/// Bridge accessory definition.\npub mod bridge;\n/// Faucet accessory definition.\npub mod faucet;\n/// Heater-Cooler accessory definition.\npub mod heater_cooler;\n/// Irrigation-System accessory definition.\npub mod irrigation_system;\n/// Lightbulb accessory definition.\npub mod lightbulb;\n/// Lock accessory definition.\npub mod lock;\n/// Shower Head accessory definition.\npub mod shower_head;\n/// Television accessory definition.\npub mod television;\n"
  },
  {
    "path": "src/accessory/defined/shower_head.rs",
    "content": "use futures::executor;\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    accessory::{AccessoryInformation, HapAccessory},\n    characteristic::HapCharacteristic,\n    service::{accessory_information::AccessoryInformationService, valve::ValveService, HapService},\n    HapType,\n    Result,\n};\n\n/// Shower Head Accessory.\n#[derive(Debug, Default)]\npub struct ShowerHeadAccessory {\n    /// ID of the Shower Head Accessory.\n    id: u64,\n\n    /// Accessory Information Service.\n    pub accessory_information: AccessoryInformationService,\n    /// Valve Service.\n    pub valve: ValveService,\n}\n\nimpl ShowerHeadAccessory {\n    /// Creates a new Shower Head Accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n\n        let valve_id = 2 + accessory_information.get_characteristics().len() as u64;\n        let mut valve = ValveService::new(valve_id, id);\n        valve.set_primary(true);\n        executor::block_on(valve.valve_type.set_value(2.into()))?; // 2 is SHOWER_HEAD\n\n        Ok(Self {\n            id,\n            accessory_information,\n            valve,\n        })\n    }\n}\n\nimpl HapAccessory for ShowerHeadAccessory {\n    fn get_id(&self) -> u64 { self.id }\n\n    fn set_id(&mut self, id: u64) { self.id = id; }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> { vec![&self.accessory_information, &self.valve] }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![&mut self.accessory_information, &mut self.valve]\n    }\n}\n\nimpl Serialize for ShowerHeadAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/defined/television.rs",
    "content": "use serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    accessory::{AccessoryInformation, HapAccessory},\n    service::{\n        accessory_information::AccessoryInformationService,\n        speaker::SpeakerService,\n        television::TelevisionService,\n        HapService,\n    },\n    HapType,\n    Result,\n};\n\n/// Television Accessory.\n#[derive(Default)]\npub struct TelevisionAccessory {\n    /// ID of the Television Accessory.\n    id: u64,\n\n    /// Accessory Information Service.\n    pub accessory_information: AccessoryInformationService,\n    /// Television Service.\n    pub television: TelevisionService,\n    /// Speaker Service.\n    pub speaker: SpeakerService,\n}\n\nimpl TelevisionAccessory {\n    /// Creates a new Television Accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n\n        let television_id = 2 + accessory_information.get_characteristics().len() as u64;\n        let mut television = TelevisionService::new(television_id, id);\n        television.set_primary(true);\n\n        // TODO - figure out how to auto-set reasonable default values for tlv8 characteristics\n        television.display_order = None;\n\n        let speaker_id = 3 + television_id + television.get_characteristics().len() as u64;\n        let speaker = SpeakerService::new(speaker_id, id);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            television,\n            speaker,\n        })\n    }\n}\n\nimpl HapAccessory for TelevisionAccessory {\n    fn get_id(&self) -> u64 { self.id }\n\n    fn set_id(&mut self, id: u64) { self.id = id; }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![&self.accessory_information, &self.television, &self.speaker]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![&mut self.accessory_information, &mut self.television, &mut self.speaker]\n    }\n}\n\nimpl Serialize for TelevisionAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/air_purifier.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, air_purifier::AirPurifierService},\n\tHapType,\n\tResult,\n};\n\n/// Air Purifier accessory.\n#[derive(Debug, Default)]\npub struct AirPurifierAccessory {\n    /// ID of the Air Purifier accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Air Purifier service.\n    pub air_purifier: AirPurifierService,\n}\n\nimpl AirPurifierAccessory {\n    /// Creates a new Air Purifier accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let air_purifier_id = accessory_information.get_characteristics().len() as u64;\n        let mut air_purifier = AirPurifierService::new(1 + air_purifier_id + 1, id);\n        air_purifier.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            air_purifier,\n        })\n    }\n}\n\nimpl HapAccessory for AirPurifierAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.air_purifier,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.air_purifier,\n        ]\n    }\n}\n\nimpl Serialize for AirPurifierAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/air_quality_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, air_quality_sensor::AirQualitySensorService},\n\tHapType,\n\tResult,\n};\n\n/// Air Quality Sensor accessory.\n#[derive(Debug, Default)]\npub struct AirQualitySensorAccessory {\n    /// ID of the Air Quality Sensor accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Air Quality Sensor service.\n    pub air_quality_sensor: AirQualitySensorService,\n}\n\nimpl AirQualitySensorAccessory {\n    /// Creates a new Air Quality Sensor accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let air_quality_sensor_id = accessory_information.get_characteristics().len() as u64;\n        let mut air_quality_sensor = AirQualitySensorService::new(1 + air_quality_sensor_id + 1, id);\n        air_quality_sensor.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            air_quality_sensor,\n        })\n    }\n}\n\nimpl HapAccessory for AirQualitySensorAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.air_quality_sensor,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.air_quality_sensor,\n        ]\n    }\n}\n\nimpl Serialize for AirQualitySensorAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/carbon_dioxide_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, carbon_dioxide_sensor::CarbonDioxideSensorService},\n\tHapType,\n\tResult,\n};\n\n/// Carbon dioxide Sensor accessory.\n#[derive(Debug, Default)]\npub struct CarbonDioxideSensorAccessory {\n    /// ID of the Carbon dioxide Sensor accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Carbon dioxide Sensor service.\n    pub carbon_dioxide_sensor: CarbonDioxideSensorService,\n}\n\nimpl CarbonDioxideSensorAccessory {\n    /// Creates a new Carbon dioxide Sensor accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let carbon_dioxide_sensor_id = accessory_information.get_characteristics().len() as u64;\n        let mut carbon_dioxide_sensor = CarbonDioxideSensorService::new(1 + carbon_dioxide_sensor_id + 1, id);\n        carbon_dioxide_sensor.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            carbon_dioxide_sensor,\n        })\n    }\n}\n\nimpl HapAccessory for CarbonDioxideSensorAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.carbon_dioxide_sensor,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.carbon_dioxide_sensor,\n        ]\n    }\n}\n\nimpl Serialize for CarbonDioxideSensorAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/carbon_monoxide_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, carbon_monoxide_sensor::CarbonMonoxideSensorService},\n\tHapType,\n\tResult,\n};\n\n/// Carbon monoxide Sensor accessory.\n#[derive(Debug, Default)]\npub struct CarbonMonoxideSensorAccessory {\n    /// ID of the Carbon monoxide Sensor accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Carbon monoxide Sensor service.\n    pub carbon_monoxide_sensor: CarbonMonoxideSensorService,\n}\n\nimpl CarbonMonoxideSensorAccessory {\n    /// Creates a new Carbon monoxide Sensor accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let carbon_monoxide_sensor_id = accessory_information.get_characteristics().len() as u64;\n        let mut carbon_monoxide_sensor = CarbonMonoxideSensorService::new(1 + carbon_monoxide_sensor_id + 1, id);\n        carbon_monoxide_sensor.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            carbon_monoxide_sensor,\n        })\n    }\n}\n\nimpl HapAccessory for CarbonMonoxideSensorAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.carbon_monoxide_sensor,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.carbon_monoxide_sensor,\n        ]\n    }\n}\n\nimpl Serialize for CarbonMonoxideSensorAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/contact_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, contact_sensor::ContactSensorService},\n\tHapType,\n\tResult,\n};\n\n/// Contact Sensor accessory.\n#[derive(Debug, Default)]\npub struct ContactSensorAccessory {\n    /// ID of the Contact Sensor accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Contact Sensor service.\n    pub contact_sensor: ContactSensorService,\n}\n\nimpl ContactSensorAccessory {\n    /// Creates a new Contact Sensor accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let contact_sensor_id = accessory_information.get_characteristics().len() as u64;\n        let mut contact_sensor = ContactSensorService::new(1 + contact_sensor_id + 1, id);\n        contact_sensor.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            contact_sensor,\n        })\n    }\n}\n\nimpl HapAccessory for ContactSensorAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.contact_sensor,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.contact_sensor,\n        ]\n    }\n}\n\nimpl Serialize for ContactSensorAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/door.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, door::DoorService},\n\tHapType,\n\tResult,\n};\n\n/// Door accessory.\n#[derive(Debug, Default)]\npub struct DoorAccessory {\n    /// ID of the Door accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Door service.\n    pub door: DoorService,\n}\n\nimpl DoorAccessory {\n    /// Creates a new Door accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let door_id = accessory_information.get_characteristics().len() as u64;\n        let mut door = DoorService::new(1 + door_id + 1, id);\n        door.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            door,\n        })\n    }\n}\n\nimpl HapAccessory for DoorAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.door,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.door,\n        ]\n    }\n}\n\nimpl Serialize for DoorAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/fan.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, fan::FanService},\n\tHapType,\n\tResult,\n};\n\n/// Fan accessory.\n#[derive(Debug, Default)]\npub struct FanAccessory {\n    /// ID of the Fan accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Fan service.\n    pub fan: FanService,\n}\n\nimpl FanAccessory {\n    /// Creates a new Fan accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let fan_id = accessory_information.get_characteristics().len() as u64;\n        let mut fan = FanService::new(1 + fan_id + 1, id);\n        fan.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            fan,\n        })\n    }\n}\n\nimpl HapAccessory for FanAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.fan,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.fan,\n        ]\n    }\n}\n\nimpl Serialize for FanAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/fan_v2.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, fan_v2::FanV2Service},\n\tHapType,\n\tResult,\n};\n\n/// Fan v2 accessory.\n#[derive(Debug, Default)]\npub struct FanV2Accessory {\n    /// ID of the Fan v2 accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Fan v2 service.\n    pub fan_v2: FanV2Service,\n}\n\nimpl FanV2Accessory {\n    /// Creates a new Fan v2 accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let fan_v2_id = accessory_information.get_characteristics().len() as u64;\n        let mut fan_v2 = FanV2Service::new(1 + fan_v2_id + 1, id);\n        fan_v2.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            fan_v2,\n        })\n    }\n}\n\nimpl HapAccessory for FanV2Accessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.fan_v2,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.fan_v2,\n        ]\n    }\n}\n\nimpl Serialize for FanV2Accessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/garage_door_opener.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, garage_door_opener::GarageDoorOpenerService},\n\tHapType,\n\tResult,\n};\n\n/// Garage Door Opener accessory.\n#[derive(Debug, Default)]\npub struct GarageDoorOpenerAccessory {\n    /// ID of the Garage Door Opener accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Garage Door Opener service.\n    pub garage_door_opener: GarageDoorOpenerService,\n}\n\nimpl GarageDoorOpenerAccessory {\n    /// Creates a new Garage Door Opener accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let garage_door_opener_id = accessory_information.get_characteristics().len() as u64;\n        let mut garage_door_opener = GarageDoorOpenerService::new(1 + garage_door_opener_id + 1, id);\n        garage_door_opener.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            garage_door_opener,\n        })\n    }\n}\n\nimpl HapAccessory for GarageDoorOpenerAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.garage_door_opener,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.garage_door_opener,\n        ]\n    }\n}\n\nimpl Serialize for GarageDoorOpenerAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/humidifier_dehumidifier.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, humidifier_dehumidifier::HumidifierDehumidifierService},\n\tHapType,\n\tResult,\n};\n\n/// Humidifier-Dehumidifier accessory.\n#[derive(Debug, Default)]\npub struct HumidifierDehumidifierAccessory {\n    /// ID of the Humidifier-Dehumidifier accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Humidifier-Dehumidifier service.\n    pub humidifier_dehumidifier: HumidifierDehumidifierService,\n}\n\nimpl HumidifierDehumidifierAccessory {\n    /// Creates a new Humidifier-Dehumidifier accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let humidifier_dehumidifier_id = accessory_information.get_characteristics().len() as u64;\n        let mut humidifier_dehumidifier = HumidifierDehumidifierService::new(1 + humidifier_dehumidifier_id + 1, id);\n        humidifier_dehumidifier.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            humidifier_dehumidifier,\n        })\n    }\n}\n\nimpl HapAccessory for HumidifierDehumidifierAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.humidifier_dehumidifier,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.humidifier_dehumidifier,\n        ]\n    }\n}\n\nimpl Serialize for HumidifierDehumidifierAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/humidity_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, humidity_sensor::HumiditySensorService},\n\tHapType,\n\tResult,\n};\n\n/// Humidity Sensor accessory.\n#[derive(Debug, Default)]\npub struct HumiditySensorAccessory {\n    /// ID of the Humidity Sensor accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Humidity Sensor service.\n    pub humidity_sensor: HumiditySensorService,\n}\n\nimpl HumiditySensorAccessory {\n    /// Creates a new Humidity Sensor accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let humidity_sensor_id = accessory_information.get_characteristics().len() as u64;\n        let mut humidity_sensor = HumiditySensorService::new(1 + humidity_sensor_id + 1, id);\n        humidity_sensor.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            humidity_sensor,\n        })\n    }\n}\n\nimpl HapAccessory for HumiditySensorAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.humidity_sensor,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.humidity_sensor,\n        ]\n    }\n}\n\nimpl Serialize for HumiditySensorAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/leak_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, leak_sensor::LeakSensorService},\n\tHapType,\n\tResult,\n};\n\n/// Leak Sensor accessory.\n#[derive(Debug, Default)]\npub struct LeakSensorAccessory {\n    /// ID of the Leak Sensor accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Leak Sensor service.\n    pub leak_sensor: LeakSensorService,\n}\n\nimpl LeakSensorAccessory {\n    /// Creates a new Leak Sensor accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let leak_sensor_id = accessory_information.get_characteristics().len() as u64;\n        let mut leak_sensor = LeakSensorService::new(1 + leak_sensor_id + 1, id);\n        leak_sensor.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            leak_sensor,\n        })\n    }\n}\n\nimpl HapAccessory for LeakSensorAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.leak_sensor,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.leak_sensor,\n        ]\n    }\n}\n\nimpl Serialize for LeakSensorAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/light_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, light_sensor::LightSensorService},\n\tHapType,\n\tResult,\n};\n\n/// Light Sensor accessory.\n#[derive(Debug, Default)]\npub struct LightSensorAccessory {\n    /// ID of the Light Sensor accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Light Sensor service.\n    pub light_sensor: LightSensorService,\n}\n\nimpl LightSensorAccessory {\n    /// Creates a new Light Sensor accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let light_sensor_id = accessory_information.get_characteristics().len() as u64;\n        let mut light_sensor = LightSensorService::new(1 + light_sensor_id + 1, id);\n        light_sensor.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            light_sensor,\n        })\n    }\n}\n\nimpl HapAccessory for LightSensorAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.light_sensor,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.light_sensor,\n        ]\n    }\n}\n\nimpl Serialize for LightSensorAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/mod.rs",
    "content": "// this file is auto-generated by hap-codegen\n\n/// Air Purifier accessory definition.\npub mod air_purifier;\n/// Air Quality Sensor accessory definition.\npub mod air_quality_sensor;\n/// Carbon dioxide Sensor accessory definition.\npub mod carbon_dioxide_sensor;\n/// Carbon monoxide Sensor accessory definition.\npub mod carbon_monoxide_sensor;\n/// Contact Sensor accessory definition.\npub mod contact_sensor;\n/// Door accessory definition.\npub mod door;\n/// Fan accessory definition.\npub mod fan;\n/// Fan v2 accessory definition.\npub mod fan_v2;\n/// Garage Door Opener accessory definition.\npub mod garage_door_opener;\n/// Humidifier-Dehumidifier accessory definition.\npub mod humidifier_dehumidifier;\n/// Humidity Sensor accessory definition.\npub mod humidity_sensor;\n/// Leak Sensor accessory definition.\npub mod leak_sensor;\n/// Light Sensor accessory definition.\npub mod light_sensor;\n/// Motion Sensor accessory definition.\npub mod motion_sensor;\n/// Occupancy Sensor accessory definition.\npub mod occupancy_sensor;\n/// Outlet accessory definition.\npub mod outlet;\n/// Security System accessory definition.\npub mod security_system;\n/// Smart Speaker accessory definition.\npub mod smart_speaker;\n/// Smoke Sensor accessory definition.\npub mod smoke_sensor;\n/// Stateful Programmable Switch accessory definition.\npub mod stateful_programmable_switch;\n/// Stateless Programmable Switch accessory definition.\npub mod stateless_programmable_switch;\n/// Switch accessory definition.\npub mod switch;\n/// Temperature Sensor accessory definition.\npub mod temperature_sensor;\n/// Thermostat accessory definition.\npub mod thermostat;\n/// Wi-Fi Router accessory definition.\npub mod wi_fi_router;\n/// Wi-Fi Satellite accessory definition.\npub mod wi_fi_satellite;\n/// Window accessory definition.\npub mod window;\n/// Window Covering accessory definition.\npub mod window_covering;\n"
  },
  {
    "path": "src/accessory/generated/motion_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, motion_sensor::MotionSensorService},\n\tHapType,\n\tResult,\n};\n\n/// Motion Sensor accessory.\n#[derive(Debug, Default)]\npub struct MotionSensorAccessory {\n    /// ID of the Motion Sensor accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Motion Sensor service.\n    pub motion_sensor: MotionSensorService,\n}\n\nimpl MotionSensorAccessory {\n    /// Creates a new Motion Sensor accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let motion_sensor_id = accessory_information.get_characteristics().len() as u64;\n        let mut motion_sensor = MotionSensorService::new(1 + motion_sensor_id + 1, id);\n        motion_sensor.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            motion_sensor,\n        })\n    }\n}\n\nimpl HapAccessory for MotionSensorAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.motion_sensor,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.motion_sensor,\n        ]\n    }\n}\n\nimpl Serialize for MotionSensorAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/occupancy_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, occupancy_sensor::OccupancySensorService},\n\tHapType,\n\tResult,\n};\n\n/// Occupancy Sensor accessory.\n#[derive(Debug, Default)]\npub struct OccupancySensorAccessory {\n    /// ID of the Occupancy Sensor accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Occupancy Sensor service.\n    pub occupancy_sensor: OccupancySensorService,\n}\n\nimpl OccupancySensorAccessory {\n    /// Creates a new Occupancy Sensor accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let occupancy_sensor_id = accessory_information.get_characteristics().len() as u64;\n        let mut occupancy_sensor = OccupancySensorService::new(1 + occupancy_sensor_id + 1, id);\n        occupancy_sensor.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            occupancy_sensor,\n        })\n    }\n}\n\nimpl HapAccessory for OccupancySensorAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.occupancy_sensor,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.occupancy_sensor,\n        ]\n    }\n}\n\nimpl Serialize for OccupancySensorAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/outlet.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, outlet::OutletService},\n\tHapType,\n\tResult,\n};\n\n/// Outlet accessory.\n#[derive(Debug, Default)]\npub struct OutletAccessory {\n    /// ID of the Outlet accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Outlet service.\n    pub outlet: OutletService,\n}\n\nimpl OutletAccessory {\n    /// Creates a new Outlet accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let outlet_id = accessory_information.get_characteristics().len() as u64;\n        let mut outlet = OutletService::new(1 + outlet_id + 1, id);\n        outlet.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            outlet,\n        })\n    }\n}\n\nimpl HapAccessory for OutletAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.outlet,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.outlet,\n        ]\n    }\n}\n\nimpl Serialize for OutletAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/security_system.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, security_system::SecuritySystemService},\n\tHapType,\n\tResult,\n};\n\n/// Security System accessory.\n#[derive(Debug, Default)]\npub struct SecuritySystemAccessory {\n    /// ID of the Security System accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Security System service.\n    pub security_system: SecuritySystemService,\n}\n\nimpl SecuritySystemAccessory {\n    /// Creates a new Security System accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let security_system_id = accessory_information.get_characteristics().len() as u64;\n        let mut security_system = SecuritySystemService::new(1 + security_system_id + 1, id);\n        security_system.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            security_system,\n        })\n    }\n}\n\nimpl HapAccessory for SecuritySystemAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.security_system,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.security_system,\n        ]\n    }\n}\n\nimpl Serialize for SecuritySystemAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/smart_speaker.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, smart_speaker::SmartSpeakerService},\n\tHapType,\n\tResult,\n};\n\n/// Smart Speaker accessory.\n#[derive(Debug, Default)]\npub struct SmartSpeakerAccessory {\n    /// ID of the Smart Speaker accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Smart Speaker service.\n    pub smart_speaker: SmartSpeakerService,\n}\n\nimpl SmartSpeakerAccessory {\n    /// Creates a new Smart Speaker accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let smart_speaker_id = accessory_information.get_characteristics().len() as u64;\n        let mut smart_speaker = SmartSpeakerService::new(1 + smart_speaker_id + 1, id);\n        smart_speaker.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            smart_speaker,\n        })\n    }\n}\n\nimpl HapAccessory for SmartSpeakerAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.smart_speaker,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.smart_speaker,\n        ]\n    }\n}\n\nimpl Serialize for SmartSpeakerAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/smoke_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, smoke_sensor::SmokeSensorService},\n\tHapType,\n\tResult,\n};\n\n/// Smoke Sensor accessory.\n#[derive(Debug, Default)]\npub struct SmokeSensorAccessory {\n    /// ID of the Smoke Sensor accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Smoke Sensor service.\n    pub smoke_sensor: SmokeSensorService,\n}\n\nimpl SmokeSensorAccessory {\n    /// Creates a new Smoke Sensor accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let smoke_sensor_id = accessory_information.get_characteristics().len() as u64;\n        let mut smoke_sensor = SmokeSensorService::new(1 + smoke_sensor_id + 1, id);\n        smoke_sensor.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            smoke_sensor,\n        })\n    }\n}\n\nimpl HapAccessory for SmokeSensorAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.smoke_sensor,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.smoke_sensor,\n        ]\n    }\n}\n\nimpl Serialize for SmokeSensorAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/stateful_programmable_switch.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, stateful_programmable_switch::StatefulProgrammableSwitchService},\n\tHapType,\n\tResult,\n};\n\n/// Stateful Programmable Switch accessory.\n#[derive(Debug, Default)]\npub struct StatefulProgrammableSwitchAccessory {\n    /// ID of the Stateful Programmable Switch accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Stateful Programmable Switch service.\n    pub stateful_programmable_switch: StatefulProgrammableSwitchService,\n}\n\nimpl StatefulProgrammableSwitchAccessory {\n    /// Creates a new Stateful Programmable Switch accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let stateful_programmable_switch_id = accessory_information.get_characteristics().len() as u64;\n        let mut stateful_programmable_switch = StatefulProgrammableSwitchService::new(1 + stateful_programmable_switch_id + 1, id);\n        stateful_programmable_switch.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            stateful_programmable_switch,\n        })\n    }\n}\n\nimpl HapAccessory for StatefulProgrammableSwitchAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.stateful_programmable_switch,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.stateful_programmable_switch,\n        ]\n    }\n}\n\nimpl Serialize for StatefulProgrammableSwitchAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/stateless_programmable_switch.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, stateless_programmable_switch::StatelessProgrammableSwitchService},\n\tHapType,\n\tResult,\n};\n\n/// Stateless Programmable Switch accessory.\n#[derive(Debug, Default)]\npub struct StatelessProgrammableSwitchAccessory {\n    /// ID of the Stateless Programmable Switch accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Stateless Programmable Switch service.\n    pub stateless_programmable_switch: StatelessProgrammableSwitchService,\n}\n\nimpl StatelessProgrammableSwitchAccessory {\n    /// Creates a new Stateless Programmable Switch accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let stateless_programmable_switch_id = accessory_information.get_characteristics().len() as u64;\n        let mut stateless_programmable_switch = StatelessProgrammableSwitchService::new(1 + stateless_programmable_switch_id + 1, id);\n        stateless_programmable_switch.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            stateless_programmable_switch,\n        })\n    }\n}\n\nimpl HapAccessory for StatelessProgrammableSwitchAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.stateless_programmable_switch,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.stateless_programmable_switch,\n        ]\n    }\n}\n\nimpl Serialize for StatelessProgrammableSwitchAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/switch.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, switch::SwitchService},\n\tHapType,\n\tResult,\n};\n\n/// Switch accessory.\n#[derive(Debug, Default)]\npub struct SwitchAccessory {\n    /// ID of the Switch accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Switch service.\n    pub switch: SwitchService,\n}\n\nimpl SwitchAccessory {\n    /// Creates a new Switch accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let switch_id = accessory_information.get_characteristics().len() as u64;\n        let mut switch = SwitchService::new(1 + switch_id + 1, id);\n        switch.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            switch,\n        })\n    }\n}\n\nimpl HapAccessory for SwitchAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.switch,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.switch,\n        ]\n    }\n}\n\nimpl Serialize for SwitchAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/temperature_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, temperature_sensor::TemperatureSensorService},\n\tHapType,\n\tResult,\n};\n\n/// Temperature Sensor accessory.\n#[derive(Debug, Default)]\npub struct TemperatureSensorAccessory {\n    /// ID of the Temperature Sensor accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Temperature Sensor service.\n    pub temperature_sensor: TemperatureSensorService,\n}\n\nimpl TemperatureSensorAccessory {\n    /// Creates a new Temperature Sensor accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let temperature_sensor_id = accessory_information.get_characteristics().len() as u64;\n        let mut temperature_sensor = TemperatureSensorService::new(1 + temperature_sensor_id + 1, id);\n        temperature_sensor.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            temperature_sensor,\n        })\n    }\n}\n\nimpl HapAccessory for TemperatureSensorAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.temperature_sensor,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.temperature_sensor,\n        ]\n    }\n}\n\nimpl Serialize for TemperatureSensorAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/thermostat.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, thermostat::ThermostatService},\n\tHapType,\n\tResult,\n};\n\n/// Thermostat accessory.\n#[derive(Debug, Default)]\npub struct ThermostatAccessory {\n    /// ID of the Thermostat accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Thermostat service.\n    pub thermostat: ThermostatService,\n}\n\nimpl ThermostatAccessory {\n    /// Creates a new Thermostat accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let thermostat_id = accessory_information.get_characteristics().len() as u64;\n        let mut thermostat = ThermostatService::new(1 + thermostat_id + 1, id);\n        thermostat.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            thermostat,\n        })\n    }\n}\n\nimpl HapAccessory for ThermostatAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.thermostat,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.thermostat,\n        ]\n    }\n}\n\nimpl Serialize for ThermostatAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/wi_fi_router.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, wi_fi_router::WiFiRouterService},\n\tHapType,\n\tResult,\n};\n\n/// Wi-Fi Router accessory.\n#[derive(Debug, Default)]\npub struct WiFiRouterAccessory {\n    /// ID of the Wi-Fi Router accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Wi-Fi Router service.\n    pub wi_fi_router: WiFiRouterService,\n}\n\nimpl WiFiRouterAccessory {\n    /// Creates a new Wi-Fi Router accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let wi_fi_router_id = accessory_information.get_characteristics().len() as u64;\n        let mut wi_fi_router = WiFiRouterService::new(1 + wi_fi_router_id + 1, id);\n        wi_fi_router.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            wi_fi_router,\n        })\n    }\n}\n\nimpl HapAccessory for WiFiRouterAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.wi_fi_router,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.wi_fi_router,\n        ]\n    }\n}\n\nimpl Serialize for WiFiRouterAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/wi_fi_satellite.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, wi_fi_satellite::WiFiSatelliteService},\n\tHapType,\n\tResult,\n};\n\n/// Wi-Fi Satellite accessory.\n#[derive(Debug, Default)]\npub struct WiFiSatelliteAccessory {\n    /// ID of the Wi-Fi Satellite accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Wi-Fi Satellite service.\n    pub wi_fi_satellite: WiFiSatelliteService,\n}\n\nimpl WiFiSatelliteAccessory {\n    /// Creates a new Wi-Fi Satellite accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let wi_fi_satellite_id = accessory_information.get_characteristics().len() as u64;\n        let mut wi_fi_satellite = WiFiSatelliteService::new(1 + wi_fi_satellite_id + 1, id);\n        wi_fi_satellite.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            wi_fi_satellite,\n        })\n    }\n}\n\nimpl HapAccessory for WiFiSatelliteAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.wi_fi_satellite,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.wi_fi_satellite,\n        ]\n    }\n}\n\nimpl Serialize for WiFiSatelliteAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/window.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, window::WindowService},\n\tHapType,\n\tResult,\n};\n\n/// Window accessory.\n#[derive(Debug, Default)]\npub struct WindowAccessory {\n    /// ID of the Window accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Window service.\n    pub window: WindowService,\n}\n\nimpl WindowAccessory {\n    /// Creates a new Window accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let window_id = accessory_information.get_characteristics().len() as u64;\n        let mut window = WindowService::new(1 + window_id + 1, id);\n        window.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            window,\n        })\n    }\n}\n\nimpl HapAccessory for WindowAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.window,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.window,\n        ]\n    }\n}\n\nimpl Serialize for WindowAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/generated/window_covering.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n\taccessory::{AccessoryInformation, HapAccessory},\n\tservice::{HapService, accessory_information::AccessoryInformationService, window_covering::WindowCoveringService},\n\tHapType,\n\tResult,\n};\n\n/// Window Covering accessory.\n#[derive(Debug, Default)]\npub struct WindowCoveringAccessory {\n    /// ID of the Window Covering accessory.\n    id: u64,\n\n    /// Accessory Information service.\n    pub accessory_information: AccessoryInformationService,\n    /// Window Covering service.\n    pub window_covering: WindowCoveringService,\n}\n\nimpl WindowCoveringAccessory {\n    /// Creates a new Window Covering accessory.\n    pub fn new(id: u64, information: AccessoryInformation) -> Result<Self> {\n        let accessory_information = information.to_service(1, id)?;\n        let window_covering_id = accessory_information.get_characteristics().len() as u64;\n        let mut window_covering = WindowCoveringService::new(1 + window_covering_id + 1, id);\n        window_covering.set_primary(true);\n\n        Ok(Self {\n            id,\n            accessory_information,\n            window_covering,\n        })\n    }\n}\n\nimpl HapAccessory for WindowCoveringAccessory {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService> {\n        for service in self.get_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService> {\n        for service in self.get_mut_services() {\n            if service.get_type() == hap_type {\n                return Some(service);\n            }\n        }\n        None\n    }\n\n    fn get_services(&self) -> Vec<&dyn HapService> {\n        vec![\n            &self.accessory_information,\n            &self.window_covering,\n        ]\n    }\n\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService> {\n        vec![\n            &mut self.accessory_information,\n            &mut self.window_covering,\n        ]\n    }\n}\n\nimpl Serialize for WindowCoveringAccessory {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapAccessory\", 2)?;\n        state.serialize_field(\"aid\", &self.get_id())?;\n        state.serialize_field(\"services\", &self.get_services())?;\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/accessory/mod.rs",
    "content": "use erased_serde::serialize_trait_object;\nuse futures::executor;\n\nuse crate::{\n    characteristic::{\n        accessory_flags::AccessoryFlagsCharacteristic,\n        application_matching_identifier::ApplicationMatchingIdentifierCharacteristic,\n        configured_name::ConfiguredNameCharacteristic,\n        firmware_revision::FirmwareRevisionCharacteristic,\n        hardware_finish::HardwareFinishCharacteristic,\n        hardware_revision::HardwareRevisionCharacteristic,\n        product_data::ProductDataCharacteristic,\n        software_revision::SoftwareRevisionCharacteristic,\n        HapCharacteristic,\n    },\n    pointer,\n    service::{accessory_information::AccessoryInformationService, HapService},\n    HapType,\n    Result,\n};\n\nmod category;\nmod defined;\nmod generated;\n\npub use crate::accessory::{category::AccessoryCategory, defined::*, generated::*};\n\n/// [`HapAccessory`](HapAccessory) is implemented by every HAP accessory.\npub trait HapAccessory: HapAccessorySetup + erased_serde::Serialize + Send + Sync {\n    /// Returns the ID of the accessory.\n    fn get_id(&self) -> u64;\n    /// Sets the ID of the accessory.\n    fn set_id(&mut self, id: u64);\n    /// Returns a reference to a specific service of the accessory if it's present on it.\n    fn get_service(&self, hap_type: HapType) -> Option<&dyn HapService>;\n    /// Returns a mutable reference to a specific service of the accessory if it's present on it.\n    fn get_mut_service(&mut self, hap_type: HapType) -> Option<&mut dyn HapService>;\n    /// Returns references to all services of the accessory.\n    fn get_services(&self) -> Vec<&dyn HapService>;\n    /// Returns mutable references to all services of the accessory.\n    fn get_mut_services(&mut self) -> Vec<&mut dyn HapService>;\n}\n\nserialize_trait_object!(HapAccessory);\n\n/// [`HapAccessorySetup`](HapAccessorySetup) is implemented by every HAP accessory to provide helper methods used by the\n/// HAP server for setup purposes. It's not meant to be used by a consumer of the library.\npub trait HapAccessorySetup {\n    /// Sets a pointer to an `EventEmitter` on all characteristics of the accessory.\n    fn set_event_emitter_on_characteristics(&mut self, event_emitter: Option<pointer::EventEmitter>);\n}\n\nimpl<H> HapAccessorySetup for H\nwhere\n    H: HapAccessory,\n{\n    fn set_event_emitter_on_characteristics(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        for service in self.get_mut_services() {\n            for characteristic in service.get_mut_characteristics() {\n                characteristic.set_event_emitter(event_emitter.clone());\n            }\n        }\n    }\n}\n\n/// The [`AccessoryInformation`](AccessoryInformation) struct is used to conveniently store metadata about an accessory\n/// and is converted to the [`AccessoryInformationService`](AccessoryInformationService) of the accessory it is passed\n/// to on its creation.\n///\n/// # Examples\n///\n/// ```\n/// use hap::accessory::{outlet::OutletAccessory, AccessoryInformation};\n///\n/// let information = AccessoryInformation {\n///     manufacturer: \"Acme\".into(),\n///     model: \"A1234\".into(),\n///     name: \"Acme Outlet\".into(),\n///     serial_number: \"1A2B3C4D5E6F\".into(),\n///     ..Default::default()\n/// };\n///\n/// let outlet = OutletAccessory::new(1, information).unwrap();\n/// ```\n#[derive(Debug)]\npub struct AccessoryInformation {\n    // TODO - include all possible fields of AccessoryInformationService\n    /// Contains the name of the company whose brand will appear on the accessory, e.g., \"Acme\".\n    pub manufacturer: String,\n    /// Contains the manufacturer-specific model of the accessory, e.g. \"A1234\".\n    pub model: String,\n    /// Describes the name of the accessory.\n    pub name: String,\n    /// Contains the manufacturer-specific serial number of the accessory, e.g. \"1A2B3C4D5E6F\".\n    /// The length must be greater than 1.\n    pub serial_number: String,\n    /// When set indicates accessory requires additional setup. Use of accessory flags requires\n    /// written approval by Apple in advance.\n    pub accessory_flags: Option<u32>,\n    pub application_matching_identifier: Option<Vec<u8>>,\n    pub configured_name: Option<String>,\n    /// Describes a firmware revision string x[.y[.z]] (e.g. \"100.1.1\"):\n    /// - <x> is the major version number, required.\n    /// - <y> is the minor version number, required if it is non-zero or if <z> is present.\n    /// - <z> is the revision version number, required if non-zero.\n    ///\n    /// The firmware revision must follow the below rules:\n    /// - <x> is incremented when there is significant change. e.g., 1.0.0, 2.0.0, 3.0.0, etc.\n    /// - <y> is incremented when minor changes are introduced such as 1.1.0, 2.1.0, 3.1.0 etc.\n    /// - <z> is incremented when bug-fixes are introduced such as 1.0.1, 2.0.1, 3.0.1 etc.\n    /// - Subsequent firmware updates can have a lower <y> version only if <x> is incremented\n    /// - Subsequent firmware updates can have a lower <z> version only if <x> or <y> is incremented\n    ///\n    /// The value must change after every firmware update.\n    pub firmware_revision: Option<String>,\n    pub hardware_finish: Option<Vec<u8>>,\n    /// Describes a hardware revision string x[.y[.z]] (e.g. \"100.1.1\") and tracked when the board\n    /// or components of the same accessory is changed:\n    /// - <x> is the major version number, required.\n    /// - <y> is the minor version number, required if it is non-zero or if <z> is present.\n    /// - <z> is the revision version number, required if non-zero.\n    ///\n    /// The hardware revision must follow the below rules:\n    /// - <x> is incremented when there is significant change. e.g., 1.0.0, 2.0.0, 3.0.0, etc.\n    /// - <y> is incremented when minor changes are introduced such as 1.1.0, 2.1.0, 3.1.0 etc.\n    /// - <z> is incremented when bug-fixes are introduced such as 1.0.1, 2.0.1, 3.0.1 etc.\n    /// - Subsequent firmware updates can have a lower <y> version only if <x> is incremented\n    /// - Subsequent firmware updates can have a lower <z> version only if <x> or <y> is incremented\n    ///\n    /// The value must change after every hardware update.\n    pub hardware_revision: Option<String>,\n    pub product_data: Option<Vec<u8>>,\n    pub software_revision: Option<String>,\n}\n\nimpl AccessoryInformation {\n    /// Converts the `Information` struct to an Accessory Information Service.\n    pub fn to_service(self, id: u64, accessory_id: u64) -> Result<AccessoryInformationService> {\n        let mut i = AccessoryInformationService::new(id, accessory_id);\n\n        executor::block_on(i.identify.set_value(serde_json::Value::Bool(false)))?;\n        executor::block_on(i.manufacturer.set_value(serde_json::Value::String(self.manufacturer)))?;\n        executor::block_on(i.model.set_value(serde_json::Value::String(self.model)))?;\n        executor::block_on(i.name.set_value(serde_json::Value::String(self.name)))?;\n        executor::block_on(i.serial_number.set_value(serde_json::Value::String(self.serial_number)))?;\n\n        if let Some(v) = self.accessory_flags {\n            let mut c = AccessoryFlagsCharacteristic::new(id + 6, accessory_id);\n            executor::block_on(c.set_value(v.into()))?;\n            i.accessory_flags = Some(c);\n        } else {\n            i.accessory_flags = None;\n        }\n\n        if let Some(v) = self.application_matching_identifier {\n            let mut c = ApplicationMatchingIdentifierCharacteristic::new(id + 7, accessory_id);\n            executor::block_on(c.set_value(v.into()))?;\n            i.application_matching_identifier = Some(c);\n        } else {\n            i.application_matching_identifier = None;\n        }\n\n        if let Some(v) = self.configured_name {\n            let mut c = ConfiguredNameCharacteristic::new(id + 8, accessory_id);\n            executor::block_on(c.set_value(v.into()))?;\n            i.configured_name = Some(c);\n        } else {\n            i.configured_name = None;\n        }\n\n        if let Some(v) = self.firmware_revision {\n            let mut c = FirmwareRevisionCharacteristic::new(id + 9, accessory_id);\n            executor::block_on(c.set_value(v.into()))?;\n            i.firmware_revision = Some(c);\n        } else {\n            i.firmware_revision = None;\n        }\n\n        if let Some(v) = self.hardware_finish {\n            let mut c = HardwareFinishCharacteristic::new(id + 12, accessory_id);\n            executor::block_on(c.set_value(v.into()))?;\n            i.hardware_finish = Some(c);\n        } else {\n            i.hardware_finish = None;\n        }\n\n        if let Some(v) = self.hardware_revision {\n            let mut c = HardwareRevisionCharacteristic::new(id + 10, accessory_id);\n            executor::block_on(c.set_value(v.into()))?;\n            i.hardware_revision = Some(c);\n        } else {\n            i.hardware_revision = None;\n        }\n\n        if let Some(v) = self.product_data {\n            let mut c = ProductDataCharacteristic::new(id + 12, accessory_id);\n            executor::block_on(c.set_value(v.into()))?;\n            i.product_data = Some(c);\n        } else {\n            i.product_data = None;\n        }\n\n        if let Some(v) = self.software_revision {\n            let mut c = SoftwareRevisionCharacteristic::new(id + 11, accessory_id);\n            executor::block_on(c.set_value(v.into()))?;\n            i.software_revision = Some(c);\n        } else {\n            i.software_revision = None;\n        }\n\n        Ok(i)\n    }\n}\n\nimpl Default for AccessoryInformation {\n    fn default() -> Self {\n        Self {\n            manufacturer: \"undefined\".into(),\n            model: \"undefined\".into(),\n            name: \"undefined\".into(),\n            serial_number: \"undefined\".into(),\n            accessory_flags: None,\n            application_matching_identifier: None,\n            configured_name: None,\n            firmware_revision: None,\n            hardware_finish: None,\n            hardware_revision: None,\n            product_data: None,\n            software_revision: None,\n        }\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/access_code_control_point.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Access Code Control Point characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct AccessCodeControlPointCharacteristic(Characteristic<Vec<u8>>);\n\nimpl AccessCodeControlPointCharacteristic {\n    /// Creates a new Access Code Control Point characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::AccessCodeControlPoint,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for AccessCodeControlPointCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for AccessCodeControlPointCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for AccessCodeControlPointCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for AccessCodeControlPointCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/access_code_supported_configuration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Access Code Supported Configuration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct AccessCodeSupportedConfigurationCharacteristic(Characteristic<Vec<u8>>);\n\nimpl AccessCodeSupportedConfigurationCharacteristic {\n    /// Creates a new Access Code Supported Configuration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::AccessCodeSupportedConfiguration,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for AccessCodeSupportedConfigurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for AccessCodeSupportedConfigurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for AccessCodeSupportedConfigurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for AccessCodeSupportedConfigurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/access_control_level.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Access Control Level characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct AccessControlLevelCharacteristic(Characteristic<u16>);\n\nimpl AccessControlLevelCharacteristic {\n    /// Creates a new Access Control Level characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u16> {\n            id,\n            accessory_id,\n            hap_type: HapType::AccessControlLevel,\n            format: Format::UInt16,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(2),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for AccessControlLevelCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for AccessControlLevelCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u16> for AccessControlLevelCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u16>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u16>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u16> for AccessControlLevelCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u16>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u16>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/accessory_flags.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Accessory Flags characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct AccessoryFlagsCharacteristic(Characteristic<u32>);\n\nimpl AccessoryFlagsCharacteristic {\n    /// Creates a new Accessory Flags characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u32> {\n            id,\n            accessory_id,\n            hap_type: HapType::AccessoryFlags,\n            format: Format::UInt32,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for AccessoryFlagsCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for AccessoryFlagsCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u32> for AccessoryFlagsCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u32> for AccessoryFlagsCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/accessory_identifier.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Accessory Identifier characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct AccessoryIdentifierCharacteristic(Characteristic<String>);\n\nimpl AccessoryIdentifierCharacteristic {\n    /// Creates a new Accessory Identifier characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<String> {\n            id,\n            accessory_id,\n            hap_type: HapType::AccessoryIdentifier,\n            format: Format::String,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for AccessoryIdentifierCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for AccessoryIdentifierCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<String> for AccessoryIdentifierCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<String>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<String>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<String> for AccessoryIdentifierCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/active.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Active characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ActiveCharacteristic(Characteristic<u8>);\n\nimpl ActiveCharacteristic {\n    /// Creates a new Active characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::Active,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ActiveCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ActiveCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for ActiveCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for ActiveCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/active_identifier.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Active Identifier characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ActiveIdentifierCharacteristic(Characteristic<u32>);\n\nimpl ActiveIdentifierCharacteristic {\n    /// Creates a new Active Identifier characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u32> {\n            id,\n            accessory_id,\n            hap_type: HapType::ActiveIdentifier,\n            format: Format::UInt32,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmin_value: Some(0),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ActiveIdentifierCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ActiveIdentifierCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u32> for ActiveIdentifierCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u32> for ActiveIdentifierCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/activity_interval.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Activity Interval characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ActivityIntervalCharacteristic(Characteristic<u32>);\n\nimpl ActivityIntervalCharacteristic {\n    /// Creates a new Activity Interval characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u32> {\n            id,\n            accessory_id,\n            hap_type: HapType::ActivityInterval,\n            format: Format::UInt32,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ActivityIntervalCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ActivityIntervalCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u32> for ActivityIntervalCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u32> for ActivityIntervalCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/administrator_only_access.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Administrator Only Access characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct AdministratorOnlyAccessCharacteristic(Characteristic<bool>);\n\nimpl AdministratorOnlyAccessCharacteristic {\n    /// Creates a new Administrator Only Access characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::AdministratorOnlyAccess,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for AdministratorOnlyAccessCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for AdministratorOnlyAccessCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for AdministratorOnlyAccessCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for AdministratorOnlyAccessCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/air_particulate_density.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Air Particulate Density characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct AirParticulateDensityCharacteristic(Characteristic<f32>);\n\nimpl AirParticulateDensityCharacteristic {\n    /// Creates a new Air Particulate Density characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::AirParticulateDensity,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::MicrogramsPerCubicMeter),\n\t\t\tmax_value: Some(1000 as f32),\n\t\t\tmin_value: Some(0 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for AirParticulateDensityCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for AirParticulateDensityCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for AirParticulateDensityCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for AirParticulateDensityCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/air_particulate_size.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Air Particulate Size characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct AirParticulateSizeCharacteristic(Characteristic<u8>);\n\nimpl AirParticulateSizeCharacteristic {\n    /// Creates a new Air Particulate Size characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::AirParticulateSize,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for AirParticulateSizeCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for AirParticulateSizeCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for AirParticulateSizeCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for AirParticulateSizeCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/airplay_enable.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// AirPlay Enable characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct AirplayEnableCharacteristic(Characteristic<u8>);\n\nimpl AirplayEnableCharacteristic {\n    /// Creates a new AirPlay Enable characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::AirplayEnable,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for AirplayEnableCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for AirplayEnableCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for AirplayEnableCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for AirplayEnableCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/application_matching_identifier.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Application Matching Identifier characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ApplicationMatchingIdentifierCharacteristic(Characteristic<Vec<u8>>);\n\nimpl ApplicationMatchingIdentifierCharacteristic {\n    /// Creates a new Application Matching Identifier characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::ApplicationMatchingIdentifier,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ApplicationMatchingIdentifierCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ApplicationMatchingIdentifierCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for ApplicationMatchingIdentifierCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for ApplicationMatchingIdentifierCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/asset_update_readiness.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Asset Update Readiness characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct AssetUpdateReadinessCharacteristic(Characteristic<u32>);\n\nimpl AssetUpdateReadinessCharacteristic {\n    /// Creates a new Asset Update Readiness characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u32> {\n            id,\n            accessory_id,\n            hap_type: HapType::AssetUpdateReadiness,\n            format: Format::UInt32,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for AssetUpdateReadinessCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for AssetUpdateReadinessCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u32> for AssetUpdateReadinessCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u32> for AssetUpdateReadinessCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/audio_feedback.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Audio Feedback characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct AudioFeedbackCharacteristic(Characteristic<bool>);\n\nimpl AudioFeedbackCharacteristic {\n    /// Creates a new Audio Feedback characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::AudioFeedback,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for AudioFeedbackCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for AudioFeedbackCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for AudioFeedbackCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for AudioFeedbackCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/battery_level.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Battery Level characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct BatteryLevelCharacteristic(Characteristic<u8>);\n\nimpl BatteryLevelCharacteristic {\n    /// Creates a new Battery Level characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::BatteryLevel,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::Percentage),\n\t\t\tmax_value: Some(100),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for BatteryLevelCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for BatteryLevelCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for BatteryLevelCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for BatteryLevelCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/brightness.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Brightness characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct BrightnessCharacteristic(Characteristic<i32>);\n\nimpl BrightnessCharacteristic {\n    /// Creates a new Brightness characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<i32> {\n            id,\n            accessory_id,\n            hap_type: HapType::Brightness,\n            format: Format::Int32,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tunit: Some(Unit::Percentage),\n\t\t\tmax_value: Some(100),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for BrightnessCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for BrightnessCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<i32> for BrightnessCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<i32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<i32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<i32> for BrightnessCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/button_event.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Button Event characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ButtonEventCharacteristic(Characteristic<Vec<u8>>);\n\nimpl ButtonEventCharacteristic {\n    /// Creates a new Button Event characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::ButtonEvent,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ButtonEventCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ButtonEventCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for ButtonEventCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for ButtonEventCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/camera_operating_mode_indicator.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Camera Operating Mode Indicator characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CameraOperatingModeIndicatorCharacteristic(Characteristic<bool>);\n\nimpl CameraOperatingModeIndicatorCharacteristic {\n    /// Creates a new Camera Operating Mode Indicator characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::CameraOperatingModeIndicator,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n\t\t\t\tPerm::TimedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CameraOperatingModeIndicatorCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CameraOperatingModeIndicatorCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for CameraOperatingModeIndicatorCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for CameraOperatingModeIndicatorCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/carbon_dioxide_detected.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Carbon dioxide Detected characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CarbonDioxideDetectedCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tNormal = 0,\n\tAbnormal = 1,\n}\n\nimpl CarbonDioxideDetectedCharacteristic {\n    /// Creates a new Carbon dioxide Detected characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::CarbonDioxideDetected,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // NORMAL\n\t\t\t\t1, // ABNORMAL\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CarbonDioxideDetectedCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CarbonDioxideDetectedCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for CarbonDioxideDetectedCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for CarbonDioxideDetectedCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/carbon_dioxide_level.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Carbon dioxide Level characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CarbonDioxideLevelCharacteristic(Characteristic<f32>);\n\nimpl CarbonDioxideLevelCharacteristic {\n    /// Creates a new Carbon dioxide Level characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::CarbonDioxideLevel,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::PartsPerMillion),\n\t\t\tmax_value: Some(100000 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CarbonDioxideLevelCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CarbonDioxideLevelCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for CarbonDioxideLevelCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for CarbonDioxideLevelCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/carbon_dioxide_peak_level.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Carbon dioxide Peak Level characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CarbonDioxidePeakLevelCharacteristic(Characteristic<f32>);\n\nimpl CarbonDioxidePeakLevelCharacteristic {\n    /// Creates a new Carbon dioxide Peak Level characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::CarbonDioxidePeakLevel,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::PartsPerMillion),\n\t\t\tmax_value: Some(100000 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CarbonDioxidePeakLevelCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CarbonDioxidePeakLevelCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for CarbonDioxidePeakLevelCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for CarbonDioxidePeakLevelCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/carbon_monoxide_detected.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Carbon monoxide Detected characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CarbonMonoxideDetectedCharacteristic(Characteristic<u8>);\n\nimpl CarbonMonoxideDetectedCharacteristic {\n    /// Creates a new Carbon monoxide Detected characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::CarbonMonoxideDetected,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CarbonMonoxideDetectedCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CarbonMonoxideDetectedCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for CarbonMonoxideDetectedCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for CarbonMonoxideDetectedCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/carbon_monoxide_level.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Carbon monoxide Level characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CarbonMonoxideLevelCharacteristic(Characteristic<f32>);\n\nimpl CarbonMonoxideLevelCharacteristic {\n    /// Creates a new Carbon monoxide Level characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::CarbonMonoxideLevel,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::PartsPerMillion),\n\t\t\tmax_value: Some(100 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CarbonMonoxideLevelCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CarbonMonoxideLevelCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for CarbonMonoxideLevelCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for CarbonMonoxideLevelCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/carbon_monoxide_peak_level.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Carbon monoxide Peak Level characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CarbonMonoxidePeakLevelCharacteristic(Characteristic<f32>);\n\nimpl CarbonMonoxidePeakLevelCharacteristic {\n    /// Creates a new Carbon monoxide Peak Level characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::CarbonMonoxidePeakLevel,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::PartsPerMillion),\n\t\t\tmax_value: Some(100 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CarbonMonoxidePeakLevelCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CarbonMonoxidePeakLevelCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for CarbonMonoxidePeakLevelCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for CarbonMonoxidePeakLevelCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/cca_energy_detect_threshold.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// CCA Energy Detect Threshold characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CcaEnergyDetectThresholdCharacteristic(Characteristic<i32>);\n\nimpl CcaEnergyDetectThresholdCharacteristic {\n    /// Creates a new CCA Energy Detect Threshold characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<i32> {\n            id,\n            accessory_id,\n            hap_type: HapType::CcaEnergyDetectThreshold,\n            format: Format::Int32,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CcaEnergyDetectThresholdCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CcaEnergyDetectThresholdCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<i32> for CcaEnergyDetectThresholdCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<i32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<i32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<i32> for CcaEnergyDetectThresholdCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/cca_signal_detect_threshold.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// CCA Signal Detect Threshold characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CcaSignalDetectThresholdCharacteristic(Characteristic<i32>);\n\nimpl CcaSignalDetectThresholdCharacteristic {\n    /// Creates a new CCA Signal Detect Threshold characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<i32> {\n            id,\n            accessory_id,\n            hap_type: HapType::CcaSignalDetectThreshold,\n            format: Format::Int32,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CcaSignalDetectThresholdCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CcaSignalDetectThresholdCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<i32> for CcaSignalDetectThresholdCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<i32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<i32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<i32> for CcaSignalDetectThresholdCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/characteristic_value_active_transition_count.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Characteristic Value Active Transition Count characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CharacteristicValueActiveTransitionCountCharacteristic(Characteristic<u8>);\n\nimpl CharacteristicValueActiveTransitionCountCharacteristic {\n    /// Creates a new Characteristic Value Active Transition Count characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::CharacteristicValueActiveTransitionCount,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CharacteristicValueActiveTransitionCountCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CharacteristicValueActiveTransitionCountCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for CharacteristicValueActiveTransitionCountCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for CharacteristicValueActiveTransitionCountCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/characteristic_value_transition_control.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Characteristic Value Transition Control characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CharacteristicValueTransitionControlCharacteristic(Characteristic<Vec<u8>>);\n\nimpl CharacteristicValueTransitionControlCharacteristic {\n    /// Creates a new Characteristic Value Transition Control characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::CharacteristicValueTransitionControl,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CharacteristicValueTransitionControlCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CharacteristicValueTransitionControlCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for CharacteristicValueTransitionControlCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for CharacteristicValueTransitionControlCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/charging_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Charging State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ChargingStateCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tNotCharging = 0,\n\tCharging = 1,\n\tNotChargeable = 2,\n}\n\nimpl ChargingStateCharacteristic {\n    /// Creates a new Charging State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::ChargingState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(2),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // NOT_CHARGING\n\t\t\t\t1, // CHARGING\n\t\t\t\t2, // NOT_CHARGEABLE\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ChargingStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ChargingStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for ChargingStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for ChargingStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/closed_captions.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Closed Captions characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ClosedCaptionsCharacteristic(Characteristic<u8>);\n\nimpl ClosedCaptionsCharacteristic {\n    /// Creates a new Closed Captions characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::ClosedCaptions,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ClosedCaptionsCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ClosedCaptionsCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for ClosedCaptionsCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for ClosedCaptionsCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/cloud_relay_control_point.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Cloud Relay Control Point characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CloudRelayControlPointCharacteristic(Characteristic<Vec<u8>>);\n\nimpl CloudRelayControlPointCharacteristic {\n    /// Creates a new Cloud Relay Control Point characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::CloudRelayControlPoint,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CloudRelayControlPointCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CloudRelayControlPointCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for CloudRelayControlPointCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for CloudRelayControlPointCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/cloud_relay_current_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Cloud Relay Current State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CloudRelayCurrentStateCharacteristic(Characteristic<u8>);\n\nimpl CloudRelayCurrentStateCharacteristic {\n    /// Creates a new Cloud Relay Current State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::CloudRelayCurrentState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(5),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CloudRelayCurrentStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CloudRelayCurrentStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for CloudRelayCurrentStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for CloudRelayCurrentStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/cloud_relay_enable_status.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Cloud Relay Enable Status characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CloudRelayEnableStatusCharacteristic(Characteristic<bool>);\n\nimpl CloudRelayEnableStatusCharacteristic {\n    /// Creates a new Cloud Relay Enable Status characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::CloudRelayEnableStatus,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CloudRelayEnableStatusCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CloudRelayEnableStatusCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for CloudRelayEnableStatusCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for CloudRelayEnableStatusCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/color_temperature.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Color Temperature characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ColorTemperatureCharacteristic(Characteristic<i32>);\n\nimpl ColorTemperatureCharacteristic {\n    /// Creates a new Color Temperature characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<i32> {\n            id,\n            accessory_id,\n            hap_type: HapType::ColorTemperature,\n            format: Format::Int32,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(500),\n\t\t\tmin_value: Some(140),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ColorTemperatureCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ColorTemperatureCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<i32> for ColorTemperatureCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<i32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<i32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<i32> for ColorTemperatureCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/configuration_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Configuration State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ConfigurationStateCharacteristic(Characteristic<u16>);\n\nimpl ConfigurationStateCharacteristic {\n    /// Creates a new Configuration State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u16> {\n            id,\n            accessory_id,\n            hap_type: HapType::ConfigurationState,\n            format: Format::UInt16,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ConfigurationStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ConfigurationStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u16> for ConfigurationStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u16>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u16>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u16> for ConfigurationStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u16>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u16>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/configured_name.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Configured Name characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ConfiguredNameCharacteristic(Characteristic<String>);\n\nimpl ConfiguredNameCharacteristic {\n    /// Creates a new Configured Name characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<String> {\n            id,\n            accessory_id,\n            hap_type: HapType::ConfiguredName,\n            format: Format::String,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ConfiguredNameCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ConfiguredNameCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<String> for ConfiguredNameCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<String>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<String>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<String> for ConfiguredNameCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/contact_sensor_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Contact Sensor State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ContactSensorStateCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tNum0 = 0,\n\tNum1 = 1,\n}\n\nimpl ContactSensorStateCharacteristic {\n    /// Creates a new Contact Sensor State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::ContactSensorState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // 0\n\t\t\t\t1, // 1\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ContactSensorStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ContactSensorStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for ContactSensorStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for ContactSensorStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/cooling_threshold_temperature.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Cooling Threshold Temperature characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CoolingThresholdTemperatureCharacteristic(Characteristic<f32>);\n\nimpl CoolingThresholdTemperatureCharacteristic {\n    /// Creates a new Cooling Threshold Temperature characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::CoolingThresholdTemperature,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tunit: Some(Unit::Celsius),\n\t\t\tmax_value: Some(35 as f32),\n\t\t\tmin_value: Some(10 as f32),\n\t\t\tstep_value: Some(0.1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CoolingThresholdTemperatureCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CoolingThresholdTemperatureCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for CoolingThresholdTemperatureCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for CoolingThresholdTemperatureCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/current_air_purifier_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Current Air Purifier State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CurrentAirPurifierStateCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tInactive = 0,\n\tIdle = 1,\n\tPurifyingAir = 2,\n}\n\nimpl CurrentAirPurifierStateCharacteristic {\n    /// Creates a new Current Air Purifier State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::CurrentAirPurifierState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(2),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // INACTIVE\n\t\t\t\t1, // IDLE\n\t\t\t\t2, // PURIFYING_AIR\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CurrentAirPurifierStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CurrentAirPurifierStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for CurrentAirPurifierStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for CurrentAirPurifierStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/current_air_quality.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Current Air Quality characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CurrentAirQualityCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tUnknown = 0,\n\tExcellent = 1,\n\tGood = 2,\n\tFair = 3,\n\tInferior = 4,\n\tPoor = 5,\n}\n\nimpl CurrentAirQualityCharacteristic {\n    /// Creates a new Current Air Quality characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::CurrentAirQuality,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(5),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // UNKNOWN\n\t\t\t\t1, // EXCELLENT\n\t\t\t\t2, // GOOD\n\t\t\t\t3, // FAIR\n\t\t\t\t4, // INFERIOR\n\t\t\t\t5, // POOR\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CurrentAirQualityCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CurrentAirQualityCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for CurrentAirQualityCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for CurrentAirQualityCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/current_door_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Current Door State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CurrentDoorStateCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tNum1 = 0,\n\tNum0 = 1,\n\tNum2 = 2,\n\tNum3 = 3,\n\tNum4 = 4,\n}\n\nimpl CurrentDoorStateCharacteristic {\n    /// Creates a new Current Door State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::CurrentDoorState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(4),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // 1\n\t\t\t\t1, // 0\n\t\t\t\t2, // 2\n\t\t\t\t3, // 3\n\t\t\t\t4, // 4\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CurrentDoorStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CurrentDoorStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for CurrentDoorStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for CurrentDoorStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/current_fan_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Current Fan State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CurrentFanStateCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tInactive = 0,\n\tIdle = 1,\n\tBlowing = 2,\n}\n\nimpl CurrentFanStateCharacteristic {\n    /// Creates a new Current Fan State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::CurrentFanState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(2),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // INACTIVE\n\t\t\t\t1, // IDLE\n\t\t\t\t2, // BLOWING\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CurrentFanStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CurrentFanStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for CurrentFanStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for CurrentFanStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/current_heater_cooler_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Current Heater-Cooler State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CurrentHeaterCoolerStateCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tInactive = 0,\n\tIdle = 1,\n\tHeating = 2,\n\tCooling = 3,\n}\n\nimpl CurrentHeaterCoolerStateCharacteristic {\n    /// Creates a new Current Heater-Cooler State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::CurrentHeaterCoolerState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(3),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // INACTIVE\n\t\t\t\t1, // IDLE\n\t\t\t\t2, // HEATING\n\t\t\t\t3, // COOLING\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CurrentHeaterCoolerStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CurrentHeaterCoolerStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for CurrentHeaterCoolerStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for CurrentHeaterCoolerStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/current_heating_cooling_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Current Heating Cooling State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CurrentHeatingCoolingStateCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tOff = 0,\n\tHeat = 1,\n\tCool = 2,\n\tAuto = 3,\n}\n\nimpl CurrentHeatingCoolingStateCharacteristic {\n    /// Creates a new Current Heating Cooling State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::CurrentHeatingCoolingState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(2),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // OFF\n\t\t\t\t1, // HEAT\n\t\t\t\t2, // COOL\n\t\t\t\t3, // AUTO\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CurrentHeatingCoolingStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CurrentHeatingCoolingStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for CurrentHeatingCoolingStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for CurrentHeatingCoolingStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/current_horizontal_tilt_angle.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Current Horizontal Tilt Angle characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CurrentHorizontalTiltAngleCharacteristic(Characteristic<i32>);\n\nimpl CurrentHorizontalTiltAngleCharacteristic {\n    /// Creates a new Current Horizontal Tilt Angle characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<i32> {\n            id,\n            accessory_id,\n            hap_type: HapType::CurrentHorizontalTiltAngle,\n            format: Format::Int32,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::ArcDegrees),\n\t\t\tmax_value: Some(90),\n\t\t\tmin_value: Some(-90),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CurrentHorizontalTiltAngleCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CurrentHorizontalTiltAngleCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<i32> for CurrentHorizontalTiltAngleCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<i32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<i32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<i32> for CurrentHorizontalTiltAngleCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/current_humidifier_dehumidifier_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Current Humidifier-Dehumidifier State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CurrentHumidifierDehumidifierStateCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tInactive = 0,\n\tIdle = 1,\n\tHumidifying = 2,\n\tDehumidifying = 3,\n}\n\nimpl CurrentHumidifierDehumidifierStateCharacteristic {\n    /// Creates a new Current Humidifier-Dehumidifier State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::CurrentHumidifierDehumidifierState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(3),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // INACTIVE\n\t\t\t\t1, // IDLE\n\t\t\t\t2, // HUMIDIFYING\n\t\t\t\t3, // DEHUMIDIFYING\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CurrentHumidifierDehumidifierStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CurrentHumidifierDehumidifierStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for CurrentHumidifierDehumidifierStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for CurrentHumidifierDehumidifierStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/current_light_level.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Current Light Level characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CurrentLightLevelCharacteristic(Characteristic<f32>);\n\nimpl CurrentLightLevelCharacteristic {\n    /// Creates a new Current Light Level characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::CurrentLightLevel,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::Lux),\n\t\t\tmax_value: Some(100000 as f32),\n\t\t\tmin_value: Some(0.0001 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CurrentLightLevelCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CurrentLightLevelCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for CurrentLightLevelCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for CurrentLightLevelCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/current_media_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Current Media State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CurrentMediaStateCharacteristic(Characteristic<u8>);\n\nimpl CurrentMediaStateCharacteristic {\n    /// Creates a new Current Media State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::CurrentMediaState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(5),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CurrentMediaStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CurrentMediaStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for CurrentMediaStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for CurrentMediaStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/current_position.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Current Position characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CurrentPositionCharacteristic(Characteristic<u8>);\n\nimpl CurrentPositionCharacteristic {\n    /// Creates a new Current Position characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::CurrentPosition,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::Percentage),\n\t\t\tmax_value: Some(100),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CurrentPositionCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CurrentPositionCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for CurrentPositionCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for CurrentPositionCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/current_relative_humidity.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Current Relative Humidity characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CurrentRelativeHumidityCharacteristic(Characteristic<f32>);\n\nimpl CurrentRelativeHumidityCharacteristic {\n    /// Creates a new Current Relative Humidity characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::CurrentRelativeHumidity,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::Percentage),\n\t\t\tmax_value: Some(100 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CurrentRelativeHumidityCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CurrentRelativeHumidityCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for CurrentRelativeHumidityCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for CurrentRelativeHumidityCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/current_slat_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Current Slat State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CurrentSlatStateCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tInactive = 0,\n\tFixed = 1,\n\tSwinging = 2,\n\tJammed = 3,\n}\n\nimpl CurrentSlatStateCharacteristic {\n    /// Creates a new Current Slat State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::CurrentSlatState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(3),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // INACTIVE\n\t\t\t\t1, // FIXED\n\t\t\t\t2, // SWINGING\n\t\t\t\t3, // JAMMED\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CurrentSlatStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CurrentSlatStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for CurrentSlatStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for CurrentSlatStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/current_temperature.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Current Temperature characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CurrentTemperatureCharacteristic(Characteristic<f32>);\n\nimpl CurrentTemperatureCharacteristic {\n    /// Creates a new Current Temperature characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::CurrentTemperature,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::Celsius),\n\t\t\tmax_value: Some(100 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(0.1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CurrentTemperatureCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CurrentTemperatureCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for CurrentTemperatureCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for CurrentTemperatureCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/current_tilt_angle.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Current Tilt Angle characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CurrentTiltAngleCharacteristic(Characteristic<i32>);\n\nimpl CurrentTiltAngleCharacteristic {\n    /// Creates a new Current Tilt Angle characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<i32> {\n            id,\n            accessory_id,\n            hap_type: HapType::CurrentTiltAngle,\n            format: Format::Int32,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::ArcDegrees),\n\t\t\tmax_value: Some(90),\n\t\t\tmin_value: Some(-90),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CurrentTiltAngleCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CurrentTiltAngleCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<i32> for CurrentTiltAngleCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<i32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<i32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<i32> for CurrentTiltAngleCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/current_transport.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Current Transport characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CurrentTransportCharacteristic(Characteristic<bool>);\n\nimpl CurrentTransportCharacteristic {\n    /// Creates a new Current Transport characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::CurrentTransport,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CurrentTransportCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CurrentTransportCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for CurrentTransportCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for CurrentTransportCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/current_vertical_tilt_angle.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Current Vertical Tilt Angle characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CurrentVerticalTiltAngleCharacteristic(Characteristic<i32>);\n\nimpl CurrentVerticalTiltAngleCharacteristic {\n    /// Creates a new Current Vertical Tilt Angle characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<i32> {\n            id,\n            accessory_id,\n            hap_type: HapType::CurrentVerticalTiltAngle,\n            format: Format::Int32,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::ArcDegrees),\n\t\t\tmax_value: Some(90),\n\t\t\tmin_value: Some(-90),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CurrentVerticalTiltAngleCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CurrentVerticalTiltAngleCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<i32> for CurrentVerticalTiltAngleCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<i32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<i32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<i32> for CurrentVerticalTiltAngleCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/current_visibility_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Current Visibility State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CurrentVisibilityStateCharacteristic(Characteristic<u8>);\n\nimpl CurrentVisibilityStateCharacteristic {\n    /// Creates a new Current Visibility State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::CurrentVisibilityState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(3),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CurrentVisibilityStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CurrentVisibilityStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for CurrentVisibilityStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for CurrentVisibilityStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/current_water_level.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Current Water Level characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct CurrentWaterLevelCharacteristic(Characteristic<f32>);\n\nimpl CurrentWaterLevelCharacteristic {\n    /// Creates a new Current Water Level characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::CurrentWaterLevel,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::Percentage),\n\t\t\tmax_value: Some(100 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for CurrentWaterLevelCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for CurrentWaterLevelCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for CurrentWaterLevelCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for CurrentWaterLevelCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/data_stream_hap_transport.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Data Stream HAP Transport characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct DataStreamHapTransportCharacteristic(Characteristic<Vec<u8>>);\n\nimpl DataStreamHapTransportCharacteristic {\n    /// Creates a new Data Stream HAP Transport characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::DataStreamHapTransport,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for DataStreamHapTransportCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for DataStreamHapTransportCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for DataStreamHapTransportCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for DataStreamHapTransportCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/data_stream_hap_transport_interrupt.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Data Stream HAP Transport Interrupt characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct DataStreamHapTransportInterruptCharacteristic(Characteristic<Vec<u8>>);\n\nimpl DataStreamHapTransportInterruptCharacteristic {\n    /// Creates a new Data Stream HAP Transport Interrupt characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::DataStreamHapTransportInterrupt,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for DataStreamHapTransportInterruptCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for DataStreamHapTransportInterruptCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for DataStreamHapTransportInterruptCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for DataStreamHapTransportInterruptCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/digital_zoom.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Digital Zoom characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct DigitalZoomCharacteristic(Characteristic<f32>);\n\nimpl DigitalZoomCharacteristic {\n    /// Creates a new Digital Zoom characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::DigitalZoom,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tstep_value: Some(0.1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for DigitalZoomCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for DigitalZoomCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for DigitalZoomCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for DigitalZoomCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/display_order.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Display Order characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct DisplayOrderCharacteristic(Characteristic<Vec<u8>>);\n\nimpl DisplayOrderCharacteristic {\n    /// Creates a new Display Order characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::DisplayOrder,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for DisplayOrderCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for DisplayOrderCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for DisplayOrderCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for DisplayOrderCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/event_retransmission_maximum.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Event Retransmission Maximum characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct EventRetransmissionMaximumCharacteristic(Characteristic<u8>);\n\nimpl EventRetransmissionMaximumCharacteristic {\n    /// Creates a new Event Retransmission Maximum characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::EventRetransmissionMaximum,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for EventRetransmissionMaximumCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for EventRetransmissionMaximumCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for EventRetransmissionMaximumCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for EventRetransmissionMaximumCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/event_snapshots_active.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Event Snapshots Active characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct EventSnapshotsActiveCharacteristic(Characteristic<bool>);\n\nimpl EventSnapshotsActiveCharacteristic {\n    /// Creates a new Event Snapshots Active characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::EventSnapshotsActive,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n\t\t\t\tPerm::TimedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for EventSnapshotsActiveCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for EventSnapshotsActiveCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for EventSnapshotsActiveCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for EventSnapshotsActiveCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/event_transmission_counters.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Event Transmission Counters characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct EventTransmissionCountersCharacteristic(Characteristic<u32>);\n\nimpl EventTransmissionCountersCharacteristic {\n    /// Creates a new Event Transmission Counters characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u32> {\n            id,\n            accessory_id,\n            hap_type: HapType::EventTransmissionCounters,\n            format: Format::UInt32,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for EventTransmissionCountersCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for EventTransmissionCountersCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u32> for EventTransmissionCountersCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u32> for EventTransmissionCountersCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/filter_change_indication.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Filter Change indication characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct FilterChangeIndicationCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tNoChange = 0,\n\tChange = 1,\n}\n\nimpl FilterChangeIndicationCharacteristic {\n    /// Creates a new Filter Change indication characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::FilterChangeIndication,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // NO_CHANGE\n\t\t\t\t1, // CHANGE\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for FilterChangeIndicationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for FilterChangeIndicationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for FilterChangeIndicationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for FilterChangeIndicationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/filter_life_level.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Filter Life Level characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct FilterLifeLevelCharacteristic(Characteristic<f32>);\n\nimpl FilterLifeLevelCharacteristic {\n    /// Creates a new Filter Life Level characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::FilterLifeLevel,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(100 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for FilterLifeLevelCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for FilterLifeLevelCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for FilterLifeLevelCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for FilterLifeLevelCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/filter_reset_change_indication.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Filter Reset Change Indication characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct FilterResetChangeIndicationCharacteristic(Characteristic<u8>);\n\nimpl FilterResetChangeIndicationCharacteristic {\n    /// Creates a new Filter Reset Change Indication characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::FilterResetChangeIndication,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(1),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for FilterResetChangeIndicationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for FilterResetChangeIndicationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for FilterResetChangeIndicationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for FilterResetChangeIndicationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/firmware_revision.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Firmware Revision characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct FirmwareRevisionCharacteristic(Characteristic<String>);\n\nimpl FirmwareRevisionCharacteristic {\n    /// Creates a new Firmware Revision characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<String> {\n            id,\n            accessory_id,\n            hap_type: HapType::FirmwareRevision,\n            format: Format::String,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for FirmwareRevisionCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for FirmwareRevisionCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<String> for FirmwareRevisionCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<String>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<String>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<String> for FirmwareRevisionCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/firmware_update_readiness.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Firmware Update Readiness characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct FirmwareUpdateReadinessCharacteristic(Characteristic<Vec<u8>>);\n\nimpl FirmwareUpdateReadinessCharacteristic {\n    /// Creates a new Firmware Update Readiness characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::FirmwareUpdateReadiness,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for FirmwareUpdateReadinessCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for FirmwareUpdateReadinessCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for FirmwareUpdateReadinessCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for FirmwareUpdateReadinessCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/firmware_update_status.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Firmware Update Status characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct FirmwareUpdateStatusCharacteristic(Characteristic<Vec<u8>>);\n\nimpl FirmwareUpdateStatusCharacteristic {\n    /// Creates a new Firmware Update Status characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::FirmwareUpdateStatus,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for FirmwareUpdateStatusCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for FirmwareUpdateStatusCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for FirmwareUpdateStatusCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for FirmwareUpdateStatusCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/hardware_finish.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Hardware Finish characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct HardwareFinishCharacteristic(Characteristic<Vec<u8>>);\n\nimpl HardwareFinishCharacteristic {\n    /// Creates a new Hardware Finish characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::HardwareFinish,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for HardwareFinishCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for HardwareFinishCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for HardwareFinishCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for HardwareFinishCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/hardware_revision.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Hardware Revision characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct HardwareRevisionCharacteristic(Characteristic<String>);\n\nimpl HardwareRevisionCharacteristic {\n    /// Creates a new Hardware Revision characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<String> {\n            id,\n            accessory_id,\n            hap_type: HapType::HardwareRevision,\n            format: Format::String,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for HardwareRevisionCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for HardwareRevisionCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<String> for HardwareRevisionCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<String>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<String>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<String> for HardwareRevisionCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/heart_beat.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Heart Beat characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct HeartBeatCharacteristic(Characteristic<u32>);\n\nimpl HeartBeatCharacteristic {\n    /// Creates a new Heart Beat characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u32> {\n            id,\n            accessory_id,\n            hap_type: HapType::HeartBeat,\n            format: Format::UInt32,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for HeartBeatCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for HeartBeatCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u32> for HeartBeatCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u32> for HeartBeatCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/heating_threshold_temperature.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Heating Threshold Temperature characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct HeatingThresholdTemperatureCharacteristic(Characteristic<f32>);\n\nimpl HeatingThresholdTemperatureCharacteristic {\n    /// Creates a new Heating Threshold Temperature characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::HeatingThresholdTemperature,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tunit: Some(Unit::Celsius),\n\t\t\tmax_value: Some(25 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(0.1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for HeatingThresholdTemperatureCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for HeatingThresholdTemperatureCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for HeatingThresholdTemperatureCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for HeatingThresholdTemperatureCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/hold_position.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Hold Position characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct HoldPositionCharacteristic(Characteristic<bool>);\n\nimpl HoldPositionCharacteristic {\n    /// Creates a new Hold Position characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::HoldPosition,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for HoldPositionCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for HoldPositionCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for HoldPositionCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for HoldPositionCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/homekit_camera_active.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// HomeKit Camera Active characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct HomekitCameraActiveCharacteristic(Characteristic<bool>);\n\nimpl HomekitCameraActiveCharacteristic {\n    /// Creates a new HomeKit Camera Active characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::HomekitCameraActive,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n\t\t\t\tPerm::TimedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for HomekitCameraActiveCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for HomekitCameraActiveCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for HomekitCameraActiveCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for HomekitCameraActiveCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/hue.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Hue characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct HueCharacteristic(Characteristic<f32>);\n\nimpl HueCharacteristic {\n    /// Creates a new Hue characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::Hue,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tunit: Some(Unit::ArcDegrees),\n\t\t\tmax_value: Some(360 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for HueCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for HueCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for HueCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for HueCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/identifier.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Identifier characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct IdentifierCharacteristic(Characteristic<u32>);\n\nimpl IdentifierCharacteristic {\n    /// Creates a new Identifier characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u32> {\n            id,\n            accessory_id,\n            hap_type: HapType::Identifier,\n            format: Format::UInt32,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmin_value: Some(0),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for IdentifierCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for IdentifierCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u32> for IdentifierCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u32> for IdentifierCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/identify.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Identify characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct IdentifyCharacteristic(Characteristic<bool>);\n\nimpl IdentifyCharacteristic {\n    /// Creates a new Identify characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::Identify,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for IdentifyCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for IdentifyCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for IdentifyCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for IdentifyCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/image_mirroring.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Image Mirroring characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ImageMirroringCharacteristic(Characteristic<bool>);\n\nimpl ImageMirroringCharacteristic {\n    /// Creates a new Image Mirroring characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::ImageMirroring,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ImageMirroringCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ImageMirroringCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for ImageMirroringCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for ImageMirroringCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/image_rotation.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Image Rotation characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ImageRotationCharacteristic(Characteristic<i32>);\n\nimpl ImageRotationCharacteristic {\n    /// Creates a new Image Rotation characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<i32> {\n            id,\n            accessory_id,\n            hap_type: HapType::ImageRotation,\n            format: Format::Int32,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tunit: Some(Unit::ArcDegrees),\n\t\t\tmax_value: Some(360),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ImageRotationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ImageRotationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<i32> for ImageRotationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<i32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<i32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<i32> for ImageRotationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/in_use.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// In Use characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct InUseCharacteristic(Characteristic<u8>);\n\nimpl InUseCharacteristic {\n    /// Creates a new In Use characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::InUse,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for InUseCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for InUseCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for InUseCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for InUseCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/input_device_type.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Input Device Type characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct InputDeviceTypeCharacteristic(Characteristic<u8>);\n\nimpl InputDeviceTypeCharacteristic {\n    /// Creates a new Input Device Type characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::InputDeviceType,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(6),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for InputDeviceTypeCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for InputDeviceTypeCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for InputDeviceTypeCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for InputDeviceTypeCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/input_source_type.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Input Source Type characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct InputSourceTypeCharacteristic(Characteristic<u8>);\n\nimpl InputSourceTypeCharacteristic {\n    /// Creates a new Input Source Type characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::InputSourceType,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(10),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for InputSourceTypeCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for InputSourceTypeCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for InputSourceTypeCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for InputSourceTypeCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/is_configured.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Is Configured characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct IsConfiguredCharacteristic(Characteristic<u8>);\n\nimpl IsConfiguredCharacteristic {\n    /// Creates a new Is Configured characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::IsConfigured,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for IsConfiguredCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for IsConfiguredCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for IsConfiguredCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for IsConfiguredCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/label_index.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Label Index characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct LabelIndexCharacteristic(Characteristic<u8>);\n\nimpl LabelIndexCharacteristic {\n    /// Creates a new Label Index characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::LabelIndex,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(255),\n\t\t\tmin_value: Some(1),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for LabelIndexCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for LabelIndexCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for LabelIndexCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for LabelIndexCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/label_namespace.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Label Namespace characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct LabelNamespaceCharacteristic(Characteristic<u8>);\n\nimpl LabelNamespaceCharacteristic {\n    /// Creates a new Label Namespace characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::LabelNamespace,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(4),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for LabelNamespaceCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for LabelNamespaceCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for LabelNamespaceCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for LabelNamespaceCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/leak_detected.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Leak Detected characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct LeakDetectedCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tLeakNotDetected = 0,\n\tLeakDetected = 1,\n}\n\nimpl LeakDetectedCharacteristic {\n    /// Creates a new Leak Detected characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::LeakDetected,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // LEAK_NOT_DETECTED\n\t\t\t\t1, // LEAK_DETECTED\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for LeakDetectedCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for LeakDetectedCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for LeakDetectedCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for LeakDetectedCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/list_pairings.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// List Pairings characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ListPairingsCharacteristic(Characteristic<Vec<u8>>);\n\nimpl ListPairingsCharacteristic {\n    /// Creates a new List Pairings characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::ListPairings,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ListPairingsCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ListPairingsCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for ListPairingsCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for ListPairingsCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/lock_control_point.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Lock Control Point characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct LockControlPointCharacteristic(Characteristic<Vec<u8>>);\n\nimpl LockControlPointCharacteristic {\n    /// Creates a new Lock Control Point characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::LockControlPoint,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for LockControlPointCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for LockControlPointCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for LockControlPointCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for LockControlPointCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/lock_current_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Lock Current State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct LockCurrentStateCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tNum0 = 0,\n\tNum1 = 1,\n}\n\nimpl LockCurrentStateCharacteristic {\n    /// Creates a new Lock Current State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::LockCurrentState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(3),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // 0\n\t\t\t\t1, // 1\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for LockCurrentStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for LockCurrentStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for LockCurrentStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for LockCurrentStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/lock_last_known_action.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Lock Last Known Action characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct LockLastKnownActionCharacteristic(Characteristic<u8>);\n\nimpl LockLastKnownActionCharacteristic {\n    /// Creates a new Lock Last Known Action characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::LockLastKnownAction,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(8),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for LockLastKnownActionCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for LockLastKnownActionCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for LockLastKnownActionCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for LockLastKnownActionCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/lock_management_auto_security_timeout.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Lock Management Auto Security Timeout characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct LockManagementAutoSecurityTimeoutCharacteristic(Characteristic<u32>);\n\nimpl LockManagementAutoSecurityTimeoutCharacteristic {\n    /// Creates a new Lock Management Auto Security Timeout characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u32> {\n            id,\n            accessory_id,\n            hap_type: HapType::LockManagementAutoSecurityTimeout,\n            format: Format::UInt32,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tunit: Some(Unit::Seconds),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for LockManagementAutoSecurityTimeoutCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for LockManagementAutoSecurityTimeoutCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u32> for LockManagementAutoSecurityTimeoutCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u32> for LockManagementAutoSecurityTimeoutCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/lock_physical_controls.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Lock Physical Controls characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct LockPhysicalControlsCharacteristic(Characteristic<u8>);\n\nimpl LockPhysicalControlsCharacteristic {\n    /// Creates a new Lock Physical Controls characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::LockPhysicalControls,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for LockPhysicalControlsCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for LockPhysicalControlsCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for LockPhysicalControlsCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for LockPhysicalControlsCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/lock_target_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Lock Target State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct LockTargetStateCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tNum0 = 0,\n\tNum1 = 1,\n}\n\nimpl LockTargetStateCharacteristic {\n    /// Creates a new Lock Target State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::LockTargetState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // 0\n\t\t\t\t1, // 1\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for LockTargetStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for LockTargetStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for LockTargetStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for LockTargetStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/logs.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Logs characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct LogsCharacteristic(Characteristic<Vec<u8>>);\n\nimpl LogsCharacteristic {\n    /// Creates a new Logs characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::Logs,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for LogsCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for LogsCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for LogsCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for LogsCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/mac_retransmission_maximum.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// MAC Retransmission Maximum characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct MacRetransmissionMaximumCharacteristic(Characteristic<u8>);\n\nimpl MacRetransmissionMaximumCharacteristic {\n    /// Creates a new MAC Retransmission Maximum characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::MacRetransmissionMaximum,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for MacRetransmissionMaximumCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for MacRetransmissionMaximumCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for MacRetransmissionMaximumCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for MacRetransmissionMaximumCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/mac_transmission_counters.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// MAC Transmission Counters characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct MacTransmissionCountersCharacteristic(Characteristic<Vec<u8>>);\n\nimpl MacTransmissionCountersCharacteristic {\n    /// Creates a new MAC Transmission Counters characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::MacTransmissionCounters,\n            format: Format::Data,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for MacTransmissionCountersCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for MacTransmissionCountersCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for MacTransmissionCountersCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for MacTransmissionCountersCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/managed_network_enable.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Managed Network Enable characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ManagedNetworkEnableCharacteristic(Characteristic<u8>);\n\nimpl ManagedNetworkEnableCharacteristic {\n    /// Creates a new Managed Network Enable characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::ManagedNetworkEnable,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n\t\t\t\tPerm::TimedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ManagedNetworkEnableCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ManagedNetworkEnableCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for ManagedNetworkEnableCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for ManagedNetworkEnableCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/manually_disabled.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Manually disabled characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ManuallyDisabledCharacteristic(Characteristic<bool>);\n\nimpl ManuallyDisabledCharacteristic {\n    /// Creates a new Manually disabled characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::ManuallyDisabled,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ManuallyDisabledCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ManuallyDisabledCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for ManuallyDisabledCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for ManuallyDisabledCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/manufacturer.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Manufacturer characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ManufacturerCharacteristic(Characteristic<String>);\n\nimpl ManufacturerCharacteristic {\n    /// Creates a new Manufacturer characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<String> {\n            id,\n            accessory_id,\n            hap_type: HapType::Manufacturer,\n            format: Format::String,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_len: Some(64),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ManufacturerCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ManufacturerCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<String> for ManufacturerCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<String>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<String>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<String> for ManufacturerCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/maximum_transmit_power.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Maximum Transmit Power characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct MaximumTransmitPowerCharacteristic(Characteristic<i32>);\n\nimpl MaximumTransmitPowerCharacteristic {\n    /// Creates a new Maximum Transmit Power characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<i32> {\n            id,\n            accessory_id,\n            hap_type: HapType::MaximumTransmitPower,\n            format: Format::Int32,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for MaximumTransmitPowerCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for MaximumTransmitPowerCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<i32> for MaximumTransmitPowerCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<i32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<i32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<i32> for MaximumTransmitPowerCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/mod.rs",
    "content": "// this file is auto-generated by hap-codegen\n\n/// Access Code Control Point characteristic definition.\npub mod access_code_control_point;\n/// Access Code Supported Configuration characteristic definition.\npub mod access_code_supported_configuration;\n/// Access Control Level characteristic definition.\npub mod access_control_level;\n/// Accessory Flags characteristic definition.\npub mod accessory_flags;\n/// Accessory Identifier characteristic definition.\npub mod accessory_identifier;\n/// Active characteristic definition.\npub mod active;\n/// Active Identifier characteristic definition.\npub mod active_identifier;\n/// Activity Interval characteristic definition.\npub mod activity_interval;\n/// Administrator Only Access characteristic definition.\npub mod administrator_only_access;\n/// Air Particulate Density characteristic definition.\npub mod air_particulate_density;\n/// Air Particulate Size characteristic definition.\npub mod air_particulate_size;\n/// AirPlay Enable characteristic definition.\npub mod airplay_enable;\n/// Application Matching Identifier characteristic definition.\npub mod application_matching_identifier;\n/// Asset Update Readiness characteristic definition.\npub mod asset_update_readiness;\n/// Audio Feedback characteristic definition.\npub mod audio_feedback;\n/// Battery Level characteristic definition.\npub mod battery_level;\n/// Brightness characteristic definition.\npub mod brightness;\n/// Button Event characteristic definition.\npub mod button_event;\n/// Camera Operating Mode Indicator characteristic definition.\npub mod camera_operating_mode_indicator;\n/// Carbon dioxide Detected characteristic definition.\npub mod carbon_dioxide_detected;\n/// Carbon dioxide Level characteristic definition.\npub mod carbon_dioxide_level;\n/// Carbon dioxide Peak Level characteristic definition.\npub mod carbon_dioxide_peak_level;\n/// Carbon monoxide Detected characteristic definition.\npub mod carbon_monoxide_detected;\n/// Carbon monoxide Level characteristic definition.\npub mod carbon_monoxide_level;\n/// Carbon monoxide Peak Level characteristic definition.\npub mod carbon_monoxide_peak_level;\n/// CCA Energy Detect Threshold characteristic definition.\npub mod cca_energy_detect_threshold;\n/// CCA Signal Detect Threshold characteristic definition.\npub mod cca_signal_detect_threshold;\n/// Characteristic Value Active Transition Count characteristic definition.\npub mod characteristic_value_active_transition_count;\n/// Characteristic Value Transition Control characteristic definition.\npub mod characteristic_value_transition_control;\n/// Charging State characteristic definition.\npub mod charging_state;\n/// Closed Captions characteristic definition.\npub mod closed_captions;\n/// Cloud Relay Control Point characteristic definition.\npub mod cloud_relay_control_point;\n/// Cloud Relay Current State characteristic definition.\npub mod cloud_relay_current_state;\n/// Cloud Relay Enable Status characteristic definition.\npub mod cloud_relay_enable_status;\n/// Color Temperature characteristic definition.\npub mod color_temperature;\n/// Configuration State characteristic definition.\npub mod configuration_state;\n/// Configured Name characteristic definition.\npub mod configured_name;\n/// Contact Sensor State characteristic definition.\npub mod contact_sensor_state;\n/// Cooling Threshold Temperature characteristic definition.\npub mod cooling_threshold_temperature;\n/// Current Air Purifier State characteristic definition.\npub mod current_air_purifier_state;\n/// Current Air Quality characteristic definition.\npub mod current_air_quality;\n/// Current Door State characteristic definition.\npub mod current_door_state;\n/// Current Fan State characteristic definition.\npub mod current_fan_state;\n/// Current Heater-Cooler State characteristic definition.\npub mod current_heater_cooler_state;\n/// Current Heating Cooling State characteristic definition.\npub mod current_heating_cooling_state;\n/// Current Horizontal Tilt Angle characteristic definition.\npub mod current_horizontal_tilt_angle;\n/// Current Humidifier-Dehumidifier State characteristic definition.\npub mod current_humidifier_dehumidifier_state;\n/// Current Light Level characteristic definition.\npub mod current_light_level;\n/// Current Media State characteristic definition.\npub mod current_media_state;\n/// Current Position characteristic definition.\npub mod current_position;\n/// Current Relative Humidity characteristic definition.\npub mod current_relative_humidity;\n/// Current Slat State characteristic definition.\npub mod current_slat_state;\n/// Current Temperature characteristic definition.\npub mod current_temperature;\n/// Current Tilt Angle characteristic definition.\npub mod current_tilt_angle;\n/// Current Transport characteristic definition.\npub mod current_transport;\n/// Current Vertical Tilt Angle characteristic definition.\npub mod current_vertical_tilt_angle;\n/// Current Visibility State characteristic definition.\npub mod current_visibility_state;\n/// Current Water Level characteristic definition.\npub mod current_water_level;\n/// Data Stream HAP Transport characteristic definition.\npub mod data_stream_hap_transport;\n/// Data Stream HAP Transport Interrupt characteristic definition.\npub mod data_stream_hap_transport_interrupt;\n/// Digital Zoom characteristic definition.\npub mod digital_zoom;\n/// Display Order characteristic definition.\npub mod display_order;\n/// Event Retransmission Maximum characteristic definition.\npub mod event_retransmission_maximum;\n/// Event Snapshots Active characteristic definition.\npub mod event_snapshots_active;\n/// Event Transmission Counters characteristic definition.\npub mod event_transmission_counters;\n/// Filter Change indication characteristic definition.\npub mod filter_change_indication;\n/// Filter Life Level characteristic definition.\npub mod filter_life_level;\n/// Filter Reset Change Indication characteristic definition.\npub mod filter_reset_change_indication;\n/// Firmware Revision characteristic definition.\npub mod firmware_revision;\n/// Firmware Update Readiness characteristic definition.\npub mod firmware_update_readiness;\n/// Firmware Update Status characteristic definition.\npub mod firmware_update_status;\n/// Hardware Finish characteristic definition.\npub mod hardware_finish;\n/// Hardware Revision characteristic definition.\npub mod hardware_revision;\n/// Heart Beat characteristic definition.\npub mod heart_beat;\n/// Heating Threshold Temperature characteristic definition.\npub mod heating_threshold_temperature;\n/// Hold Position characteristic definition.\npub mod hold_position;\n/// HomeKit Camera Active characteristic definition.\npub mod homekit_camera_active;\n/// Hue characteristic definition.\npub mod hue;\n/// Identifier characteristic definition.\npub mod identifier;\n/// Identify characteristic definition.\npub mod identify;\n/// Image Mirroring characteristic definition.\npub mod image_mirroring;\n/// Image Rotation characteristic definition.\npub mod image_rotation;\n/// In Use characteristic definition.\npub mod in_use;\n/// Input Device Type characteristic definition.\npub mod input_device_type;\n/// Input Source Type characteristic definition.\npub mod input_source_type;\n/// Is Configured characteristic definition.\npub mod is_configured;\n/// Label Index characteristic definition.\npub mod label_index;\n/// Label Namespace characteristic definition.\npub mod label_namespace;\n/// Leak Detected characteristic definition.\npub mod leak_detected;\n/// List Pairings characteristic definition.\npub mod list_pairings;\n/// Lock Control Point characteristic definition.\npub mod lock_control_point;\n/// Lock Current State characteristic definition.\npub mod lock_current_state;\n/// Lock Last Known Action characteristic definition.\npub mod lock_last_known_action;\n/// Lock Management Auto Security Timeout characteristic definition.\npub mod lock_management_auto_security_timeout;\n/// Lock Physical Controls characteristic definition.\npub mod lock_physical_controls;\n/// Lock Target State characteristic definition.\npub mod lock_target_state;\n/// Logs characteristic definition.\npub mod logs;\n/// MAC Retransmission Maximum characteristic definition.\npub mod mac_retransmission_maximum;\n/// MAC Transmission Counters characteristic definition.\npub mod mac_transmission_counters;\n/// Managed Network Enable characteristic definition.\npub mod managed_network_enable;\n/// Manually disabled characteristic definition.\npub mod manually_disabled;\n/// Manufacturer characteristic definition.\npub mod manufacturer;\n/// Maximum Transmit Power characteristic definition.\npub mod maximum_transmit_power;\n/// Model characteristic definition.\npub mod model;\n/// Motion Detected characteristic definition.\npub mod motion_detected;\n/// Multifunction Button characteristic definition.\npub mod multifunction_button;\n/// Mute characteristic definition.\npub mod mute;\n/// Name characteristic definition.\npub mod name;\n/// Network Access Violation Control characteristic definition.\npub mod network_access_violation_control;\n/// Network Client Control characteristic definition.\npub mod network_client_control;\n/// Network Client Status Control characteristic definition.\npub mod network_client_status_control;\n/// NFC Access Control Point characteristic definition.\npub mod nfc_access_control_point;\n/// NFC Access Supported Configuration characteristic definition.\npub mod nfc_access_supported_configuration;\n/// Night Vision characteristic definition.\npub mod night_vision;\n/// Nitrogen dioxide Density characteristic definition.\npub mod nitrogen_dioxide_density;\n/// Obstruction Detected characteristic definition.\npub mod obstruction_detected;\n/// Occupancy Detected characteristic definition.\npub mod occupancy_detected;\n/// Operating State Response characteristic definition.\npub mod operating_state_response;\n/// Optical Zoom characteristic definition.\npub mod optical_zoom;\n/// Outlet In Use characteristic definition.\npub mod outlet_in_use;\n/// Ozone Density characteristic definition.\npub mod ozone_density;\n/// Pair Setup characteristic definition.\npub mod pair_setup;\n/// Pair Verify characteristic definition.\npub mod pair_verify;\n/// Pairing Features characteristic definition.\npub mod pairing_features;\n/// Password Setting characteristic definition.\npub mod password_setting;\n/// Periodic Snapshots Active characteristic definition.\npub mod periodic_snapshots_active;\n/// Picture Mode characteristic definition.\npub mod picture_mode;\n/// Ping characteristic definition.\npub mod ping;\n/// PM10 Density characteristic definition.\npub mod pm10_density;\n/// PM2.5 Density characteristic definition.\npub mod pm2_5_density;\n/// Position State characteristic definition.\npub mod position_state;\n/// Power Mode Selection characteristic definition.\npub mod power_mode_selection;\n/// Power State characteristic definition.\npub mod power_state;\n/// Product Data characteristic definition.\npub mod product_data;\n/// Program Mode characteristic definition.\npub mod program_mode;\n/// Programmable Switch Event characteristic definition.\npub mod programmable_switch_event;\n/// Programmable Switch Output State characteristic definition.\npub mod programmable_switch_output_state;\n/// Received Signal Strength Indication characteristic definition.\npub mod received_signal_strength_indication;\n/// Receiver Sensitivity characteristic definition.\npub mod receiver_sensitivity;\n/// recording audio active characteristic definition.\npub mod recording_audio_active;\n/// Relative Humidity Dehumidifier Threshold characteristic definition.\npub mod relative_humidity_dehumidifier_threshold;\n/// Relative Humidity Humidifier Threshold characteristic definition.\npub mod relative_humidity_humidifier_threshold;\n/// Remaining Duration characteristic definition.\npub mod remaining_duration;\n/// Remote Key characteristic definition.\npub mod remote_key;\n/// Rotation Direction characteristic definition.\npub mod rotation_direction;\n/// Rotation Speed characteristic definition.\npub mod rotation_speed;\n/// Router Status characteristic definition.\npub mod router_status;\n/// Saturation characteristic definition.\npub mod saturation;\n/// Security System Alarm Type characteristic definition.\npub mod security_system_alarm_type;\n/// Security System Current State characteristic definition.\npub mod security_system_current_state;\n/// Security System Target State characteristic definition.\npub mod security_system_target_state;\n/// Selected Audio Stream Configuration characteristic definition.\npub mod selected_audio_stream_configuration;\n/// Selected Camera Recording Configuration characteristic definition.\npub mod selected_camera_recording_configuration;\n/// Selected Diagnostics Modes characteristic definition.\npub mod selected_diagnostics_modes;\n/// Selected Stream Configuration characteristic definition.\npub mod selected_stream_configuration;\n/// Serial Number characteristic definition.\npub mod serial_number;\n/// Service Signature characteristic definition.\npub mod service_signature;\n/// Set Duration characteristic definition.\npub mod set_duration;\n/// Setup Data Stream Transport characteristic definition.\npub mod setup_data_stream_transport;\n/// Setup Endpoint characteristic definition.\npub mod setup_endpoint;\n/// Setup Transfer Transport characteristic definition.\npub mod setup_transfer_transport;\n/// Signal-to-noise Ratio characteristic definition.\npub mod signal_to_noise_ratio;\n/// Siri Enable characteristic definition.\npub mod siri_enable;\n/// Siri Endpoint Session Status characteristic definition.\npub mod siri_endpoint_session_status;\n/// Siri Engine Version characteristic definition.\npub mod siri_engine_version;\n/// Siri Input Type characteristic definition.\npub mod siri_input_type;\n/// Siri Light On Use characteristic definition.\npub mod siri_light_on_use;\n/// Siri Listening characteristic definition.\npub mod siri_listening;\n/// Siri Touch To Use characteristic definition.\npub mod siri_touch_to_use;\n/// Slat Type characteristic definition.\npub mod slat_type;\n/// Sleep Discovery Mode characteristic definition.\npub mod sleep_discovery_mode;\n/// Sleep Interval characteristic definition.\npub mod sleep_interval;\n/// Smoke Detected characteristic definition.\npub mod smoke_detected;\n/// Software Revision characteristic definition.\npub mod software_revision;\n/// Staged Firmware Version characteristic definition.\npub mod staged_firmware_version;\n/// Status Active characteristic definition.\npub mod status_active;\n/// Status Fault characteristic definition.\npub mod status_fault;\n/// Status Jammed characteristic definition.\npub mod status_jammed;\n/// Status Low Battery characteristic definition.\npub mod status_low_battery;\n/// Status Tampered characteristic definition.\npub mod status_tampered;\n/// Streaming Status characteristic definition.\npub mod streaming_status;\n/// Sulphur dioxide Density characteristic definition.\npub mod sulphur_dioxide_density;\n/// Supported Asset Types characteristic definition.\npub mod supported_asset_types;\n/// Supported Audio Recording Configuration characteristic definition.\npub mod supported_audio_recording_configuration;\n/// Supported Audio Stream Configuration characteristic definition.\npub mod supported_audio_stream_configuration;\n/// Supported Camera Recording Configuration characteristic definition.\npub mod supported_camera_recording_configuration;\n/// Supported Characteristic Value Transition Configuration characteristic definition.\npub mod supported_characteristic_value_transition_configuration;\n/// Supported Data Stream Transport Configuration characteristic definition.\npub mod supported_data_stream_transport_configuration;\n/// Supported Diagnostics Modes characteristic definition.\npub mod supported_diagnostics_modes;\n/// Supported Diagnostics Snapshot characteristic definition.\npub mod supported_diagnostics_snapshot;\n/// Supported Firmware Update Configuration characteristic definition.\npub mod supported_firmware_update_configuration;\n/// Supported Router Configuration characteristic definition.\npub mod supported_router_configuration;\n/// Supported RTP Configuration characteristic definition.\npub mod supported_rtp_configuration;\n/// Supported Target Configuration characteristic definition.\npub mod supported_target_configuration;\n/// Supported Transfer Transport Configuration characteristic definition.\npub mod supported_transfer_transport_configuration;\n/// Supported Video Recording Configuration characteristic definition.\npub mod supported_video_recording_configuration;\n/// Supported Video Stream Configuration characteristic definition.\npub mod supported_video_stream_configuration;\n/// Swing Mode characteristic definition.\npub mod swing_mode;\n/// Target Air Purifier State characteristic definition.\npub mod target_air_purifier_state;\n/// Target Door State characteristic definition.\npub mod target_door_state;\n/// Target Fan State characteristic definition.\npub mod target_fan_state;\n/// Target Heater-Cooler State characteristic definition.\npub mod target_heater_cooler_state;\n/// Target Heating Cooling State characteristic definition.\npub mod target_heating_cooling_state;\n/// Target Horizontal Tilt Angle characteristic definition.\npub mod target_horizontal_tilt_angle;\n/// Target Humidifier-Dehumidifier State characteristic definition.\npub mod target_humidifier_dehumidifier_state;\n/// Target List Configuration characteristic definition.\npub mod target_list_configuration;\n/// Target Media State characteristic definition.\npub mod target_media_state;\n/// Target Position characteristic definition.\npub mod target_position;\n/// Target Relative Humidity characteristic definition.\npub mod target_relative_humidity;\n/// Target Temperature characteristic definition.\npub mod target_temperature;\n/// Target Tilt Angle characteristic definition.\npub mod target_tilt_angle;\n/// Target Vertical Tilt Angle characteristic definition.\npub mod target_vertical_tilt_angle;\n/// Target Visibility State characteristic definition.\npub mod target_visibility_state;\n/// Temperature Display Units characteristic definition.\npub mod temperature_display_units;\n/// Third Party Camera Active characteristic definition.\npub mod third_party_camera_active;\n/// Thread Control Point characteristic definition.\npub mod thread_control_point;\n/// Thread Node Capabilities characteristic definition.\npub mod thread_node_capabilities;\n/// Thread OpenThread Version characteristic definition.\npub mod thread_openthread_version;\n/// Thread Status characteristic definition.\npub mod thread_status;\n/// Transmit Power characteristic definition.\npub mod transmit_power;\n/// Valve Type characteristic definition.\npub mod valve_type;\n/// Version characteristic definition.\npub mod version;\n/// Video Analysis Active characteristic definition.\npub mod video_analysis_active;\n/// Volatile Organic Compound Density characteristic definition.\npub mod volatile_organic_compound_density;\n/// Volume characteristic definition.\npub mod volume;\n/// Volume Control Type characteristic definition.\npub mod volume_control_type;\n/// Volume Selector characteristic definition.\npub mod volume_selector;\n/// Wake Configuration characteristic definition.\npub mod wake_configuration;\n/// WAN Configuration List characteristic definition.\npub mod wan_configuration_list;\n/// WAN Status List characteristic definition.\npub mod wan_status_list;\n/// Wi-Fi Capabilities characteristic definition.\npub mod wi_fi_capabilities;\n/// Wi-Fi Configuration Control characteristic definition.\npub mod wi_fi_configuration_control;\n/// Wi-Fi Satellite Status characteristic definition.\npub mod wi_fi_satellite_status;\n"
  },
  {
    "path": "src/characteristic/generated/model.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Model characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ModelCharacteristic(Characteristic<String>);\n\nimpl ModelCharacteristic {\n    /// Creates a new Model characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<String> {\n            id,\n            accessory_id,\n            hap_type: HapType::Model,\n            format: Format::String,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_len: Some(64),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ModelCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ModelCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<String> for ModelCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<String>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<String>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<String> for ModelCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/motion_detected.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Motion Detected characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct MotionDetectedCharacteristic(Characteristic<bool>);\n\nimpl MotionDetectedCharacteristic {\n    /// Creates a new Motion Detected characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::MotionDetected,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for MotionDetectedCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for MotionDetectedCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for MotionDetectedCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for MotionDetectedCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/multifunction_button.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Multifunction Button characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct MultifunctionButtonCharacteristic(Characteristic<u8>);\n\nimpl MultifunctionButtonCharacteristic {\n    /// Creates a new Multifunction Button characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::MultifunctionButton,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for MultifunctionButtonCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for MultifunctionButtonCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for MultifunctionButtonCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for MultifunctionButtonCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/mute.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Mute characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct MuteCharacteristic(Characteristic<bool>);\n\nimpl MuteCharacteristic {\n    /// Creates a new Mute characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::Mute,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for MuteCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for MuteCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for MuteCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for MuteCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/name.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Name characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct NameCharacteristic(Characteristic<String>);\n\nimpl NameCharacteristic {\n    /// Creates a new Name characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<String> {\n            id,\n            accessory_id,\n            hap_type: HapType::Name,\n            format: Format::String,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_len: Some(64),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for NameCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for NameCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<String> for NameCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<String>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<String>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<String> for NameCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/network_access_violation_control.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Network Access Violation Control characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct NetworkAccessViolationControlCharacteristic(Characteristic<Vec<u8>>);\n\nimpl NetworkAccessViolationControlCharacteristic {\n    /// Creates a new Network Access Violation Control characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::NetworkAccessViolationControl,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n\t\t\t\tPerm::TimedWrite,\n\t\t\t\tPerm::WriteResponse,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for NetworkAccessViolationControlCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for NetworkAccessViolationControlCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for NetworkAccessViolationControlCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for NetworkAccessViolationControlCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/network_client_control.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Network Client Control characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct NetworkClientControlCharacteristic(Characteristic<Vec<u8>>);\n\nimpl NetworkClientControlCharacteristic {\n    /// Creates a new Network Client Control characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::NetworkClientControl,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n\t\t\t\tPerm::TimedWrite,\n\t\t\t\tPerm::WriteResponse,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for NetworkClientControlCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for NetworkClientControlCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for NetworkClientControlCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for NetworkClientControlCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/network_client_status_control.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Network Client Status Control characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct NetworkClientStatusControlCharacteristic(Characteristic<Vec<u8>>);\n\nimpl NetworkClientStatusControlCharacteristic {\n    /// Creates a new Network Client Status Control characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::NetworkClientStatusControl,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n\t\t\t\tPerm::WriteResponse,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for NetworkClientStatusControlCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for NetworkClientStatusControlCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for NetworkClientStatusControlCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for NetworkClientStatusControlCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/nfc_access_control_point.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// NFC Access Control Point characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct NfcAccessControlPointCharacteristic(Characteristic<Vec<u8>>);\n\nimpl NfcAccessControlPointCharacteristic {\n    /// Creates a new NFC Access Control Point characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::NfcAccessControlPoint,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for NfcAccessControlPointCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for NfcAccessControlPointCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for NfcAccessControlPointCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for NfcAccessControlPointCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/nfc_access_supported_configuration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// NFC Access Supported Configuration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct NfcAccessSupportedConfigurationCharacteristic(Characteristic<Vec<u8>>);\n\nimpl NfcAccessSupportedConfigurationCharacteristic {\n    /// Creates a new NFC Access Supported Configuration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::NfcAccessSupportedConfiguration,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for NfcAccessSupportedConfigurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for NfcAccessSupportedConfigurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for NfcAccessSupportedConfigurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for NfcAccessSupportedConfigurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/night_vision.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Night Vision characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct NightVisionCharacteristic(Characteristic<bool>);\n\nimpl NightVisionCharacteristic {\n    /// Creates a new Night Vision characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::NightVision,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n\t\t\t\tPerm::TimedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for NightVisionCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for NightVisionCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for NightVisionCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for NightVisionCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/nitrogen_dioxide_density.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Nitrogen dioxide Density characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct NitrogenDioxideDensityCharacteristic(Characteristic<f32>);\n\nimpl NitrogenDioxideDensityCharacteristic {\n    /// Creates a new Nitrogen dioxide Density characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::NitrogenDioxideDensity,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::MicrogramsPerCubicMeter),\n\t\t\tmax_value: Some(1000 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for NitrogenDioxideDensityCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for NitrogenDioxideDensityCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for NitrogenDioxideDensityCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for NitrogenDioxideDensityCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/obstruction_detected.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Obstruction Detected characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ObstructionDetectedCharacteristic(Characteristic<bool>);\n\nimpl ObstructionDetectedCharacteristic {\n    /// Creates a new Obstruction Detected characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::ObstructionDetected,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ObstructionDetectedCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ObstructionDetectedCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for ObstructionDetectedCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for ObstructionDetectedCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/occupancy_detected.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Occupancy Detected characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct OccupancyDetectedCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tOccupancyNotDetected = 0,\n\tOccupancyDetected = 1,\n}\n\nimpl OccupancyDetectedCharacteristic {\n    /// Creates a new Occupancy Detected characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::OccupancyDetected,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // OCCUPANCY_NOT_DETECTED\n\t\t\t\t1, // OCCUPANCY_DETECTED\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for OccupancyDetectedCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for OccupancyDetectedCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for OccupancyDetectedCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for OccupancyDetectedCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/operating_state_response.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Operating State Response characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct OperatingStateResponseCharacteristic(Characteristic<Vec<u8>>);\n\nimpl OperatingStateResponseCharacteristic {\n    /// Creates a new Operating State Response characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::OperatingStateResponse,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for OperatingStateResponseCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for OperatingStateResponseCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for OperatingStateResponseCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for OperatingStateResponseCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/optical_zoom.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Optical Zoom characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct OpticalZoomCharacteristic(Characteristic<f32>);\n\nimpl OpticalZoomCharacteristic {\n    /// Creates a new Optical Zoom characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::OpticalZoom,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tstep_value: Some(0.1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for OpticalZoomCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for OpticalZoomCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for OpticalZoomCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for OpticalZoomCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/outlet_in_use.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Outlet In Use characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct OutletInUseCharacteristic(Characteristic<bool>);\n\nimpl OutletInUseCharacteristic {\n    /// Creates a new Outlet In Use characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::OutletInUse,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for OutletInUseCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for OutletInUseCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for OutletInUseCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for OutletInUseCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/ozone_density.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Ozone Density characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct OzoneDensityCharacteristic(Characteristic<f32>);\n\nimpl OzoneDensityCharacteristic {\n    /// Creates a new Ozone Density characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::OzoneDensity,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::MicrogramsPerCubicMeter),\n\t\t\tmax_value: Some(1000 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for OzoneDensityCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for OzoneDensityCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for OzoneDensityCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for OzoneDensityCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/pair_setup.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Pair Setup characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct PairSetupCharacteristic(Characteristic<Vec<u8>>);\n\nimpl PairSetupCharacteristic {\n    /// Creates a new Pair Setup characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::PairSetup,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for PairSetupCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for PairSetupCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for PairSetupCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for PairSetupCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/pair_verify.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Pair Verify characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct PairVerifyCharacteristic(Characteristic<Vec<u8>>);\n\nimpl PairVerifyCharacteristic {\n    /// Creates a new Pair Verify characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::PairVerify,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for PairVerifyCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for PairVerifyCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for PairVerifyCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for PairVerifyCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/pairing_features.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Pairing Features characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct PairingFeaturesCharacteristic(Characteristic<u8>);\n\nimpl PairingFeaturesCharacteristic {\n    /// Creates a new Pairing Features characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::PairingFeatures,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for PairingFeaturesCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for PairingFeaturesCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for PairingFeaturesCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for PairingFeaturesCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/password_setting.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Password Setting characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct PasswordSettingCharacteristic(Characteristic<Vec<u8>>);\n\nimpl PasswordSettingCharacteristic {\n    /// Creates a new Password Setting characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::PasswordSetting,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for PasswordSettingCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for PasswordSettingCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for PasswordSettingCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for PasswordSettingCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/periodic_snapshots_active.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Periodic Snapshots Active characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct PeriodicSnapshotsActiveCharacteristic(Characteristic<bool>);\n\nimpl PeriodicSnapshotsActiveCharacteristic {\n    /// Creates a new Periodic Snapshots Active characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::PeriodicSnapshotsActive,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n\t\t\t\tPerm::TimedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for PeriodicSnapshotsActiveCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for PeriodicSnapshotsActiveCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for PeriodicSnapshotsActiveCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for PeriodicSnapshotsActiveCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/picture_mode.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Picture Mode characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct PictureModeCharacteristic(Characteristic<u8>);\n\nimpl PictureModeCharacteristic {\n    /// Creates a new Picture Mode characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::PictureMode,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(13),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for PictureModeCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for PictureModeCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for PictureModeCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for PictureModeCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/ping.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Ping characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct PingCharacteristic(Characteristic<Vec<u8>>);\n\nimpl PingCharacteristic {\n    /// Creates a new Ping characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::Ping,\n            format: Format::Data,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for PingCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for PingCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for PingCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for PingCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/pm10_density.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// PM10 Density characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct Pm10DensityCharacteristic(Characteristic<f32>);\n\nimpl Pm10DensityCharacteristic {\n    /// Creates a new PM10 Density characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::Pm10Density,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::MicrogramsPerCubicMeter),\n\t\t\tmax_value: Some(1000 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for Pm10DensityCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for Pm10DensityCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for Pm10DensityCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for Pm10DensityCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/pm2_5_density.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// PM2.5 Density characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct Pm2_5DensityCharacteristic(Characteristic<f32>);\n\nimpl Pm2_5DensityCharacteristic {\n    /// Creates a new PM2.5 Density characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::Pm2_5Density,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::MicrogramsPerCubicMeter),\n\t\t\tmax_value: Some(1000 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for Pm2_5DensityCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for Pm2_5DensityCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for Pm2_5DensityCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for Pm2_5DensityCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/position_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Position State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct PositionStateCharacteristic(Characteristic<u8>);\n\nimpl PositionStateCharacteristic {\n    /// Creates a new Position State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::PositionState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(2),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for PositionStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for PositionStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for PositionStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for PositionStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/power_mode_selection.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Power Mode Selection characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct PowerModeSelectionCharacteristic(Characteristic<u8>);\n\nimpl PowerModeSelectionCharacteristic {\n    /// Creates a new Power Mode Selection characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::PowerModeSelection,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for PowerModeSelectionCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for PowerModeSelectionCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for PowerModeSelectionCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for PowerModeSelectionCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/power_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Power State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct PowerStateCharacteristic(Characteristic<bool>);\n\nimpl PowerStateCharacteristic {\n    /// Creates a new Power State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::PowerState,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for PowerStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for PowerStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for PowerStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for PowerStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/product_data.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Product Data characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ProductDataCharacteristic(Characteristic<Vec<u8>>);\n\nimpl ProductDataCharacteristic {\n    /// Creates a new Product Data characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::ProductData,\n            format: Format::Data,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ProductDataCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ProductDataCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for ProductDataCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for ProductDataCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/program_mode.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Program Mode characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ProgramModeCharacteristic(Characteristic<u8>);\n\nimpl ProgramModeCharacteristic {\n    /// Creates a new Program Mode characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::ProgramMode,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(2),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ProgramModeCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ProgramModeCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for ProgramModeCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for ProgramModeCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/programmable_switch_event.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Programmable Switch Event characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ProgrammableSwitchEventCharacteristic(Characteristic<u8>);\n\nimpl ProgrammableSwitchEventCharacteristic {\n    /// Creates a new Programmable Switch Event characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::ProgrammableSwitchEvent,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(2),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ProgrammableSwitchEventCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ProgrammableSwitchEventCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for ProgrammableSwitchEventCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for ProgrammableSwitchEventCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/programmable_switch_output_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Programmable Switch Output State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ProgrammableSwitchOutputStateCharacteristic(Characteristic<u8>);\n\nimpl ProgrammableSwitchOutputStateCharacteristic {\n    /// Creates a new Programmable Switch Output State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::ProgrammableSwitchOutputState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ProgrammableSwitchOutputStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ProgrammableSwitchOutputStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for ProgrammableSwitchOutputStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for ProgrammableSwitchOutputStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/received_signal_strength_indication.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Received Signal Strength Indication characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ReceivedSignalStrengthIndicationCharacteristic(Characteristic<i32>);\n\nimpl ReceivedSignalStrengthIndicationCharacteristic {\n    /// Creates a new Received Signal Strength Indication characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<i32> {\n            id,\n            accessory_id,\n            hap_type: HapType::ReceivedSignalStrengthIndication,\n            format: Format::Int32,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ReceivedSignalStrengthIndicationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ReceivedSignalStrengthIndicationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<i32> for ReceivedSignalStrengthIndicationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<i32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<i32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<i32> for ReceivedSignalStrengthIndicationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/receiver_sensitivity.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Receiver Sensitivity characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ReceiverSensitivityCharacteristic(Characteristic<i32>);\n\nimpl ReceiverSensitivityCharacteristic {\n    /// Creates a new Receiver Sensitivity characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<i32> {\n            id,\n            accessory_id,\n            hap_type: HapType::ReceiverSensitivity,\n            format: Format::Int32,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ReceiverSensitivityCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ReceiverSensitivityCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<i32> for ReceiverSensitivityCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<i32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<i32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<i32> for ReceiverSensitivityCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/recording_audio_active.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// recording audio active characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct RecordingAudioActiveCharacteristic(Characteristic<u8>);\n\nimpl RecordingAudioActiveCharacteristic {\n    /// Creates a new recording audio active characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::RecordingAudioActive,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n\t\t\t\tPerm::TimedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for RecordingAudioActiveCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for RecordingAudioActiveCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for RecordingAudioActiveCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for RecordingAudioActiveCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/relative_humidity_dehumidifier_threshold.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Relative Humidity Dehumidifier Threshold characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct RelativeHumidityDehumidifierThresholdCharacteristic(Characteristic<f32>);\n\nimpl RelativeHumidityDehumidifierThresholdCharacteristic {\n    /// Creates a new Relative Humidity Dehumidifier Threshold characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::RelativeHumidityDehumidifierThreshold,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tunit: Some(Unit::Percentage),\n\t\t\tmax_value: Some(100 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for RelativeHumidityDehumidifierThresholdCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for RelativeHumidityDehumidifierThresholdCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for RelativeHumidityDehumidifierThresholdCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for RelativeHumidityDehumidifierThresholdCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/relative_humidity_humidifier_threshold.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Relative Humidity Humidifier Threshold characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct RelativeHumidityHumidifierThresholdCharacteristic(Characteristic<f32>);\n\nimpl RelativeHumidityHumidifierThresholdCharacteristic {\n    /// Creates a new Relative Humidity Humidifier Threshold characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::RelativeHumidityHumidifierThreshold,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tunit: Some(Unit::Percentage),\n\t\t\tmax_value: Some(100 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for RelativeHumidityHumidifierThresholdCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for RelativeHumidityHumidifierThresholdCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for RelativeHumidityHumidifierThresholdCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for RelativeHumidityHumidifierThresholdCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/remaining_duration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Remaining Duration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct RemainingDurationCharacteristic(Characteristic<u32>);\n\nimpl RemainingDurationCharacteristic {\n    /// Creates a new Remaining Duration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u32> {\n            id,\n            accessory_id,\n            hap_type: HapType::RemainingDuration,\n            format: Format::UInt32,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::Seconds),\n\t\t\tmax_value: Some(3600),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for RemainingDurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for RemainingDurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u32> for RemainingDurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u32> for RemainingDurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/remote_key.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Remote Key characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct RemoteKeyCharacteristic(Characteristic<u8>);\n\nimpl RemoteKeyCharacteristic {\n    /// Creates a new Remote Key characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::RemoteKey,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(16),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for RemoteKeyCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for RemoteKeyCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for RemoteKeyCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for RemoteKeyCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/rotation_direction.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Rotation Direction characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct RotationDirectionCharacteristic(Characteristic<i32>);\n\npub enum Value {\n\tClockwise = 0,\n\tCounterclockwise = 1,\n}\n\nimpl RotationDirectionCharacteristic {\n    /// Creates a new Rotation Direction characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<i32> {\n            id,\n            accessory_id,\n            hap_type: HapType::RotationDirection,\n            format: Format::Int32,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // CLOCKWISE\n\t\t\t\t1, // COUNTERCLOCKWISE\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for RotationDirectionCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for RotationDirectionCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<i32> for RotationDirectionCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<i32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<i32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<i32> for RotationDirectionCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/rotation_speed.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Rotation Speed characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct RotationSpeedCharacteristic(Characteristic<f32>);\n\nimpl RotationSpeedCharacteristic {\n    /// Creates a new Rotation Speed characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::RotationSpeed,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(100 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for RotationSpeedCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for RotationSpeedCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for RotationSpeedCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for RotationSpeedCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/router_status.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Router Status characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct RouterStatusCharacteristic(Characteristic<u8>);\n\nimpl RouterStatusCharacteristic {\n    /// Creates a new Router Status characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::RouterStatus,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for RouterStatusCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for RouterStatusCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for RouterStatusCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for RouterStatusCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/saturation.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Saturation characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SaturationCharacteristic(Characteristic<f32>);\n\nimpl SaturationCharacteristic {\n    /// Creates a new Saturation characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::Saturation,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tunit: Some(Unit::Percentage),\n\t\t\tmax_value: Some(100 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SaturationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SaturationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for SaturationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for SaturationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/security_system_alarm_type.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Security System Alarm Type characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SecuritySystemAlarmTypeCharacteristic(Characteristic<u8>);\n\nimpl SecuritySystemAlarmTypeCharacteristic {\n    /// Creates a new Security System Alarm Type characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::SecuritySystemAlarmType,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SecuritySystemAlarmTypeCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SecuritySystemAlarmTypeCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for SecuritySystemAlarmTypeCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for SecuritySystemAlarmTypeCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/security_system_current_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Security System Current State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SecuritySystemCurrentStateCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tStayArm = 0,\n\tAwayArm = 1,\n\tNightArm = 2,\n\tDisarm = 3,\n\tAlarmTriggered = 4,\n}\n\nimpl SecuritySystemCurrentStateCharacteristic {\n    /// Creates a new Security System Current State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::SecuritySystemCurrentState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(4),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // STAY_ARM\n\t\t\t\t1, // AWAY_ARM\n\t\t\t\t2, // NIGHT_ARM\n\t\t\t\t3, // DISARM\n\t\t\t\t4, // ALARM_TRIGGERED\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SecuritySystemCurrentStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SecuritySystemCurrentStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for SecuritySystemCurrentStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for SecuritySystemCurrentStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/security_system_target_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Security System Target State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SecuritySystemTargetStateCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tStayArm = 0,\n\tAwayArm = 1,\n\tNightArm = 2,\n\tDisarm = 3,\n\tAlarmTriggered = 4,\n}\n\nimpl SecuritySystemTargetStateCharacteristic {\n    /// Creates a new Security System Target State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::SecuritySystemTargetState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(3),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // STAY_ARM\n\t\t\t\t1, // AWAY_ARM\n\t\t\t\t2, // NIGHT_ARM\n\t\t\t\t3, // DISARM\n\t\t\t\t4, // ALARM_TRIGGERED\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SecuritySystemTargetStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SecuritySystemTargetStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for SecuritySystemTargetStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for SecuritySystemTargetStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/selected_audio_stream_configuration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Selected Audio Stream Configuration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SelectedAudioStreamConfigurationCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SelectedAudioStreamConfigurationCharacteristic {\n    /// Creates a new Selected Audio Stream Configuration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SelectedAudioStreamConfiguration,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SelectedAudioStreamConfigurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SelectedAudioStreamConfigurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SelectedAudioStreamConfigurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SelectedAudioStreamConfigurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/selected_camera_recording_configuration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Selected Camera Recording Configuration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SelectedCameraRecordingConfigurationCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SelectedCameraRecordingConfigurationCharacteristic {\n    /// Creates a new Selected Camera Recording Configuration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SelectedCameraRecordingConfiguration,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SelectedCameraRecordingConfigurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SelectedCameraRecordingConfigurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SelectedCameraRecordingConfigurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SelectedCameraRecordingConfigurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/selected_diagnostics_modes.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Selected Diagnostics Modes characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SelectedDiagnosticsModesCharacteristic(Characteristic<u32>);\n\nimpl SelectedDiagnosticsModesCharacteristic {\n    /// Creates a new Selected Diagnostics Modes characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u32> {\n            id,\n            accessory_id,\n            hap_type: HapType::SelectedDiagnosticsModes,\n            format: Format::UInt32,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SelectedDiagnosticsModesCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SelectedDiagnosticsModesCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u32> for SelectedDiagnosticsModesCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u32> for SelectedDiagnosticsModesCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/selected_stream_configuration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Selected Stream Configuration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SelectedStreamConfigurationCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SelectedStreamConfigurationCharacteristic {\n    /// Creates a new Selected Stream Configuration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SelectedStreamConfiguration,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SelectedStreamConfigurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SelectedStreamConfigurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SelectedStreamConfigurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SelectedStreamConfigurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/serial_number.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Serial Number characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SerialNumberCharacteristic(Characteristic<String>);\n\nimpl SerialNumberCharacteristic {\n    /// Creates a new Serial Number characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<String> {\n            id,\n            accessory_id,\n            hap_type: HapType::SerialNumber,\n            format: Format::String,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_len: Some(64),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SerialNumberCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SerialNumberCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<String> for SerialNumberCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<String>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<String>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<String> for SerialNumberCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/service_signature.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Service Signature characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ServiceSignatureCharacteristic(Characteristic<Vec<u8>>);\n\nimpl ServiceSignatureCharacteristic {\n    /// Creates a new Service Signature characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::ServiceSignature,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ServiceSignatureCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ServiceSignatureCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for ServiceSignatureCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for ServiceSignatureCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/set_duration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Set Duration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SetDurationCharacteristic(Characteristic<u32>);\n\nimpl SetDurationCharacteristic {\n    /// Creates a new Set Duration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u32> {\n            id,\n            accessory_id,\n            hap_type: HapType::SetDuration,\n            format: Format::UInt32,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tunit: Some(Unit::Seconds),\n\t\t\tmax_value: Some(3600),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SetDurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SetDurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u32> for SetDurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u32> for SetDurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/setup_data_stream_transport.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Setup Data Stream Transport characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SetupDataStreamTransportCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SetupDataStreamTransportCharacteristic {\n    /// Creates a new Setup Data Stream Transport characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SetupDataStreamTransport,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SetupDataStreamTransportCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SetupDataStreamTransportCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SetupDataStreamTransportCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SetupDataStreamTransportCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/setup_endpoint.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Setup Endpoint characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SetupEndpointCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SetupEndpointCharacteristic {\n    /// Creates a new Setup Endpoint characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SetupEndpoint,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SetupEndpointCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SetupEndpointCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SetupEndpointCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SetupEndpointCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/setup_transfer_transport.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Setup Transfer Transport characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SetupTransferTransportCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SetupTransferTransportCharacteristic {\n    /// Creates a new Setup Transfer Transport characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SetupTransferTransport,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedWrite,\n\t\t\t\tPerm::WriteResponse,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SetupTransferTransportCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SetupTransferTransportCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SetupTransferTransportCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SetupTransferTransportCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/signal_to_noise_ratio.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Signal-to-noise Ratio characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SignalToNoiseRatioCharacteristic(Characteristic<i32>);\n\nimpl SignalToNoiseRatioCharacteristic {\n    /// Creates a new Signal-to-noise Ratio characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<i32> {\n            id,\n            accessory_id,\n            hap_type: HapType::SignalToNoiseRatio,\n            format: Format::Int32,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SignalToNoiseRatioCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SignalToNoiseRatioCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<i32> for SignalToNoiseRatioCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<i32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<i32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<i32> for SignalToNoiseRatioCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/siri_enable.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Siri Enable characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SiriEnableCharacteristic(Characteristic<u8>);\n\nimpl SiriEnableCharacteristic {\n    /// Creates a new Siri Enable characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::SiriEnable,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SiriEnableCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SiriEnableCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for SiriEnableCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for SiriEnableCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/siri_endpoint_session_status.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Siri Endpoint Session Status characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SiriEndpointSessionStatusCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SiriEndpointSessionStatusCharacteristic {\n    /// Creates a new Siri Endpoint Session Status characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SiriEndpointSessionStatus,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SiriEndpointSessionStatusCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SiriEndpointSessionStatusCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SiriEndpointSessionStatusCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SiriEndpointSessionStatusCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/siri_engine_version.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Siri Engine Version characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SiriEngineVersionCharacteristic(Characteristic<String>);\n\nimpl SiriEngineVersionCharacteristic {\n    /// Creates a new Siri Engine Version characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<String> {\n            id,\n            accessory_id,\n            hap_type: HapType::SiriEngineVersion,\n            format: Format::String,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SiriEngineVersionCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SiriEngineVersionCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<String> for SiriEngineVersionCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<String>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<String>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<String> for SiriEngineVersionCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/siri_input_type.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Siri Input Type characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SiriInputTypeCharacteristic(Characteristic<u8>);\n\nimpl SiriInputTypeCharacteristic {\n    /// Creates a new Siri Input Type characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::SiriInputType,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SiriInputTypeCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SiriInputTypeCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for SiriInputTypeCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for SiriInputTypeCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/siri_light_on_use.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Siri Light On Use characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SiriLightOnUseCharacteristic(Characteristic<u8>);\n\nimpl SiriLightOnUseCharacteristic {\n    /// Creates a new Siri Light On Use characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::SiriLightOnUse,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SiriLightOnUseCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SiriLightOnUseCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for SiriLightOnUseCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for SiriLightOnUseCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/siri_listening.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Siri Listening characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SiriListeningCharacteristic(Characteristic<u8>);\n\nimpl SiriListeningCharacteristic {\n    /// Creates a new Siri Listening characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::SiriListening,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SiriListeningCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SiriListeningCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for SiriListeningCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for SiriListeningCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/siri_touch_to_use.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Siri Touch To Use characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SiriTouchToUseCharacteristic(Characteristic<u8>);\n\nimpl SiriTouchToUseCharacteristic {\n    /// Creates a new Siri Touch To Use characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::SiriTouchToUse,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SiriTouchToUseCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SiriTouchToUseCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for SiriTouchToUseCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for SiriTouchToUseCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/slat_type.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Slat Type characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SlatTypeCharacteristic(Characteristic<u8>);\n\nimpl SlatTypeCharacteristic {\n    /// Creates a new Slat Type characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::SlatType,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SlatTypeCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SlatTypeCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for SlatTypeCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for SlatTypeCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/sleep_discovery_mode.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Sleep Discovery Mode characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SleepDiscoveryModeCharacteristic(Characteristic<u8>);\n\nimpl SleepDiscoveryModeCharacteristic {\n    /// Creates a new Sleep Discovery Mode characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::SleepDiscoveryMode,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SleepDiscoveryModeCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SleepDiscoveryModeCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for SleepDiscoveryModeCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for SleepDiscoveryModeCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/sleep_interval.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Sleep Interval characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SleepIntervalCharacteristic(Characteristic<u32>);\n\nimpl SleepIntervalCharacteristic {\n    /// Creates a new Sleep Interval characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u32> {\n            id,\n            accessory_id,\n            hap_type: HapType::SleepInterval,\n            format: Format::UInt32,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SleepIntervalCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SleepIntervalCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u32> for SleepIntervalCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u32> for SleepIntervalCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/smoke_detected.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Smoke Detected characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SmokeDetectedCharacteristic(Characteristic<u8>);\n\nimpl SmokeDetectedCharacteristic {\n    /// Creates a new Smoke Detected characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::SmokeDetected,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SmokeDetectedCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SmokeDetectedCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for SmokeDetectedCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for SmokeDetectedCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/software_revision.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Software Revision characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SoftwareRevisionCharacteristic(Characteristic<String>);\n\nimpl SoftwareRevisionCharacteristic {\n    /// Creates a new Software Revision characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<String> {\n            id,\n            accessory_id,\n            hap_type: HapType::SoftwareRevision,\n            format: Format::String,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SoftwareRevisionCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SoftwareRevisionCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<String> for SoftwareRevisionCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<String>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<String>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<String> for SoftwareRevisionCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/staged_firmware_version.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Staged Firmware Version characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct StagedFirmwareVersionCharacteristic(Characteristic<String>);\n\nimpl StagedFirmwareVersionCharacteristic {\n    /// Creates a new Staged Firmware Version characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<String> {\n            id,\n            accessory_id,\n            hap_type: HapType::StagedFirmwareVersion,\n            format: Format::String,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for StagedFirmwareVersionCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for StagedFirmwareVersionCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<String> for StagedFirmwareVersionCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<String>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<String>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<String> for StagedFirmwareVersionCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/status_active.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Status Active characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct StatusActiveCharacteristic(Characteristic<bool>);\n\nimpl StatusActiveCharacteristic {\n    /// Creates a new Status Active characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::StatusActive,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for StatusActiveCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for StatusActiveCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for StatusActiveCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for StatusActiveCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/status_fault.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Status Fault characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct StatusFaultCharacteristic(Characteristic<u8>);\n\nimpl StatusFaultCharacteristic {\n    /// Creates a new Status Fault characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::StatusFault,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for StatusFaultCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for StatusFaultCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for StatusFaultCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for StatusFaultCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/status_jammed.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Status Jammed characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct StatusJammedCharacteristic(Characteristic<u8>);\n\nimpl StatusJammedCharacteristic {\n    /// Creates a new Status Jammed characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::StatusJammed,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for StatusJammedCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for StatusJammedCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for StatusJammedCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for StatusJammedCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/status_low_battery.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Status Low Battery characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct StatusLowBatteryCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tBatteryNormal = 0,\n\tBatteryLow = 1,\n}\n\nimpl StatusLowBatteryCharacteristic {\n    /// Creates a new Status Low Battery characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::StatusLowBattery,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // BATTERY_NORMAL\n\t\t\t\t1, // BATTERY_LOW\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for StatusLowBatteryCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for StatusLowBatteryCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for StatusLowBatteryCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for StatusLowBatteryCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/status_tampered.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Status Tampered characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct StatusTamperedCharacteristic(Characteristic<u8>);\n\nimpl StatusTamperedCharacteristic {\n    /// Creates a new Status Tampered characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::StatusTampered,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for StatusTamperedCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for StatusTamperedCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for StatusTamperedCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for StatusTamperedCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/streaming_status.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Streaming Status characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct StreamingStatusCharacteristic(Characteristic<Vec<u8>>);\n\nimpl StreamingStatusCharacteristic {\n    /// Creates a new Streaming Status characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::StreamingStatus,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for StreamingStatusCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for StreamingStatusCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for StreamingStatusCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for StreamingStatusCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/sulphur_dioxide_density.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Sulphur dioxide Density characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SulphurDioxideDensityCharacteristic(Characteristic<f32>);\n\nimpl SulphurDioxideDensityCharacteristic {\n    /// Creates a new Sulphur dioxide Density characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::SulphurDioxideDensity,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::MicrogramsPerCubicMeter),\n\t\t\tmax_value: Some(1000 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SulphurDioxideDensityCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SulphurDioxideDensityCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for SulphurDioxideDensityCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for SulphurDioxideDensityCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/supported_asset_types.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Supported Asset Types characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SupportedAssetTypesCharacteristic(Characteristic<u32>);\n\nimpl SupportedAssetTypesCharacteristic {\n    /// Creates a new Supported Asset Types characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u32> {\n            id,\n            accessory_id,\n            hap_type: HapType::SupportedAssetTypes,\n            format: Format::UInt32,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SupportedAssetTypesCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SupportedAssetTypesCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u32> for SupportedAssetTypesCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u32> for SupportedAssetTypesCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/supported_audio_recording_configuration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Supported Audio Recording Configuration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SupportedAudioRecordingConfigurationCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SupportedAudioRecordingConfigurationCharacteristic {\n    /// Creates a new Supported Audio Recording Configuration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SupportedAudioRecordingConfiguration,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SupportedAudioRecordingConfigurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SupportedAudioRecordingConfigurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SupportedAudioRecordingConfigurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SupportedAudioRecordingConfigurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/supported_audio_stream_configuration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Supported Audio Stream Configuration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SupportedAudioStreamConfigurationCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SupportedAudioStreamConfigurationCharacteristic {\n    /// Creates a new Supported Audio Stream Configuration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SupportedAudioStreamConfiguration,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SupportedAudioStreamConfigurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SupportedAudioStreamConfigurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SupportedAudioStreamConfigurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SupportedAudioStreamConfigurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/supported_camera_recording_configuration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Supported Camera Recording Configuration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SupportedCameraRecordingConfigurationCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SupportedCameraRecordingConfigurationCharacteristic {\n    /// Creates a new Supported Camera Recording Configuration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SupportedCameraRecordingConfiguration,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SupportedCameraRecordingConfigurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SupportedCameraRecordingConfigurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SupportedCameraRecordingConfigurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SupportedCameraRecordingConfigurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/supported_characteristic_value_transition_configuration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Supported Characteristic Value Transition Configuration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SupportedCharacteristicValueTransitionConfigurationCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SupportedCharacteristicValueTransitionConfigurationCharacteristic {\n    /// Creates a new Supported Characteristic Value Transition Configuration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SupportedCharacteristicValueTransitionConfiguration,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SupportedCharacteristicValueTransitionConfigurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SupportedCharacteristicValueTransitionConfigurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SupportedCharacteristicValueTransitionConfigurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SupportedCharacteristicValueTransitionConfigurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/supported_data_stream_transport_configuration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Supported Data Stream Transport Configuration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SupportedDataStreamTransportConfigurationCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SupportedDataStreamTransportConfigurationCharacteristic {\n    /// Creates a new Supported Data Stream Transport Configuration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SupportedDataStreamTransportConfiguration,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SupportedDataStreamTransportConfigurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SupportedDataStreamTransportConfigurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SupportedDataStreamTransportConfigurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SupportedDataStreamTransportConfigurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/supported_diagnostics_modes.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Supported Diagnostics Modes characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SupportedDiagnosticsModesCharacteristic(Characteristic<u32>);\n\nimpl SupportedDiagnosticsModesCharacteristic {\n    /// Creates a new Supported Diagnostics Modes characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u32> {\n            id,\n            accessory_id,\n            hap_type: HapType::SupportedDiagnosticsModes,\n            format: Format::UInt32,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SupportedDiagnosticsModesCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SupportedDiagnosticsModesCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u32> for SupportedDiagnosticsModesCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u32> for SupportedDiagnosticsModesCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/supported_diagnostics_snapshot.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Supported Diagnostics Snapshot characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SupportedDiagnosticsSnapshotCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SupportedDiagnosticsSnapshotCharacteristic {\n    /// Creates a new Supported Diagnostics Snapshot characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SupportedDiagnosticsSnapshot,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SupportedDiagnosticsSnapshotCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SupportedDiagnosticsSnapshotCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SupportedDiagnosticsSnapshotCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SupportedDiagnosticsSnapshotCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/supported_firmware_update_configuration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Supported Firmware Update Configuration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SupportedFirmwareUpdateConfigurationCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SupportedFirmwareUpdateConfigurationCharacteristic {\n    /// Creates a new Supported Firmware Update Configuration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SupportedFirmwareUpdateConfiguration,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SupportedFirmwareUpdateConfigurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SupportedFirmwareUpdateConfigurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SupportedFirmwareUpdateConfigurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SupportedFirmwareUpdateConfigurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/supported_router_configuration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Supported Router Configuration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SupportedRouterConfigurationCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SupportedRouterConfigurationCharacteristic {\n    /// Creates a new Supported Router Configuration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SupportedRouterConfiguration,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SupportedRouterConfigurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SupportedRouterConfigurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SupportedRouterConfigurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SupportedRouterConfigurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/supported_rtp_configuration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Supported RTP Configuration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SupportedRtpConfigurationCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SupportedRtpConfigurationCharacteristic {\n    /// Creates a new Supported RTP Configuration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SupportedRtpConfiguration,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SupportedRtpConfigurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SupportedRtpConfigurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SupportedRtpConfigurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SupportedRtpConfigurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/supported_target_configuration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Supported Target Configuration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SupportedTargetConfigurationCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SupportedTargetConfigurationCharacteristic {\n    /// Creates a new Supported Target Configuration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SupportedTargetConfiguration,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SupportedTargetConfigurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SupportedTargetConfigurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SupportedTargetConfigurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SupportedTargetConfigurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/supported_transfer_transport_configuration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Supported Transfer Transport Configuration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SupportedTransferTransportConfigurationCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SupportedTransferTransportConfigurationCharacteristic {\n    /// Creates a new Supported Transfer Transport Configuration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SupportedTransferTransportConfiguration,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SupportedTransferTransportConfigurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SupportedTransferTransportConfigurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SupportedTransferTransportConfigurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SupportedTransferTransportConfigurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/supported_video_recording_configuration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Supported Video Recording Configuration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SupportedVideoRecordingConfigurationCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SupportedVideoRecordingConfigurationCharacteristic {\n    /// Creates a new Supported Video Recording Configuration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SupportedVideoRecordingConfiguration,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SupportedVideoRecordingConfigurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SupportedVideoRecordingConfigurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SupportedVideoRecordingConfigurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SupportedVideoRecordingConfigurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/supported_video_stream_configuration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Supported Video Stream Configuration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SupportedVideoStreamConfigurationCharacteristic(Characteristic<Vec<u8>>);\n\nimpl SupportedVideoStreamConfigurationCharacteristic {\n    /// Creates a new Supported Video Stream Configuration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::SupportedVideoStreamConfiguration,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SupportedVideoStreamConfigurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SupportedVideoStreamConfigurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for SupportedVideoStreamConfigurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for SupportedVideoStreamConfigurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/swing_mode.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Swing Mode characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct SwingModeCharacteristic(Characteristic<u8>);\n\nimpl SwingModeCharacteristic {\n    /// Creates a new Swing Mode characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::SwingMode,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for SwingModeCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for SwingModeCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for SwingModeCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for SwingModeCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/target_air_purifier_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Target Air Purifier State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct TargetAirPurifierStateCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tManual = 0,\n\tAuto = 1,\n}\n\nimpl TargetAirPurifierStateCharacteristic {\n    /// Creates a new Target Air Purifier State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::TargetAirPurifierState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // MANUAL\n\t\t\t\t1, // AUTO\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for TargetAirPurifierStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for TargetAirPurifierStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for TargetAirPurifierStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for TargetAirPurifierStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/target_door_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Target Door State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct TargetDoorStateCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tNum1 = 0,\n\tNum0 = 1,\n}\n\nimpl TargetDoorStateCharacteristic {\n    /// Creates a new Target Door State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::TargetDoorState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // 1\n\t\t\t\t1, // 0\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for TargetDoorStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for TargetDoorStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for TargetDoorStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for TargetDoorStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/target_fan_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Target Fan State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct TargetFanStateCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tManual = 0,\n\tAuto = 1,\n}\n\nimpl TargetFanStateCharacteristic {\n    /// Creates a new Target Fan State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::TargetFanState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // MANUAL\n\t\t\t\t1, // AUTO\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for TargetFanStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for TargetFanStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for TargetFanStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for TargetFanStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/target_heater_cooler_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Target Heater-Cooler State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct TargetHeaterCoolerStateCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tAuto = 0,\n\tHeatAuto = 1,\n\tCoolAuto = 2,\n}\n\nimpl TargetHeaterCoolerStateCharacteristic {\n    /// Creates a new Target Heater-Cooler State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::TargetHeaterCoolerState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(2),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // AUTO\n\t\t\t\t1, // HEAT_AUTO\n\t\t\t\t2, // COOL_AUTO\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for TargetHeaterCoolerStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for TargetHeaterCoolerStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for TargetHeaterCoolerStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for TargetHeaterCoolerStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/target_heating_cooling_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Target Heating Cooling State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct TargetHeatingCoolingStateCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tOff = 0,\n\tHeat = 1,\n\tCool = 2,\n\tAuto = 3,\n}\n\nimpl TargetHeatingCoolingStateCharacteristic {\n    /// Creates a new Target Heating Cooling State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::TargetHeatingCoolingState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(3),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // OFF\n\t\t\t\t1, // HEAT\n\t\t\t\t2, // COOL\n\t\t\t\t3, // AUTO\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for TargetHeatingCoolingStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for TargetHeatingCoolingStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for TargetHeatingCoolingStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for TargetHeatingCoolingStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/target_horizontal_tilt_angle.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Target Horizontal Tilt Angle characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct TargetHorizontalTiltAngleCharacteristic(Characteristic<i32>);\n\nimpl TargetHorizontalTiltAngleCharacteristic {\n    /// Creates a new Target Horizontal Tilt Angle characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<i32> {\n            id,\n            accessory_id,\n            hap_type: HapType::TargetHorizontalTiltAngle,\n            format: Format::Int32,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tunit: Some(Unit::ArcDegrees),\n\t\t\tmax_value: Some(90),\n\t\t\tmin_value: Some(-90),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for TargetHorizontalTiltAngleCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for TargetHorizontalTiltAngleCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<i32> for TargetHorizontalTiltAngleCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<i32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<i32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<i32> for TargetHorizontalTiltAngleCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/target_humidifier_dehumidifier_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Target Humidifier-Dehumidifier State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct TargetHumidifierDehumidifierStateCharacteristic(Characteristic<u8>);\n\npub enum Value {\n\tAuto = 0,\n\tHumidifyAuto = 1,\n\tDehumidifyAuto = 2,\n}\n\nimpl TargetHumidifierDehumidifierStateCharacteristic {\n    /// Creates a new Target Humidifier-Dehumidifier State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::TargetHumidifierDehumidifierState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(2),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n\t\t\tvalid_values: Some(vec![\n\t\t\t\t0, // AUTO\n\t\t\t\t1, // HUMIDIFY_AUTO\n\t\t\t\t2, // DEHUMIDIFY_AUTO\n\t\t\t]),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for TargetHumidifierDehumidifierStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for TargetHumidifierDehumidifierStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for TargetHumidifierDehumidifierStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for TargetHumidifierDehumidifierStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/target_list_configuration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Target List Configuration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct TargetListConfigurationCharacteristic(Characteristic<Vec<u8>>);\n\nimpl TargetListConfigurationCharacteristic {\n    /// Creates a new Target List Configuration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::TargetListConfiguration,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n\t\t\t\tPerm::WriteResponse,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for TargetListConfigurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for TargetListConfigurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for TargetListConfigurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for TargetListConfigurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/target_media_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Target Media State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct TargetMediaStateCharacteristic(Characteristic<u8>);\n\nimpl TargetMediaStateCharacteristic {\n    /// Creates a new Target Media State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::TargetMediaState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(2),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for TargetMediaStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for TargetMediaStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for TargetMediaStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for TargetMediaStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/target_position.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Target Position characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct TargetPositionCharacteristic(Characteristic<u8>);\n\nimpl TargetPositionCharacteristic {\n    /// Creates a new Target Position characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::TargetPosition,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tunit: Some(Unit::Percentage),\n\t\t\tmax_value: Some(100),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for TargetPositionCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for TargetPositionCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for TargetPositionCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for TargetPositionCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/target_relative_humidity.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Target Relative Humidity characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct TargetRelativeHumidityCharacteristic(Characteristic<f32>);\n\nimpl TargetRelativeHumidityCharacteristic {\n    /// Creates a new Target Relative Humidity characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::TargetRelativeHumidity,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tunit: Some(Unit::Percentage),\n\t\t\tmax_value: Some(100 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for TargetRelativeHumidityCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for TargetRelativeHumidityCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for TargetRelativeHumidityCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for TargetRelativeHumidityCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/target_temperature.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Target Temperature characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct TargetTemperatureCharacteristic(Characteristic<f32>);\n\nimpl TargetTemperatureCharacteristic {\n    /// Creates a new Target Temperature characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::TargetTemperature,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tunit: Some(Unit::Celsius),\n\t\t\tmax_value: Some(38 as f32),\n\t\t\tmin_value: Some(10 as f32),\n\t\t\tstep_value: Some(0.1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for TargetTemperatureCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for TargetTemperatureCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for TargetTemperatureCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for TargetTemperatureCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/target_tilt_angle.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Target Tilt Angle characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct TargetTiltAngleCharacteristic(Characteristic<i32>);\n\nimpl TargetTiltAngleCharacteristic {\n    /// Creates a new Target Tilt Angle characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<i32> {\n            id,\n            accessory_id,\n            hap_type: HapType::TargetTiltAngle,\n            format: Format::Int32,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tunit: Some(Unit::ArcDegrees),\n\t\t\tmax_value: Some(90),\n\t\t\tmin_value: Some(-90),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for TargetTiltAngleCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for TargetTiltAngleCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<i32> for TargetTiltAngleCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<i32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<i32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<i32> for TargetTiltAngleCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/target_vertical_tilt_angle.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Target Vertical Tilt Angle characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct TargetVerticalTiltAngleCharacteristic(Characteristic<i32>);\n\nimpl TargetVerticalTiltAngleCharacteristic {\n    /// Creates a new Target Vertical Tilt Angle characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<i32> {\n            id,\n            accessory_id,\n            hap_type: HapType::TargetVerticalTiltAngle,\n            format: Format::Int32,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tunit: Some(Unit::ArcDegrees),\n\t\t\tmax_value: Some(90),\n\t\t\tmin_value: Some(-90),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for TargetVerticalTiltAngleCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for TargetVerticalTiltAngleCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<i32> for TargetVerticalTiltAngleCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<i32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<i32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<i32> for TargetVerticalTiltAngleCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/target_visibility_state.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Target Visibility State characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct TargetVisibilityStateCharacteristic(Characteristic<u8>);\n\nimpl TargetVisibilityStateCharacteristic {\n    /// Creates a new Target Visibility State characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::TargetVisibilityState,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for TargetVisibilityStateCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for TargetVisibilityStateCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for TargetVisibilityStateCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for TargetVisibilityStateCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/temperature_display_units.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Temperature Display Units characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct TemperatureDisplayUnitsCharacteristic(Characteristic<u8>);\n\nimpl TemperatureDisplayUnitsCharacteristic {\n    /// Creates a new Temperature Display Units characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::TemperatureDisplayUnits,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for TemperatureDisplayUnitsCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for TemperatureDisplayUnitsCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for TemperatureDisplayUnitsCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for TemperatureDisplayUnitsCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/third_party_camera_active.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Third Party Camera Active characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ThirdPartyCameraActiveCharacteristic(Characteristic<bool>);\n\nimpl ThirdPartyCameraActiveCharacteristic {\n    /// Creates a new Third Party Camera Active characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<bool> {\n            id,\n            accessory_id,\n            hap_type: HapType::ThirdPartyCameraActive,\n            format: Format::Bool,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ThirdPartyCameraActiveCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ThirdPartyCameraActiveCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<bool> for ThirdPartyCameraActiveCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<bool>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<bool>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<bool> for ThirdPartyCameraActiveCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<bool>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/thread_control_point.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Thread Control Point characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ThreadControlPointCharacteristic(Characteristic<Vec<u8>>);\n\nimpl ThreadControlPointCharacteristic {\n    /// Creates a new Thread Control Point characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::ThreadControlPoint,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ThreadControlPointCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ThreadControlPointCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for ThreadControlPointCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for ThreadControlPointCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/thread_node_capabilities.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Thread Node Capabilities characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ThreadNodeCapabilitiesCharacteristic(Characteristic<u16>);\n\nimpl ThreadNodeCapabilitiesCharacteristic {\n    /// Creates a new Thread Node Capabilities characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u16> {\n            id,\n            accessory_id,\n            hap_type: HapType::ThreadNodeCapabilities,\n            format: Format::UInt16,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(31),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ThreadNodeCapabilitiesCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ThreadNodeCapabilitiesCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u16> for ThreadNodeCapabilitiesCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u16>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u16>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u16> for ThreadNodeCapabilitiesCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u16>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u16>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/thread_openthread_version.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Thread OpenThread Version characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ThreadOpenthreadVersionCharacteristic(Characteristic<String>);\n\nimpl ThreadOpenthreadVersionCharacteristic {\n    /// Creates a new Thread OpenThread Version characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<String> {\n            id,\n            accessory_id,\n            hap_type: HapType::ThreadOpenthreadVersion,\n            format: Format::String,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ThreadOpenthreadVersionCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ThreadOpenthreadVersionCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<String> for ThreadOpenthreadVersionCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<String>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<String>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<String> for ThreadOpenthreadVersionCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/thread_status.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Thread Status characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ThreadStatusCharacteristic(Characteristic<u16>);\n\nimpl ThreadStatusCharacteristic {\n    /// Creates a new Thread Status characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u16> {\n            id,\n            accessory_id,\n            hap_type: HapType::ThreadStatus,\n            format: Format::UInt16,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(6),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ThreadStatusCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ThreadStatusCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u16> for ThreadStatusCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u16>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u16>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u16> for ThreadStatusCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u16>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u16>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/transmit_power.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Transmit Power characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct TransmitPowerCharacteristic(Characteristic<i32>);\n\nimpl TransmitPowerCharacteristic {\n    /// Creates a new Transmit Power characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<i32> {\n            id,\n            accessory_id,\n            hap_type: HapType::TransmitPower,\n            format: Format::Int32,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for TransmitPowerCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for TransmitPowerCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<i32> for TransmitPowerCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<i32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<i32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<i32> for TransmitPowerCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<i32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/valve_type.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Valve Type characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct ValveTypeCharacteristic(Characteristic<u8>);\n\nimpl ValveTypeCharacteristic {\n    /// Creates a new Valve Type characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::ValveType,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(3),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for ValveTypeCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for ValveTypeCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for ValveTypeCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for ValveTypeCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/version.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Version characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct VersionCharacteristic(Characteristic<String>);\n\nimpl VersionCharacteristic {\n    /// Creates a new Version characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<String> {\n            id,\n            accessory_id,\n            hap_type: HapType::Version,\n            format: Format::String,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_len: Some(64),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for VersionCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for VersionCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<String> for VersionCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<String>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<String>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<String> for VersionCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<String>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/video_analysis_active.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Video Analysis Active characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct VideoAnalysisActiveCharacteristic(Characteristic<u8>);\n\nimpl VideoAnalysisActiveCharacteristic {\n    /// Creates a new Video Analysis Active characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::VideoAnalysisActive,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for VideoAnalysisActiveCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for VideoAnalysisActiveCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for VideoAnalysisActiveCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for VideoAnalysisActiveCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/volatile_organic_compound_density.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Volatile Organic Compound Density characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct VolatileOrganicCompoundDensityCharacteristic(Characteristic<f32>);\n\nimpl VolatileOrganicCompoundDensityCharacteristic {\n    /// Creates a new Volatile Organic Compound Density characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<f32> {\n            id,\n            accessory_id,\n            hap_type: HapType::VolatileOrganicCompoundDensity,\n            format: Format::Float,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tunit: Some(Unit::MicrogramsPerCubicMeter),\n\t\t\tmax_value: Some(1000 as f32),\n\t\t\tmin_value: Some(0 as f32),\n\t\t\tstep_value: Some(1 as f32),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for VolatileOrganicCompoundDensityCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for VolatileOrganicCompoundDensityCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<f32> for VolatileOrganicCompoundDensityCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<f32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<f32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<f32> for VolatileOrganicCompoundDensityCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<f32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/volume.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Volume characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct VolumeCharacteristic(Characteristic<u8>);\n\nimpl VolumeCharacteristic {\n    /// Creates a new Volume characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::Volume,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tunit: Some(Unit::Percentage),\n\t\t\tmax_value: Some(100),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for VolumeCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for VolumeCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for VolumeCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for VolumeCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/volume_control_type.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Volume Control Type characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct VolumeControlTypeCharacteristic(Characteristic<u8>);\n\nimpl VolumeControlTypeCharacteristic {\n    /// Creates a new Volume Control Type characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::VolumeControlType,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(3),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for VolumeControlTypeCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for VolumeControlTypeCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for VolumeControlTypeCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for VolumeControlTypeCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/volume_selector.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Volume Selector characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct VolumeSelectorCharacteristic(Characteristic<u8>);\n\nimpl VolumeSelectorCharacteristic {\n    /// Creates a new Volume Selector characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::VolumeSelector,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::PairedWrite,\n            ],\n\t\t\tmax_value: Some(1),\n\t\t\tmin_value: Some(0),\n\t\t\tstep_value: Some(1),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for VolumeSelectorCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for VolumeSelectorCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for VolumeSelectorCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for VolumeSelectorCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/wake_configuration.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Wake Configuration characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct WakeConfigurationCharacteristic(Characteristic<Vec<u8>>);\n\nimpl WakeConfigurationCharacteristic {\n    /// Creates a new Wake Configuration characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::WakeConfiguration,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for WakeConfigurationCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for WakeConfigurationCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for WakeConfigurationCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for WakeConfigurationCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/wan_configuration_list.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// WAN Configuration List characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct WanConfigurationListCharacteristic(Characteristic<Vec<u8>>);\n\nimpl WanConfigurationListCharacteristic {\n    /// Creates a new WAN Configuration List characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::WanConfigurationList,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for WanConfigurationListCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for WanConfigurationListCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for WanConfigurationListCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for WanConfigurationListCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/wan_status_list.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// WAN Status List characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct WanStatusListCharacteristic(Characteristic<Vec<u8>>);\n\nimpl WanStatusListCharacteristic {\n    /// Creates a new WAN Status List characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::WanStatusList,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for WanStatusListCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for WanStatusListCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for WanStatusListCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for WanStatusListCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/wi_fi_capabilities.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Wi-Fi Capabilities characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct WiFiCapabilitiesCharacteristic(Characteristic<u32>);\n\nimpl WiFiCapabilitiesCharacteristic {\n    /// Creates a new Wi-Fi Capabilities characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u32> {\n            id,\n            accessory_id,\n            hap_type: HapType::WiFiCapabilities,\n            format: Format::UInt32,\n            perms: vec![\n\t\t\t\tPerm::PairedRead,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for WiFiCapabilitiesCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for WiFiCapabilitiesCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u32> for WiFiCapabilitiesCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u32>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u32>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u32> for WiFiCapabilitiesCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u32>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/wi_fi_configuration_control.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Wi-Fi Configuration Control characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct WiFiConfigurationControlCharacteristic(Characteristic<Vec<u8>>);\n\nimpl WiFiConfigurationControlCharacteristic {\n    /// Creates a new Wi-Fi Configuration Control characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<Vec<u8>> {\n            id,\n            accessory_id,\n            hap_type: HapType::WiFiConfigurationControl,\n            format: Format::Tlv8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n\t\t\t\tPerm::PairedWrite,\n\t\t\t\tPerm::TimedWrite,\n\t\t\t\tPerm::WriteResponse,\n            ],\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for WiFiConfigurationControlCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for WiFiConfigurationControlCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<Vec<u8>> for WiFiConfigurationControlCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<Vec<u8>>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<Vec<u8>>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<Vec<u8>> for WiFiConfigurationControlCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<Vec<u8>>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/generated/wi_fi_satellite_status.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse async_trait::async_trait;\nuse serde::Serialize;\nuse serde_json::json;\n\nuse crate::{\n    characteristic::{\n        AsyncCharacteristicCallbacks,\n        Characteristic,\n        CharacteristicCallbacks,\n        Format,\n        HapCharacteristic,\n        HapCharacteristicSetup,\n        HapType,\n        OnReadFn,\n        OnReadFuture,\n        OnUpdateFn,\n        OnUpdateFuture,\n        Perm,\n        Unit,\n    },\n    pointer,\n    Result,\n};\n\n// TODO - re-check MaximumDataLength\n/// Wi-Fi Satellite Status characteristic.\n#[derive(Debug, Default, Serialize)]\npub struct WiFiSatelliteStatusCharacteristic(Characteristic<u8>);\n\nimpl WiFiSatelliteStatusCharacteristic {\n    /// Creates a new Wi-Fi Satellite Status characteristic.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        #[allow(unused_mut)]\n        let mut c = Self(Characteristic::<u8> {\n            id,\n            accessory_id,\n            hap_type: HapType::WiFiSatelliteStatus,\n            format: Format::UInt8,\n            perms: vec![\n\t\t\t\tPerm::Events,\n\t\t\t\tPerm::PairedRead,\n            ],\n\t\t\tmax_value: Some(2),\n\t\t\tmin_value: Some(0),\n            ..Default::default()\n        });\n\n        if let Some(ref min_value) = &c.0.min_value {\n            c.0.value = min_value.clone();\n        } else if let Some(ref valid_values) = &c.0.valid_values {\n            if valid_values.len() > 0 {\n                c.0.value = valid_values[0].clone();\n            }\n        }\n\n        c\n    }\n}\n\n#[async_trait]\nimpl HapCharacteristic for WiFiSatelliteStatusCharacteristic {\n    fn get_id(&self) -> u64 { HapCharacteristic::get_id(&self.0) }\n\n    fn set_id(&mut self, id: u64) { HapCharacteristic::set_id(&mut self.0, id) }\n\n    fn get_type(&self) -> HapType { HapCharacteristic::get_type(&self.0) }\n\n    fn set_type(&mut self, hap_type: HapType) { HapCharacteristic::set_type(&mut self.0, hap_type) }\n\n    fn get_format(&self) -> Format { HapCharacteristic::get_format(&self.0) }\n\n    fn set_format(&mut self, format: Format) { HapCharacteristic::set_format(&mut self.0, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { HapCharacteristic::get_perms(&self.0) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { HapCharacteristic::set_perms(&mut self.0, perms) }\n\n    fn get_description(&self) -> Option<String> { HapCharacteristic::get_description(&self.0) }\n\n    fn set_description(&mut self, description: Option<String>) {\n        HapCharacteristic::set_description(&mut self.0, description)\n    }\n\n    fn get_event_notifications(&self) -> Option<bool> { HapCharacteristic::get_event_notifications(&self.0) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        HapCharacteristic::set_event_notifications(&mut self.0, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> { HapCharacteristic::get_value(&mut self.0).await }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        HapCharacteristic::set_value(&mut self.0, value).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { HapCharacteristic::get_unit(&self.0) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { HapCharacteristic::set_unit(&mut self.0, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_max_value(&self.0).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_max_value(&mut self.0, max_value)\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { HapCharacteristic::get_min_value(&self.0).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_min_value(&mut self.0, min_value)\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> {\n        HapCharacteristic::get_step_value(&self.0).map(|v| json!(v))\n    }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        HapCharacteristic::set_step_value(&mut self.0, step_value)\n    }\n\n    fn get_max_len(&self) -> Option<u16> { HapCharacteristic::get_max_len(&self.0) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { HapCharacteristic::set_max_len(&mut self.0, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { HapCharacteristic::get_max_data_len(&self.0) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) {\n        HapCharacteristic::set_max_data_len(&mut self.0, max_data_len)\n    }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> { HapCharacteristic::get_valid_values(&self.0) }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        HapCharacteristic::set_valid_values(&mut self.0, valid_values)\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        HapCharacteristic::get_valid_values_range(&self.0)\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        HapCharacteristic::set_valid_values_range(&mut self.0, valid_values_range)\n    }\n\n    fn get_ttl(&self) -> Option<u64> { HapCharacteristic::get_ttl(&self.0) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { HapCharacteristic::set_ttl(&mut self.0, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { HapCharacteristic::get_pid(&self.0) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { HapCharacteristic::set_pid(&mut self.0, pid) }\n}\n\nimpl HapCharacteristicSetup for WiFiSatelliteStatusCharacteristic {\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        HapCharacteristicSetup::set_event_emitter(&mut self.0, event_emitter)\n    }\n}\n\nimpl CharacteristicCallbacks<u8> for WiFiSatelliteStatusCharacteristic {\n    fn on_read(&mut self, f: Option<impl OnReadFn<u8>>) { CharacteristicCallbacks::on_read(&mut self.0, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<u8>>) { CharacteristicCallbacks::on_update(&mut self.0, f) }\n}\n\nimpl AsyncCharacteristicCallbacks<u8> for WiFiSatelliteStatusCharacteristic {\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_read_async(&mut self.0, f)\n    }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<u8>>) {\n        AsyncCharacteristicCallbacks::on_update_async(&mut self.0, f)\n    }\n}\n"
  },
  {
    "path": "src/characteristic/mod.rs",
    "content": "use async_trait::async_trait;\nuse erased_serde::serialize_trait_object;\nuse futures::future::BoxFuture;\nuse serde::{\n    ser::{SerializeStruct, Serializer},\n    Deserialize,\n    Serialize,\n};\nuse serde_json::json;\nuse std::fmt;\n\nuse crate::{event::Event, pointer, Error, HapType, Result};\n\nmod generated;\n\npub use generated::*;\n\n/// A characteristic. A characteristic is a feature that represents data or an associated behavior of a service. The\n/// characteristic is defined by a universally unique type, and has additional properties that determine how the value\n/// of the characteristic can be accessed.\n#[derive(Default)]\npub struct Characteristic<T: fmt::Debug + Default + Clone + Serialize + Send + Sync> {\n    /// Instance ID; integer assigned by the server to uniquely identify the HAP characteristic object.\n    id: u64,\n    /// ID of the accessory the characteristic belongs to.\n    accessory_id: u64,\n    /// The type of the characteristic.\n    hap_type: HapType,\n    /// Format of the value.\n    format: Format,\n    /// Permissions describing the capabilities of the characteristic.\n    perms: Vec<Perm>,\n    /// String describing the characteristic on a manufacturer-specific basis, such as an indoor versus outdoor\n    /// temperature reading.\n    description: Option<String>,\n    /// Boolean indicating if event notifications are enabled for this characteristic.\n    event_notifications: Option<bool>,\n\n    /// The value of the characteristic, which must conform to the `format` property. This property must be present if\n    /// and only if the characteristic contains the Paired Read permission.\n    value: T,\n    /// Unit of the value, e.g. `Celsius`.\n    unit: Option<Unit>,\n\n    /// Maximum value for the characteristic, which is only appropriate for characteristics that have a format of `Int`\n    /// or `Float`.\n    max_value: Option<T>, // TODO - use this value in `set_value`\n    // Minimum value for the characteristic, which is only appropriate for characteristics that have a format of `Int`\n    // or `Float`.\n    min_value: Option<T>, // TODO - use this value in `set_value`\n    /// Minimum step value for the characteristic, which is only appropriate for characteristics that have a format of\n    /// ”int” or ”float”. For example, if this were 0.15, the characteris- tic value can be incremented from the min-\n    /// imum value in multiples of 0.15. For “float”, the “Value” needs to be rounded on the ac- cessory side to the\n    /// closest allowed value per the ”Step Value” (e.g. a value of 10.150001 received on the accessory side with a\n    /// ”Step Value” of 0.15 and a ”Minimum Value” of 10.0 needs to be interpreted as 10.15).\n    step_value: Option<T>, // TODO - use this value in `set_value`\n    /// Maximum number of characters if the for- mat is ”string”. If this property is omitted for ”string” formats,\n    /// then the default value is 64. The maximum value allowed is 256.\n    max_len: Option<u16>, // TODO - use this value in `set_value`\n    /// Maximum number of characters if the format is ”data”. If this property is omitted for ”data” formats, then the\n    /// default value is 2097152.\n    max_data_len: Option<u32>, // TODO - use this value in `set_value`\n    /// An array of numbers where each element represents a valid value.\n    valid_values: Option<Vec<T>>, // TODO - use this value in `set_value`\n    /// A 2 element array representing the starting value and ending value of the range of valid values.\n    valid_values_range: Option<[T; 2]>, // TODO - use this value in `set_value`\n\n    /// Specified TTL in milliseconds the controller requests the accessory to securely execute a write command.\n    /// Maximum value of this is 9007199254740991.\n    ttl: Option<u64>, // TODO - use this value in `set_value`\n    /// 64-bit unsigned integer assigned by the controller to uniquely identify the timed write transaction.\n    pid: Option<u64>, // TODO - use this value in `set_value`\n\n    /// Sets a callback function on a characteristic that is called every time a controller attempts to read its value.\n    /// Returning a `Some(T)` from this function changes the value of the characteristic before the controller reads\n    /// it so the Controller reads the new value.\n    on_read: Option<Box<dyn OnReadFn<T>>>,\n    /// Sets a callback function on a characteristic that is called every time a controller attempts to update its\n    /// value. The first argument is a reference to the current value of the characteristic and the second argument is\n    /// a reference to the value the controller attempts to change the characteristic's to.\n    on_update: Option<Box<dyn OnUpdateFn<T>>>,\n    /// Sets an async callback function on a characteristic that is driven to completion by the async runtime driving\n    /// the HAP server every time a controller attempts to read its value. Returning a `Some(T)` from this function\n    /// changes the value of the characteristic before the controller reads it so the controller reads the new value.\n    on_read_async: Option<Box<dyn OnReadFuture<T>>>,\n    /// Sets an async callback function on a characteristic that is driven to completion by the async runtime driving\n    /// the HAP server every time a controller attempts to update its value. The first argument is a reference to the\n    /// current value of the characteristic and the second argument is a reference to the value the controller attempts\n    /// to change the characteristic's to.\n    on_update_async: Option<Box<dyn OnUpdateFuture<T>>>,\n\n    event_emitter: Option<pointer::EventEmitter>,\n}\n\nimpl<T: fmt::Debug + Default + Clone + Serialize + Send + Sync> fmt::Debug for Characteristic<T> {\n    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {\n        f.debug_struct(\"Characteristic\")\n            .field(\"id\", &self.id)\n            .field(\"accessory_id\", &self.accessory_id)\n            .field(\"hap_type\", &self.hap_type)\n            .field(\"format\", &self.format)\n            .field(\"perms\", &self.perms)\n            .field(\"description\", &self.description)\n            .field(\"event_notifications\", &self.event_notifications)\n            .field(\"value\", &self.value)\n            .field(\"unit\", &self.unit)\n            .field(\"max_value\", &self.max_value)\n            .field(\"min_value\", &self.min_value)\n            .field(\"step_value\", &self.step_value)\n            .field(\"max_len\", &self.max_len)\n            .field(\"max_data_len\", &self.max_data_len)\n            .field(\"valid_values\", &self.valid_values)\n            .field(\"valid_values_range\", &self.valid_values_range)\n            .field(\"ttl\", &self.ttl)\n            .field(\"pid\", &self.pid)\n            .finish()\n    }\n}\n\nimpl<T: fmt::Debug + Default + Clone + Serialize + Send + Sync> Characteristic<T>\nwhere\n    for<'de> T: Deserialize<'de>,\n{\n    /// Creates a new characteristic.\n    pub fn new(\n        id: u64,\n        accessory_id: u64,\n        hap_type: HapType,\n        format: Format,\n        perms: Vec<Perm>,\n        description: Option<String>,\n        event_notifications: Option<bool>,\n        value: T,\n        unit: Option<Unit>,\n        max_value: Option<T>,\n        min_value: Option<T>,\n        step_value: Option<T>,\n        max_len: Option<u16>,\n        max_data_len: Option<u32>,\n        valid_values: Option<Vec<T>>,\n        valid_values_range: Option<[T; 2]>,\n        ttl: Option<u64>,\n        pid: Option<u64>,\n    ) -> Self {\n        Self {\n            id,\n            accessory_id,\n            hap_type,\n            format,\n            perms,\n            description,\n            event_notifications,\n            value,\n            unit,\n            max_value,\n            min_value,\n            step_value,\n            max_len,\n            max_data_len,\n            valid_values,\n            valid_values_range,\n            ttl,\n            pid,\n            on_read: None,\n            on_update: None,\n            on_read_async: None,\n            on_update_async: None,\n            event_emitter: None,\n        }\n    }\n\n    /// Returns the ID of the characteristic.\n    pub fn get_id(&self) -> u64 { self.id }\n\n    /// Sets the ID of the characteristic.\n    pub fn set_id(&mut self, id: u64) { self.id = id; }\n\n    /// Returns the [`HapType`](HapType) of the characteristic.\n    pub fn get_type(&self) -> HapType { self.hap_type }\n\n    /// Sets the [`HapType`](HapType) of the characteristic.\n    pub fn set_type(&mut self, hap_type: HapType) { self.hap_type = hap_type; }\n\n    /// Returns the [`Format`](Format) of the characteristic.\n    pub fn get_format(&self) -> Format { self.format }\n\n    /// Sets the [`Format`](Format) of the characteristic.\n    pub fn set_format(&mut self, format: Format) { self.format = format; }\n\n    /// Returns the [`Perm`](Perm)s of the characteristic.\n    pub fn get_perms(&self) -> Vec<Perm> { self.perms.clone() }\n\n    /// Sets the [`Perm`](Perm)s of the characteristic.\n    pub fn set_perms(&mut self, perms: Vec<Perm>) { self.perms = perms; }\n\n    /// Returns the description of the characteristic.\n    pub fn get_description(&self) -> Option<String> { self.description.clone() }\n\n    /// Sets the description of the characteristic.\n    pub fn set_description(&mut self, description: Option<String>) { self.description = description; }\n\n    /// Returns the `event_notifications` value of the characteristic.\n    pub fn get_event_notifications(&self) -> Option<bool> { self.event_notifications }\n\n    /// Sets the `event_notifications` value of the characteristic.\n    pub fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        self.event_notifications = event_notifications;\n    }\n\n    /// Returns the value of the characteristic.\n    pub async fn get_value(&mut self) -> Result<T> {\n        let mut val = None;\n        if let Some(ref mut on_read) = self.on_read {\n            val = on_read().map_err(|e| Error::ValueOnRead(e))?;\n        }\n        if let Some(ref mut on_read_async) = self.on_read_async {\n            val = on_read_async().await.map_err(|e| Error::ValueOnRead(e))?;\n        }\n        if let Some(v) = val {\n            self.set_value(v).await?;\n        }\n\n        Ok(self.value.clone())\n    }\n\n    /// Sets the value of the characteristic.\n    pub async fn set_value(&mut self, val: T) -> Result<()> {\n        // TODO - check for min/max on types implementing PartialOrd\n        // if let Some(ref max) = self.inner.try_borrow()?.max_value {\n        //     if &val > max {\n        //         return Err(Error::from_str(\"value above max_value\"));\n        //     }\n        // }\n        // if let Some(ref min) = self.inner.try_borrow()?.min_value {\n        //     if &val < min {\n        //         return Err(Error::from_str(\"value below min_value\"));\n        //     }\n        // }\n\n        let old_val = self.value.clone();\n        if let Some(ref mut on_update) = self.on_update {\n            on_update(&old_val, &val).map_err(|e| Error::ValueOnUpdate(e))?;\n        }\n        if let Some(ref mut on_update_async) = self.on_update_async {\n            on_update_async(old_val, val.clone())\n                .await\n                .map_err(|e| Error::ValueOnUpdate(e))?;\n        }\n\n        if self.event_notifications == Some(true) {\n            if let Some(ref event_emitter) = self.event_emitter {\n                event_emitter\n                    .lock()\n                    .await\n                    .emit(&Event::CharacteristicValueChanged {\n                        aid: self.accessory_id,\n                        iid: self.id,\n                        value: json!(&val),\n                    })\n                    .await;\n            }\n        }\n\n        self.value = val;\n\n        Ok(())\n    }\n\n    /// Returns the [`Unit`](Unit) of the characteristic.\n    pub fn get_unit(&self) -> Option<Unit> { self.unit }\n\n    /// Sets the [`Unit`](Unit) of the characteristic.\n    pub fn set_unit(&mut self, unit: Option<Unit>) { self.unit = unit; }\n\n    /// Returns the maximum value of the characteristic.\n    pub fn get_max_value(&self) -> Option<T> { self.max_value.clone() }\n\n    /// Sets the maximum value of the characteristic.\n    pub fn set_max_value(&mut self, val: Option<T>) { self.max_value = val; }\n\n    /// Returns the minimum value of the characteristic.\n    pub fn get_min_value(&self) -> Option<T> { self.min_value.clone() }\n\n    /// Sets the minimum value of the characteristic.\n    pub fn set_min_value(&mut self, val: Option<T>) { self.min_value = val; }\n\n    /// Returns the step value of the characteristic.\n    pub fn get_step_value(&self) -> Option<T> { self.step_value.clone() }\n\n    /// Sets the step value of the characteristic.\n    pub fn set_step_value(&mut self, val: Option<T>) { self.step_value = val; }\n\n    /// Returns the maximum length of the characteristic.\n    pub fn get_max_len(&self) -> Option<u16> { self.max_len }\n\n    /// Sets the maximum length of the characteristic.\n    pub fn set_max_len(&mut self, val: Option<u16>) { self.max_len = val; }\n\n    /// Returns the maximum data length of the characteristic.\n    pub fn get_max_data_len(&self) -> Option<u32> { self.max_data_len }\n\n    /// Sets the maximum data length of the characteristic.\n    pub fn set_max_data_len(&mut self, val: Option<u32>) { self.max_data_len = val; }\n\n    /// Returns the valid values of the characteristic.\n    pub fn get_valid_values(&self) -> Option<Vec<T>> { self.valid_values.clone() }\n\n    /// Sets the valid values of the characteristic.\n    pub fn set_valid_values(&mut self, val: Option<Vec<T>>) { self.valid_values = val; }\n\n    /// Returns the valid values range of the characteristic.\n    pub fn get_valid_values_range(&self) -> Option<[T; 2]> { self.valid_values_range.clone() }\n\n    /// Sets the valid values range of the characteristic.\n    pub fn set_valid_values_range(&mut self, val: Option<[T; 2]>) { self.valid_values_range = val; }\n\n    /// Returns the TTL of the characteristic.\n    pub fn get_ttl(&self) -> Option<u64> { self.ttl }\n\n    /// Sets the TTL of the characteristic.\n    pub fn set_ttl(&mut self, val: Option<u64>) { self.ttl = val; }\n\n    /// Returns the PID of the characteristic.\n    pub fn get_pid(&self) -> Option<u64> { self.pid }\n\n    /// Sets the PID of the characteristic.\n    pub fn set_pid(&mut self, val: Option<u64>) { self.pid = val; }\n\n    /// Sets a callback function on a characteristic that is called every time a controller attempts to read its value.\n    /// Returning a `Some(T)` from this function changes the value of the characteristic before the controller reads\n    /// it so the controller reads the new value.\n    pub fn on_read(&mut self, f: Option<impl OnReadFn<T>>) {\n        self.on_read = f.map(|f| Box::new(f) as Box<dyn OnReadFn<T>>);\n    }\n\n    /// Sets a callback function on a characteristic that is called every time a controller attempts to update its\n    /// value. The first argument is a reference to the current value of the characteristic and the second argument is a\n    /// reference to the value the controller attempts to change the characteristic's to.\n    pub fn on_update(&mut self, f: Option<impl OnUpdateFn<T>>) {\n        self.on_update = f.map(|f| Box::new(f) as Box<dyn OnUpdateFn<T>>);\n    }\n\n    /// Sets an async callback function on a characteristic that is driven to completion by the async runtime driving\n    /// the HAP server every time a controller attempts to read its value. Returning a `Some(T)` from this function\n    /// changes the value of the characteristic before the controller reads it so the controller reads the new value.\n    pub fn on_read_async(&mut self, f: Option<impl OnReadFuture<T>>) {\n        self.on_read_async = f.map(|f| Box::new(f) as Box<dyn OnReadFuture<T>>);\n    }\n\n    /// Sets an async callback function on a characteristic that is driven to completion by the async runtime driving\n    /// the HAP server every time a controller attempts to update its value. The first argument is a reference to the\n    /// current value of the characteristic and the second argument is a reference to the value the controller attempts\n    /// to change the characteristic's to.\n    pub fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<T>>) {\n        self.on_update_async = f.map(|f| Box::new(f) as Box<dyn OnUpdateFuture<T>>);\n    }\n\n    /// Sets a pointer to an `EventEmitter` on the characteristic.\n    pub(crate) fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        self.event_emitter = event_emitter;\n    }\n}\n\nimpl<T: fmt::Debug + Default + Clone + Serialize + Send + Sync> Serialize for Characteristic<T> {\n    fn serialize<S: Serializer>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"Characteristic\", 15)?;\n        state.serialize_field(\"iid\", &self.id)?;\n        state.serialize_field(\"type\", &self.hap_type)?;\n        state.serialize_field(\"format\", &self.format)?;\n        state.serialize_field(\"perms\", &self.perms)?;\n        if let Some(ref description) = self.description {\n            state.serialize_field(\"description\", description)?;\n        }\n        if let Some(ref event_notifications) = self.event_notifications {\n            state.serialize_field(\"ev\", event_notifications)?;\n        }\n\n        if self.perms.contains(&Perm::PairedRead) {\n            state.serialize_field(\"value\", &self.value)?;\n        }\n        if let Some(ref unit) = self.unit {\n            state.serialize_field(\"unit\", unit)?;\n        }\n        if let Some(ref max_value) = self.max_value {\n            state.serialize_field(\"maxValue\", max_value)?;\n        }\n        if let Some(ref min_value) = self.min_value {\n            state.serialize_field(\"minValue\", min_value)?;\n        }\n        if let Some(ref step_value) = self.step_value {\n            state.serialize_field(\"minStep\", step_value)?;\n        }\n        if let Some(ref max_len) = self.max_len {\n            state.serialize_field(\"maxLen\", max_len)?;\n        }\n        if let Some(ref max_data_len) = self.max_data_len {\n            state.serialize_field(\"maxDataLen\", max_data_len)?;\n        }\n        if let Some(ref valid_values) = self.valid_values {\n            state.serialize_field(\"valid-values\", valid_values)?;\n        }\n        if let Some(ref valid_values_range) = self.valid_values_range {\n            state.serialize_field(\"valid-values-range\", valid_values_range)?;\n        }\n        if let Some(ref ttl) = self.ttl {\n            state.serialize_field(\"TTL\", ttl)?;\n        }\n        if let Some(ref pid) = self.pid {\n            state.serialize_field(\"pid\", pid)?;\n        }\n        state.end()\n    }\n}\n\n/// Permission of a characteristic.\n#[derive(Debug, Copy, Clone, Serialize, PartialEq)]\npub enum Perm {\n    #[serde(rename = \"pr\")]\n    PairedRead,\n    #[serde(rename = \"pw\")]\n    PairedWrite,\n    #[serde(rename = \"ev\")]\n    Events,\n    #[serde(rename = \"aa\")]\n    AdditionalAuthorization,\n    #[serde(rename = \"tw\")]\n    TimedWrite,\n    #[serde(rename = \"hd\")]\n    Hidden,\n    #[serde(rename = \"wr\")]\n    WriteResponse,\n}\n\n/// [`Unit`](Unit) of a characteristic.\n#[derive(Debug, Copy, Clone, Serialize)]\npub enum Unit {\n    #[serde(rename = \"celsius\")]\n    Celsius,\n    #[serde(rename = \"fahrenheit\")]\n    Fahrenheit,\n    #[serde(rename = \"percentage\")]\n    Percentage,\n    #[serde(rename = \"arcdegrees\")]\n    ArcDegrees,\n    #[serde(rename = \"lux\")]\n    Lux,\n    #[serde(rename = \"seconds\")]\n    Seconds,\n    #[serde(rename = \"ppm\")]\n    PartsPerMillion,\n    #[serde(rename = \"micrograms/m^3\")]\n    MicrogramsPerCubicMeter,\n}\n\n/// [`Format`](Format) (data type) of a characteristic.\n#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]\npub enum Format {\n    #[serde(rename = \"bool\")]\n    Bool,\n    #[serde(rename = \"uint8\")]\n    UInt8,\n    #[serde(rename = \"uint16\")]\n    UInt16,\n    #[serde(rename = \"uint32\")]\n    UInt32,\n    #[serde(rename = \"uint64\")]\n    UInt64,\n    #[serde(rename = \"int\")]\n    Int32,\n    #[serde(rename = \"float\")]\n    Float,\n    #[serde(rename = \"string\")]\n    String,\n    #[serde(rename = \"tlv8\")]\n    Tlv8,\n    #[serde(rename = \"data\")]\n    Data,\n}\n\nimpl Default for Format {\n    fn default() -> Format { Format::String }\n}\n\n/// [`HapCharacteristic`](HapCharacteristic) is implemented by every HAP characteristic.\n#[async_trait]\npub trait HapCharacteristic: HapCharacteristicSetup + erased_serde::Serialize + Send + Sync {\n    /// Returns the ID of the characteristic.\n    fn get_id(&self) -> u64;\n    /// Sets the ID of the characteristic.\n    fn set_id(&mut self, id: u64);\n    /// Returns the [`HapType`](HapType) of the characteristic.\n    fn get_type(&self) -> HapType;\n    /// Sets the [`HapType`](HapType) of the characteristic.\n    fn set_type(&mut self, hap_type: HapType);\n    /// Returns the [`Format`](Format) of the characteristic.\n    fn get_format(&self) -> Format;\n    /// Sets the [`Format`](Format) of the characteristic.\n    fn set_format(&mut self, format: Format);\n    /// Returns the [`Perm`](Perm)s of the characteristic.\n    fn get_perms(&self) -> Vec<Perm>;\n    /// Sets the [`Perm`](Perm)s of the characteristic.\n    fn set_perms(&mut self, perms: Vec<Perm>);\n    /// Returns the description of the characteristic.\n    fn get_description(&self) -> Option<String>;\n    /// Sets the description of the characteristic.\n    fn set_description(&mut self, description: Option<String>);\n    /// Returns the `event_notifications` value of the characteristic.\n    fn get_event_notifications(&self) -> Option<bool>;\n    /// Sets the `event_notifications` value of the characteristic.\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>);\n    /// Returns the value of the characteristic.\n    async fn get_value(&mut self) -> Result<serde_json::Value>;\n    /// Sets the value of the characteristic.\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()>;\n    /// Returns the [`Unit`](Unit) of the characteristic.\n    fn get_unit(&self) -> Option<Unit>;\n    /// Sets the [`Unit`](Unit) of the characteristic.\n    fn set_unit(&mut self, unit: Option<Unit>);\n    /// Returns the maximum value of the characteristic.\n    fn get_max_value(&self) -> Option<serde_json::Value>;\n    /// Sets the maximum value of the characteristic.\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()>;\n    /// Returns the minimum value of the characteristic.\n    fn get_min_value(&self) -> Option<serde_json::Value>;\n    /// Sets the minimum value of the characteristic.\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()>;\n    /// Returns the step value of the characteristic.\n    fn get_step_value(&self) -> Option<serde_json::Value>;\n    /// Sets the step value of the characteristic.\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()>;\n    /// Returns the maximum length of the characteristic.\n    fn get_max_len(&self) -> Option<u16>;\n    /// Sets the maximum length of the characteristic.\n    fn set_max_len(&mut self, max_len: Option<u16>);\n    /// Returns the maximum data length of the characteristic.\n    fn get_max_data_len(&self) -> Option<u32>;\n    /// Sets the maximum data length of the characteristic.\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>);\n    /// Returns the valid values of the characteristic.\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>>;\n    /// Sets the valid values of the characteristic.\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()>;\n    /// Returns the valid values range of the characteristic.\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]>;\n    /// Sets the valid values range of the characteristic.\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()>;\n    /// Returns the TTL of the characteristic.\n    fn get_ttl(&self) -> Option<u64>;\n    /// Sets the TTL of the characteristic.\n    fn set_ttl(&mut self, ttl: Option<u64>);\n    /// Returns the PID of the characteristic.\n    fn get_pid(&self) -> Option<u64>;\n    /// Sets the PID of the characteristic.\n    fn set_pid(&mut self, pid: Option<u64>);\n}\n\nserialize_trait_object!(HapCharacteristic);\n\n/// [`HapCharacteristicSetup`](HapCharacteristicSetup) is implemented by every HAP characteristic to provide helper\n/// methods used by the HAP server for setup purposes. It's not meant to be used by a consumer of the library.\npub trait HapCharacteristicSetup {\n    /// Sets a pointer to an `EventEmitter` on the characteristic.\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>);\n}\n\n/// [`OnReadFn`](OnReadFn) represents a callback function to be set on a characteristic that is called every time a\n/// controller attempts to read its value. Returning a `Some(T)` from this function changes the value of the\n/// characteristic before the controller reads it so the controller reads the new value.\npub trait OnReadFn<T: Default + Clone + Serialize + Send + Sync>:\n    Fn() -> std::result::Result<Option<T>, Box<dyn std::error::Error + Send + Sync>> + 'static + Send + Sync\n{\n}\nimpl<F, T: Default + Clone + Serialize + Send + Sync> OnReadFn<T> for F where\n    F: Fn() -> std::result::Result<Option<T>, Box<dyn std::error::Error + Send + Sync>> + 'static + Send + Sync\n{\n}\n\n/// [`OnUpdateFn`](OnUpdateFn) represents a callback function to be set on a characteristic that is called every time a\n/// controller attempts to update its value. The first argument is a reference to the current value of the\n/// characteristic and the second argument is a reference to the value the controller attempts to change the\n/// characteristic's to.\npub trait OnUpdateFn<T: Default + Clone + Serialize + Send + Sync>:\n    FnMut(&T, &T) -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> + 'static + Send + Sync\n{\n}\nimpl<F, T: Default + Clone + Serialize + Send + Sync> OnUpdateFn<T> for F where\n    F: FnMut(&T, &T) -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> + 'static + Send + Sync\n{\n}\n\n/// [`OnReadFuture`](OnReadFuture) represents an async callback function to be set on a characteristic that is driven to\n/// completion by the async runtime driving the HAP server every time a controller attempts to read its value. Returning\n/// a `Some(T)` from this function changes the value of the characteristic before the controller reads it so the\n/// controller reads the new value.\npub trait OnReadFuture<T: Default + Clone + Serialize + Send + Sync>:\n    FnMut() -> BoxFuture<'static, std::result::Result<Option<T>, Box<dyn std::error::Error + Send + Sync>>>\n    + 'static\n    + Send\n    + Sync\n{\n}\nimpl<F, T: Default + Clone + Serialize + Send + Sync> OnReadFuture<T> for F where\n    F: FnMut() -> BoxFuture<'static, std::result::Result<Option<T>, Box<dyn std::error::Error + Send + Sync>>>\n        + 'static\n        + Send\n        + Sync\n{\n}\n\n/// [`OnUpdateFuture`](OnUpdateFuture) represents an async callback function to be set on a characteristic that is\n/// driven to completion by the async runtime driving the HAP server every time a controller attempts to update its\n/// value. The first argument is a reference to the current value of the characteristic and the second argument is a\n/// reference to the value the controller attempts to change the characteristic's to.\npub trait OnUpdateFuture<T: Default + Clone + Serialize + Send + Sync>:\n    FnMut(T, T) -> BoxFuture<'static, std::result::Result<(), Box<dyn std::error::Error + Send + Sync>>>\n    + 'static\n    + Send\n    + Sync\n{\n}\nimpl<F, T: Default + Clone + Serialize + Send + Sync> OnUpdateFuture<T> for F where\n    F: FnMut(T, T) -> BoxFuture<'static, std::result::Result<(), Box<dyn std::error::Error + Send + Sync>>>\n        + 'static\n        + Send\n        + Sync\n{\n}\n\n/// Trait containing the [`OnReadFn`](OnReadFn) and [`OnUpdateFn`](OnUpdateFn) callback functions.\npub trait CharacteristicCallbacks<T: fmt::Debug + Default + Clone + Serialize + Send + Sync> {\n    /// Sets a callback function on a characteristic that is called every time a controller attempts to read its value.\n    /// Returning a `Some(T)` from this function changes the value of the characteristic before the controller reads\n    /// it so the controller reads the new value.\n    fn on_read(&mut self, f: Option<impl OnReadFn<T>>);\n    /// Sets a callback function on a characteristic that is called every time a controller attempts to update its\n    /// value. The first argument is a reference to the current value of the characteristic and the second argument is a\n    /// reference to the value the controller attempts to change the characteristic's to.\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<T>>);\n}\n\n/// Trait containing the [`OnReadFuture`](OnReadFuture) and [`OnUpdateFuture`](OnUpdateFuture) callback functions.\npub trait AsyncCharacteristicCallbacks<T: fmt::Debug + Default + Clone + Serialize + Send + Sync> {\n    /// Sets an async callback function on a characteristic that is driven to completion by the async runtime driving\n    /// the HAP server every time a controller attempts to read its value. Returning a `Some(T)` from this function\n    /// changes the value of the characteristic before the controller reads it so the controller reads the new value.\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<T>>);\n    /// Sets an async callback function on a characteristic that is driven to completion by the async runtime driving\n    /// the HAP server every time a controller attempts to update its value. The first argument is a reference to the\n    /// current value of the characteristic and the second argument is a reference to the value the controller attempts\n    /// to change the characteristic's to.\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<T>>);\n}\n\n#[async_trait]\nimpl<T: fmt::Debug + Default + Clone + Serialize + Send + Sync> HapCharacteristic for Characteristic<T>\nwhere\n    for<'de> T: Deserialize<'de>,\n{\n    fn get_id(&self) -> u64 { Characteristic::get_id(self) }\n\n    fn set_id(&mut self, id: u64) { Characteristic::set_id(self, id) }\n\n    fn get_type(&self) -> HapType { Characteristic::get_type(self) }\n\n    fn set_type(&mut self, hap_type: HapType) { Characteristic::set_type(self, hap_type) }\n\n    fn get_format(&self) -> Format { Characteristic::get_format(self) }\n\n    fn set_format(&mut self, format: Format) { Characteristic::set_format(self, format) }\n\n    fn get_perms(&self) -> Vec<Perm> { Characteristic::get_perms(self) }\n\n    fn set_perms(&mut self, perms: Vec<Perm>) { Characteristic::set_perms(self, perms) }\n\n    fn get_description(&self) -> Option<String> { Characteristic::get_description(self) }\n\n    fn set_description(&mut self, description: Option<String>) { Characteristic::set_description(self, description) }\n\n    fn get_event_notifications(&self) -> Option<bool> { Characteristic::get_event_notifications(self) }\n\n    fn set_event_notifications(&mut self, event_notifications: Option<bool>) {\n        Characteristic::set_event_notifications(self, event_notifications)\n    }\n\n    async fn get_value(&mut self) -> Result<serde_json::Value> {\n        let value = Characteristic::get_value(self).await?;\n        Ok(json!(value))\n    }\n\n    async fn set_value(&mut self, value: serde_json::Value) -> Result<()> {\n        let v;\n        // for whatever reason, the controller is setting boolean values either as a boolean or as an integer\n        if self.format == Format::Bool && value.is_number() {\n            let num_v: u8 = serde_json::from_value(value)?;\n            if num_v == 0 {\n                v = serde_json::from_value(json!(false))?;\n            } else if num_v == 1 {\n                v = serde_json::from_value(json!(true))?;\n            } else {\n                return Err(Error::InvalidValue(Characteristic::get_format(self)));\n            }\n        } else {\n            v = serde_json::from_value(value).map_err(|_| Error::InvalidValue(Characteristic::get_format(self)))?;\n        }\n        Characteristic::set_value(self, v).await\n    }\n\n    fn get_unit(&self) -> Option<Unit> { Characteristic::get_unit(self) }\n\n    fn set_unit(&mut self, unit: Option<Unit>) { Characteristic::set_unit(self, unit) }\n\n    fn get_max_value(&self) -> Option<serde_json::Value> { Characteristic::get_max_value(self).map(|v| json!(v)) }\n\n    fn set_max_value(&mut self, max_value: Option<serde_json::Value>) -> Result<()> {\n        Characteristic::set_max_value(self, match max_value {\n            Some(v) =>\n                Some(serde_json::from_value(v).map_err(|_| Error::InvalidValue(Characteristic::get_format(self)))?),\n            None => None,\n        });\n\n        Ok(())\n    }\n\n    fn get_min_value(&self) -> Option<serde_json::Value> { Characteristic::get_min_value(self).map(|v| json!(v)) }\n\n    fn set_min_value(&mut self, min_value: Option<serde_json::Value>) -> Result<()> {\n        Characteristic::set_min_value(self, match min_value {\n            Some(v) =>\n                Some(serde_json::from_value(v).map_err(|_| Error::InvalidValue(Characteristic::get_format(self)))?),\n            None => None,\n        });\n\n        Ok(())\n    }\n\n    fn get_step_value(&self) -> Option<serde_json::Value> { Characteristic::get_step_value(self).map(|v| json!(v)) }\n\n    fn set_step_value(&mut self, step_value: Option<serde_json::Value>) -> Result<()> {\n        Characteristic::set_step_value(self, match step_value {\n            Some(v) =>\n                Some(serde_json::from_value(v).map_err(|_| Error::InvalidValue(Characteristic::get_format(self)))?),\n            None => None,\n        });\n\n        Ok(())\n    }\n\n    fn get_max_len(&self) -> Option<u16> { Characteristic::get_max_len(self) }\n\n    fn set_max_len(&mut self, max_len: Option<u16>) { Characteristic::set_max_len(self, max_len) }\n\n    fn get_max_data_len(&self) -> Option<u32> { Characteristic::get_max_data_len(self) }\n\n    fn set_max_data_len(&mut self, max_data_len: Option<u32>) { Characteristic::set_max_data_len(self, max_data_len) }\n\n    fn get_valid_values(&self) -> Option<Vec<serde_json::Value>> {\n        Characteristic::get_valid_values(self).map(|v| v.into_iter().map(|v| json!(v)).collect())\n    }\n\n    fn set_valid_values(&mut self, valid_values: Option<Vec<serde_json::Value>>) -> Result<()> {\n        Characteristic::set_valid_values(self, match valid_values {\n            Some(v) => Some(\n                v.into_iter()\n                    .map(|v| {\n                        serde_json::from_value(v).map_err(|_| Error::InvalidValue(Characteristic::get_format(self)))\n                    })\n                    .collect::<Result<Vec<T>>>()?,\n            ),\n            None => None,\n        });\n\n        Ok(())\n    }\n\n    fn get_valid_values_range(&self) -> Option<[serde_json::Value; 2]> {\n        Characteristic::get_valid_values_range(self).map(|v| [json!(v[0]), json!(v[1])])\n    }\n\n    fn set_valid_values_range(&mut self, valid_values_range: Option<[serde_json::Value; 2]>) -> Result<()> {\n        Characteristic::set_valid_values_range(self, match valid_values_range {\n            Some([start, end]) => Some(Result::<[T; 2]>::Ok([\n                serde_json::from_value(start).map_err(|_| Error::InvalidValue(Characteristic::get_format(self)))?,\n                serde_json::from_value(end).map_err(|_| Error::InvalidValue(Characteristic::get_format(self)))?,\n            ])?),\n            None => None,\n        });\n\n        Ok(())\n    }\n\n    fn get_ttl(&self) -> Option<u64> { Characteristic::get_ttl(self) }\n\n    fn set_ttl(&mut self, ttl: Option<u64>) { Characteristic::set_ttl(self, ttl) }\n\n    fn get_pid(&self) -> Option<u64> { Characteristic::get_pid(self) }\n\n    fn set_pid(&mut self, pid: Option<u64>) { Characteristic::set_pid(self, pid) }\n}\n\nimpl<T: fmt::Debug + Default + Clone + Serialize + Send + Sync> HapCharacteristicSetup for Characteristic<T>\nwhere\n    for<'de> T: Deserialize<'de>,\n{\n    fn set_event_emitter(&mut self, event_emitter: Option<pointer::EventEmitter>) {\n        Characteristic::set_event_emitter(self, event_emitter)\n    }\n}\n\nimpl<T: fmt::Debug + Default + Clone + Serialize + Send + Sync> CharacteristicCallbacks<T> for Characteristic<T>\nwhere\n    for<'de> T: Deserialize<'de>,\n{\n    fn on_read(&mut self, f: Option<impl OnReadFn<T>>) { Characteristic::on_read(self, f) }\n\n    fn on_update(&mut self, f: Option<impl OnUpdateFn<T>>) { Characteristic::on_update(self, f) }\n}\n\nimpl<T: fmt::Debug + Default + Clone + Serialize + Send + Sync> AsyncCharacteristicCallbacks<T> for Characteristic<T>\nwhere\n    for<'de> T: Deserialize<'de>,\n{\n    fn on_read_async(&mut self, f: Option<impl OnReadFuture<T>>) { Characteristic::on_read_async(self, f) }\n\n    fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<T>>) { Characteristic::on_update_async(self, f) }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn test_json_serialization() {\n        let characteristic = Characteristic::<u16> {\n            id: 1,\n            accessory_id: 1,\n            hap_type: HapType::CurrentTiltAngle,\n            format: Format::UInt16,\n            perms: vec![Perm::PairedRead, Perm::Events],\n            description: Some(\"Acme Tilt Angle\".into()),\n            event_notifications: Some(true),\n\n            value: 123,\n            unit: Some(Unit::ArcDegrees),\n\n            max_value: Some(360),\n            min_value: Some(0),\n            step_value: Some(1),\n            max_len: None,\n            max_data_len: None,\n            valid_values: None,\n            valid_values_range: Some([0, 360]),\n\n            ttl: None,\n            pid: None,\n\n            on_read: None,\n            on_update: None,\n            on_read_async: None,\n            on_update_async: None,\n\n            event_emitter: None,\n        };\n        let json = serde_json::to_string(&characteristic).unwrap();\n        assert_eq!(json, \"{\\\"iid\\\":1,\\\"type\\\":\\\"C1\\\",\\\"format\\\":\\\"uint16\\\",\\\"perms\\\":[\\\"pr\\\",\\\"ev\\\"],\\\"description\\\":\\\"Acme Tilt Angle\\\",\\\"ev\\\":true,\\\"value\\\":123,\\\"unit\\\":\\\"arcdegrees\\\",\\\"maxValue\\\":360,\\\"minValue\\\":0,\\\"minStep\\\":1,\\\"valid-values-range\\\":[0,360]}\".to_string());\n    }\n}\n"
  },
  {
    "path": "src/config.rs",
    "content": "use ed25519_dalek::Keypair as Ed25519Keypair;\n//use eui48::MacAddress;\nuse macaddr::MacAddr6 as MacAddress;\nuse rand::{rngs::OsRng, Rng};\nuse serde::{Deserialize, Serialize};\nuse std::net::IpAddr;\n\nuse crate::{accessory::AccessoryCategory, BonjourFeatureFlag, BonjourStatusFlag, Pin};\n\n/// The `Config` struct is used to store configuration options for the HomeKit Accessory Server.\n///\n/// # Examples\n///\n/// ```\n/// use hap::{accessory::AccessoryCategory, Config, MacAddress, Pin};\n///\n/// let config = Config {\n///     pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3]).unwrap(),\n///     name: \"Acme Lightbulb\".into(),\n///     device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n///     category: AccessoryCategory::Lightbulb,\n///     ..Default::default()\n/// };\n/// ```\n#[derive(Debug, Serialize, Deserialize)]\npub struct Config {\n    /// Socket IP address to serve on. Defaults to the IP of the system's first non-loopback network interface.\n    pub host: IpAddr,\n    /// Port to serve on. Defaults to `32000`.\n    pub port: u16,\n    /// 8 digit pin used for pairing. Defaults to `11122333`.\n    ///\n    /// The following pins are considered too easy and are therefore not allowed:\n    /// - `12345678`\n    /// - `87654321`\n    /// - `00000000`\n    /// - `11111111`\n    /// - `22222222`\n    /// - `33333333`\n    /// - `44444444`\n    /// - `55555555`\n    /// - `66666666`\n    /// - `77777777`\n    /// - `88888888`\n    /// - `99999999`\n    pub pin: Pin,\n    /// Model name of the accessory. E.g. \"Acme Lightbulb\".\n    pub name: String,\n    /// Device ID of the accessory. Generated randomly if not specified. This value is also used as the accessory's\n    /// Pairing Identifier. Must be a unique random number generated at every factory reset and must persist across\n    /// reboots.\n    pub device_id: MacAddress, // Bonjour: id\n    ///\n    pub device_ed25519_keypair: Ed25519Keypair,\n    /// Current configuration number. Is updated when an accessory, service, or characteristic is added or removed on\n    /// the accessory server. Accessories must increment the config number after a firmware update.\n    pub configuration_number: u64, // Bonjour: c#\n    /// Current state number. This must have a value of `1`.\n    pub state_number: u8, // Bonjour: s#\n    /// Accessory category. Indicates the category that best describes the primary function of the accessory.\n    pub category: AccessoryCategory, // Bonjour: ci\n    /// Protocol version string `<major>.<minor>` (e.g. `\"1.0\"`). Defaults to `\"1.0\"` Required if value is not `\"1.0\"`.\n    pub protocol_version: String, // Bonjour: pv\n    /// Bonjour Status Flag. Defaults to `StatusFlag::NotPaired` and is changed to `StatusFlag::Zero` after a\n    /// successful pairing.\n    pub status_flag: BonjourStatusFlag, // Bonjour: sf\n    /// Bonjour Feature Flag. Currently only used to indicate MFi compliance.\n    pub feature_flag: BonjourFeatureFlag, // Bonjour: ff\n    /// Optional maximum number of paired controllers.\n    pub max_peers: Option<usize>,\n}\n\nimpl Config {\n    /// Redetermines the `host` field to the IP of the system's first non-loopback network interface.\n    pub fn redetermine_local_ip(&mut self) { self.host = get_local_ip(); }\n\n    /// Derives mDNS TXT records from the `Config`.\n    pub(crate) fn txt_records(&self) -> [String; 8] {\n        [\n            format!(\"c#={}\", self.configuration_number),\n            format!(\"ff={}\", self.feature_flag as u8),\n            format!(\"id={}\", self.device_id.to_string()),\n            format!(\"md={}\", self.name),\n            format!(\"pv={}\", self.protocol_version),\n            format!(\"s#={}\", self.state_number),\n            format!(\"sf={}\", self.status_flag as u8),\n            format!(\"ci={}\", self.category as u8),\n            // format!(\"sh={}\", self.setup_hash as u8), setup hash seems to be still undocumented\n        ]\n    }\n}\n\nimpl Default for Config {\n    fn default() -> Config {\n        Config {\n            host: get_local_ip(),\n            port: 32000,\n            pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3]).unwrap(),\n            name: \"Accessory\".into(),\n            device_id: generate_random_mac_address(),\n            device_ed25519_keypair: generate_ed25519_keypair(),\n            configuration_number: 1,\n            state_number: 1,\n            category: AccessoryCategory::Other,\n            protocol_version: \"1.0\".into(),\n            status_flag: BonjourStatusFlag::NotPaired,\n            feature_flag: BonjourFeatureFlag::Zero,\n            max_peers: None,\n        }\n    }\n}\n\n/// Generates a random MAC address.\nfn generate_random_mac_address() -> MacAddress {\n    let mut csprng = OsRng {};\n    let eui = csprng.gen::<[u8; 6]>();\n    MacAddress::from(eui)\n}\n\n/// Generates an Ed25519 keypair.\nfn generate_ed25519_keypair() -> Ed25519Keypair {\n    let mut csprng = OsRng {};\n    Ed25519Keypair::generate(&mut csprng)\n}\n\n/// Returns the IP of the system's first non-loopback network interface or defaults to `127.0.0.1`.\nfn get_local_ip() -> IpAddr {\n    for iface in get_if_addrs::get_if_addrs().unwrap() {\n        if !iface.is_loopback() {\n            return iface.ip();\n        }\n    }\n    \"127.0.0.1\".parse().unwrap()\n}\n"
  },
  {
    "path": "src/error.rs",
    "content": "use std::{io, num, str, sync::mpsc};\nuse thiserror::Error;\n\nuse crate::characteristic::Format;\n\n/// HAP error representation.\n#[derive(Debug, Error)]\npub enum Error {\n    // custom errors\n    #[error(\"The PIN is too easy. The following PINs are not allowed: []\")]\n    PinTooEasy,\n    #[error(\"The PIN contains invalid digits. You may only use numbers from 0 to 9.\")]\n    InvalidPin,\n    #[error(\n        \"Invalid pairing permission Byte: {0}. Only `Permissions::User = 0x00` and `Permissions::Admin = 0x01` are allowed.\"\n    )]\n    InvalidPairingPermission(u8),\n    #[error(\"The value is below the `min_value` of the characteristic.\")]\n    ValueBelowMinValue,\n    #[error(\"The value is above the `max_value` of the characteristic.\")]\n    ValueAboveMaxValue,\n    #[error(\"The selected accessory is not present on the server.\")]\n    AccessoryNotFound,\n    #[error(\"The provided accessory was already added to the server.\")]\n    DuplicateAccessory,\n    #[error(\n        \"The provided value has an invalid data type for the characteristic. The characteristic's format is {0:?}.\"\n    )]\n    InvalidValue(Format),\n    #[error(\"Invalid HapType string value: `{0}`.\")]\n    InvalidHapTypeString(String),\n    #[error(\"Error on value read: {0}\")]\n    ValueOnRead(Box<dyn std::error::Error + Send + Sync>),\n    #[error(\"Error on value update: {0}\")]\n    ValueOnUpdate(Box<dyn std::error::Error + Send + Sync>),\n    #[error(\"Error interacting with the storage.\")]\n    Storage,\n\n    // converted errors\n    #[error(\"IO Error: {0}\")]\n    Io(#[from] io::Error),\n    #[error(\"Serde JSON Error: {0}\")]\n    Json(#[from] serde_json::Error),\n    #[error(\"HTTP Status Code: {0}\")]\n    HttpStatus(hyper::StatusCode),\n    #[error(\"Hyper HTTP Error: {0}\")]\n    Http(#[from] hyper::http::Error),\n    #[error(\"Hyper Error: {0}\")]\n    Hyper(#[from] hyper::Error),\n    #[error(\"Task Join Error: {0}\")]\n    TaskJoin(#[from] tokio::task::JoinError),\n    #[error(\"AEAD Error\")]\n    Aead,\n    #[error(\"HKDF Invalid Length Error\")]\n    HkdfInvalidLength,\n    #[error(\"UTF-8 Error: {0}\")]\n    Utf8(#[from] str::Utf8Error),\n    #[error(\"Parse EUI-48 Error: {0}\")]\n    ParseEui48(#[from] macaddr::ParseError),\n    #[error(\"Parse Int Error: {0}\")]\n    ParseInt(#[from] num::ParseIntError),\n    #[error(\"MPSC Send Error: {0}\")]\n    MpscSend(#[from] mpsc::SendError<()>),\n}\n\nimpl From<aead::Error> for Error {\n    fn from(_: aead::Error) -> Self { Error::Aead }\n}\n"
  },
  {
    "path": "src/event.rs",
    "content": "use futures::future::{join_all, BoxFuture};\nuse log::debug;\nuse serde_json::Value;\nuse std::fmt::Debug;\nuse uuid::Uuid;\n\n#[derive(Debug)]\npub enum Event {\n    ControllerPaired { id: Uuid },\n    ControllerUnpaired { id: Uuid },\n    CharacteristicValueChanged { aid: u64, iid: u64, value: Value },\n}\n\n#[derive(Default)]\npub struct EventEmitter {\n    listeners: Vec<Box<dyn (Fn(&Event) -> BoxFuture<()>) + Send + Sync>>,\n}\n\nimpl EventEmitter {\n    pub fn new() -> EventEmitter { EventEmitter { listeners: vec![] } }\n\n    pub fn add_listener(&mut self, listener: Box<dyn (Fn(&Event) -> BoxFuture<()>) + Send + Sync>) {\n        self.listeners.push(listener);\n    }\n\n    pub async fn emit(&self, event: &Event) {\n        debug!(\"emitting event: {:?}\", event);\n\n        join_all(self.listeners.iter().map(|listener| listener(&event))).await;\n    }\n}\n"
  },
  {
    "path": "src/hap_type.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::{\n    de::{self, Deserialize, Deserializer},\n    ser::{Serialize, Serializer},\n};\nuse std::str::FromStr;\nuse uuid::Uuid;\n\nuse crate::Error;\n\n/// HAP service and characteristic type representation.\n#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]\npub enum HapType {\n    Unknown,\n    Custom(Uuid),\n\tAccessCodeControlPoint,\n\tAccessCodeSupportedConfiguration,\n\tAccessControlLevel,\n\tAccessoryFlags,\n\tAccessoryIdentifier,\n\tActive,\n\tActiveIdentifier,\n\tActivityInterval,\n\tAdministratorOnlyAccess,\n\tAirParticulateDensity,\n\tAirParticulateSize,\n\tAirplayEnable,\n\tApplicationMatchingIdentifier,\n\tAssetUpdateReadiness,\n\tAudioFeedback,\n\tBatteryLevel,\n\tBrightness,\n\tButtonEvent,\n\tCcaEnergyDetectThreshold,\n\tCcaSignalDetectThreshold,\n\tCameraOperatingModeIndicator,\n\tCarbonDioxideDetected,\n\tCarbonDioxideLevel,\n\tCarbonDioxidePeakLevel,\n\tCarbonMonoxideDetected,\n\tCarbonMonoxideLevel,\n\tCarbonMonoxidePeakLevel,\n\tCharacteristicValueActiveTransitionCount,\n\tCharacteristicValueTransitionControl,\n\tChargingState,\n\tClosedCaptions,\n\tCloudRelayControlPoint,\n\tCloudRelayCurrentState,\n\tCloudRelayEnableStatus,\n\tColorTemperature,\n\tConfigurationState,\n\tConfiguredName,\n\tContactSensorState,\n\tCoolingThresholdTemperature,\n\tCurrentAirPurifierState,\n\tCurrentAirQuality,\n\tCurrentDoorState,\n\tCurrentFanState,\n\tCurrentHeaterCoolerState,\n\tCurrentHeatingCoolingState,\n\tCurrentHorizontalTiltAngle,\n\tCurrentHumidifierDehumidifierState,\n\tCurrentLightLevel,\n\tCurrentMediaState,\n\tCurrentPosition,\n\tCurrentRelativeHumidity,\n\tCurrentSlatState,\n\tCurrentTemperature,\n\tCurrentTiltAngle,\n\tCurrentTransport,\n\tCurrentVerticalTiltAngle,\n\tCurrentVisibilityState,\n\tCurrentWaterLevel,\n\tDataStreamHapTransport,\n\tDataStreamHapTransportInterrupt,\n\tDigitalZoom,\n\tDisplayOrder,\n\tEventRetransmissionMaximum,\n\tEventSnapshotsActive,\n\tEventTransmissionCounters,\n\tFilterChangeIndication,\n\tFilterLifeLevel,\n\tFilterResetChangeIndication,\n\tFirmwareRevision,\n\tFirmwareUpdateReadiness,\n\tFirmwareUpdateStatus,\n\tHardwareFinish,\n\tHardwareRevision,\n\tHeartBeat,\n\tHeatingThresholdTemperature,\n\tHoldPosition,\n\tHomekitCameraActive,\n\tHue,\n\tIdentifier,\n\tIdentify,\n\tImageMirroring,\n\tImageRotation,\n\tInUse,\n\tInputDeviceType,\n\tInputSourceType,\n\tIsConfigured,\n\tLabelIndex,\n\tLabelNamespace,\n\tLeakDetected,\n\tListPairings,\n\tLockControlPoint,\n\tLockCurrentState,\n\tLockLastKnownAction,\n\tLockManagementAutoSecurityTimeout,\n\tLockPhysicalControls,\n\tLockTargetState,\n\tLogs,\n\tMacRetransmissionMaximum,\n\tMacTransmissionCounters,\n\tManagedNetworkEnable,\n\tManuallyDisabled,\n\tManufacturer,\n\tMaximumTransmitPower,\n\tModel,\n\tMotionDetected,\n\tMultifunctionButton,\n\tMute,\n\tNfcAccessControlPoint,\n\tNfcAccessSupportedConfiguration,\n\tName,\n\tNetworkAccessViolationControl,\n\tNetworkClientControl,\n\tNetworkClientStatusControl,\n\tNightVision,\n\tNitrogenDioxideDensity,\n\tObstructionDetected,\n\tOccupancyDetected,\n\tOperatingStateResponse,\n\tOpticalZoom,\n\tOutletInUse,\n\tOzoneDensity,\n\tPm10Density,\n\tPm2_5Density,\n\tPairSetup,\n\tPairVerify,\n\tPairingFeatures,\n\tPasswordSetting,\n\tPeriodicSnapshotsActive,\n\tPictureMode,\n\tPing,\n\tPositionState,\n\tPowerModeSelection,\n\tPowerState,\n\tProductData,\n\tProgramMode,\n\tProgrammableSwitchEvent,\n\tProgrammableSwitchOutputState,\n\tReceivedSignalStrengthIndication,\n\tReceiverSensitivity,\n\tRelativeHumidityDehumidifierThreshold,\n\tRelativeHumidityHumidifierThreshold,\n\tRemainingDuration,\n\tRemoteKey,\n\tRotationDirection,\n\tRotationSpeed,\n\tRouterStatus,\n\tSaturation,\n\tSecuritySystemAlarmType,\n\tSecuritySystemCurrentState,\n\tSecuritySystemTargetState,\n\tSelectedAudioStreamConfiguration,\n\tSelectedCameraRecordingConfiguration,\n\tSelectedDiagnosticsModes,\n\tSelectedStreamConfiguration,\n\tSerialNumber,\n\tServiceSignature,\n\tSetDuration,\n\tSetupDataStreamTransport,\n\tSetupEndpoint,\n\tSetupTransferTransport,\n\tSignalToNoiseRatio,\n\tSiriEnable,\n\tSiriEndpointSessionStatus,\n\tSiriEngineVersion,\n\tSiriInputType,\n\tSiriLightOnUse,\n\tSiriListening,\n\tSiriTouchToUse,\n\tSlatType,\n\tSleepDiscoveryMode,\n\tSleepInterval,\n\tSmokeDetected,\n\tSoftwareRevision,\n\tStagedFirmwareVersion,\n\tStatusActive,\n\tStatusFault,\n\tStatusJammed,\n\tStatusLowBattery,\n\tStatusTampered,\n\tStreamingStatus,\n\tSulphurDioxideDensity,\n\tSupportedAssetTypes,\n\tSupportedAudioRecordingConfiguration,\n\tSupportedAudioStreamConfiguration,\n\tSupportedCameraRecordingConfiguration,\n\tSupportedCharacteristicValueTransitionConfiguration,\n\tSupportedDataStreamTransportConfiguration,\n\tSupportedDiagnosticsModes,\n\tSupportedDiagnosticsSnapshot,\n\tSupportedFirmwareUpdateConfiguration,\n\tSupportedRtpConfiguration,\n\tSupportedRouterConfiguration,\n\tSupportedTargetConfiguration,\n\tSupportedTransferTransportConfiguration,\n\tSupportedVideoRecordingConfiguration,\n\tSupportedVideoStreamConfiguration,\n\tSwingMode,\n\tTargetAirPurifierState,\n\tTargetDoorState,\n\tTargetFanState,\n\tTargetHeaterCoolerState,\n\tTargetHeatingCoolingState,\n\tTargetHorizontalTiltAngle,\n\tTargetHumidifierDehumidifierState,\n\tTargetListConfiguration,\n\tTargetMediaState,\n\tTargetPosition,\n\tTargetRelativeHumidity,\n\tTargetTemperature,\n\tTargetTiltAngle,\n\tTargetVerticalTiltAngle,\n\tTargetVisibilityState,\n\tTemperatureDisplayUnits,\n\tThirdPartyCameraActive,\n\tThreadControlPoint,\n\tThreadNodeCapabilities,\n\tThreadOpenthreadVersion,\n\tThreadStatus,\n\tTransmitPower,\n\tValveType,\n\tVersion,\n\tVideoAnalysisActive,\n\tVolatileOrganicCompoundDensity,\n\tVolume,\n\tVolumeControlType,\n\tVolumeSelector,\n\tWanConfigurationList,\n\tWanStatusList,\n\tWakeConfiguration,\n\tWiFiCapabilities,\n\tWiFiConfigurationControl,\n\tWiFiSatelliteStatus,\n\tRecordingAudioActive,\n\tAccessCode,\n\tAccessControl,\n\tAccessoryInformation,\n\tAccessoryMetrics,\n\tAccessoryRuntimeInformation,\n\tAirPurifier,\n\tAirQualitySensor,\n\tAssetUpdate,\n\tAssistant,\n\tAudioStreamManagement,\n\tBattery,\n\tCameraOperatingMode,\n\tCameraRecordingManagement,\n\tCameraStreamManagement,\n\tCarbonDioxideSensor,\n\tCarbonMonoxideSensor,\n\tCloudRelay,\n\tContactSensor,\n\tDataStreamTransportManagement,\n\tDiagnostics,\n\tDoor,\n\tDoorbell,\n\tFan,\n\tFanV2,\n\tFaucet,\n\tFilterMaintenance,\n\tGarageDoorOpener,\n\tHeaterCooler,\n\tHumidifierDehumidifier,\n\tHumiditySensor,\n\tInputSource,\n\tIrrigationSystem,\n\tLabel,\n\tLeakSensor,\n\tLightSensor,\n\tLightbulb,\n\tLockManagement,\n\tLockMechanism,\n\tMicrophone,\n\tMotionSensor,\n\tNfcAccessService,\n\tOccupancySensor,\n\tOutlet,\n\tPairing,\n\tPowerManagement,\n\tProtocolInformation,\n\tSecuritySystem,\n\tSiri,\n\tSiriEndpoint,\n\tSlats,\n\tSmartSpeaker,\n\tSmokeSensor,\n\tSpeaker,\n\tStatefulProgrammableSwitch,\n\tStatelessProgrammableSwitch,\n\tSwitch,\n\tTargetControl,\n\tTargetControlManagement,\n\tTelevision,\n\tTemperatureSensor,\n\tThermostat,\n\tThreadTransport,\n\tTransferTransportManagement,\n\tValve,\n\tWiFiRouter,\n\tWiFiSatellite,\n\tWiFiTransport,\n\tWindow,\n\tWindowCovering,\n}\n\nimpl ToString for HapType {\n    fn to_string(&self) -> String {\n        match self {\n            HapType::Unknown => \"unknown\".into(),\n            HapType::Custom(uuid) => uuid.to_hyphenated().to_string(),\n\t\t\tHapType::AccessCodeControlPoint => \"262\".into(),\n\t\t\tHapType::AccessCodeSupportedConfiguration => \"261\".into(),\n\t\t\tHapType::AccessControlLevel => \"E5\".into(),\n\t\t\tHapType::AccessoryFlags => \"A6\".into(),\n\t\t\tHapType::AccessoryIdentifier => \"57\".into(),\n\t\t\tHapType::Active => \"B0\".into(),\n\t\t\tHapType::ActiveIdentifier => \"E7\".into(),\n\t\t\tHapType::ActivityInterval => \"23B\".into(),\n\t\t\tHapType::AdministratorOnlyAccess => \"1\".into(),\n\t\t\tHapType::AirParticulateDensity => \"64\".into(),\n\t\t\tHapType::AirParticulateSize => \"65\".into(),\n\t\t\tHapType::AirplayEnable => \"25B\".into(),\n\t\t\tHapType::ApplicationMatchingIdentifier => \"A4\".into(),\n\t\t\tHapType::AssetUpdateReadiness => \"269\".into(),\n\t\t\tHapType::AudioFeedback => \"5\".into(),\n\t\t\tHapType::BatteryLevel => \"68\".into(),\n\t\t\tHapType::Brightness => \"8\".into(),\n\t\t\tHapType::ButtonEvent => \"126\".into(),\n\t\t\tHapType::CcaEnergyDetectThreshold => \"246\".into(),\n\t\t\tHapType::CcaSignalDetectThreshold => \"245\".into(),\n\t\t\tHapType::CameraOperatingModeIndicator => \"21D\".into(),\n\t\t\tHapType::CarbonDioxideDetected => \"92\".into(),\n\t\t\tHapType::CarbonDioxideLevel => \"93\".into(),\n\t\t\tHapType::CarbonDioxidePeakLevel => \"94\".into(),\n\t\t\tHapType::CarbonMonoxideDetected => \"69\".into(),\n\t\t\tHapType::CarbonMonoxideLevel => \"90\".into(),\n\t\t\tHapType::CarbonMonoxidePeakLevel => \"91\".into(),\n\t\t\tHapType::CharacteristicValueActiveTransitionCount => \"24B\".into(),\n\t\t\tHapType::CharacteristicValueTransitionControl => \"143\".into(),\n\t\t\tHapType::ChargingState => \"8F\".into(),\n\t\t\tHapType::ClosedCaptions => \"DD\".into(),\n\t\t\tHapType::CloudRelayControlPoint => \"5E\".into(),\n\t\t\tHapType::CloudRelayCurrentState => \"5C\".into(),\n\t\t\tHapType::CloudRelayEnableStatus => \"5B\".into(),\n\t\t\tHapType::ColorTemperature => \"CE\".into(),\n\t\t\tHapType::ConfigurationState => \"263\".into(),\n\t\t\tHapType::ConfiguredName => \"E3\".into(),\n\t\t\tHapType::ContactSensorState => \"6A\".into(),\n\t\t\tHapType::CoolingThresholdTemperature => \"D\".into(),\n\t\t\tHapType::CurrentAirPurifierState => \"A9\".into(),\n\t\t\tHapType::CurrentAirQuality => \"95\".into(),\n\t\t\tHapType::CurrentDoorState => \"E\".into(),\n\t\t\tHapType::CurrentFanState => \"AF\".into(),\n\t\t\tHapType::CurrentHeaterCoolerState => \"B1\".into(),\n\t\t\tHapType::CurrentHeatingCoolingState => \"F\".into(),\n\t\t\tHapType::CurrentHorizontalTiltAngle => \"6C\".into(),\n\t\t\tHapType::CurrentHumidifierDehumidifierState => \"B3\".into(),\n\t\t\tHapType::CurrentLightLevel => \"6B\".into(),\n\t\t\tHapType::CurrentMediaState => \"E0\".into(),\n\t\t\tHapType::CurrentPosition => \"6D\".into(),\n\t\t\tHapType::CurrentRelativeHumidity => \"10\".into(),\n\t\t\tHapType::CurrentSlatState => \"AA\".into(),\n\t\t\tHapType::CurrentTemperature => \"11\".into(),\n\t\t\tHapType::CurrentTiltAngle => \"C1\".into(),\n\t\t\tHapType::CurrentTransport => \"22B\".into(),\n\t\t\tHapType::CurrentVerticalTiltAngle => \"6E\".into(),\n\t\t\tHapType::CurrentVisibilityState => \"135\".into(),\n\t\t\tHapType::CurrentWaterLevel => \"B5\".into(),\n\t\t\tHapType::DataStreamHapTransport => \"138\".into(),\n\t\t\tHapType::DataStreamHapTransportInterrupt => \"139\".into(),\n\t\t\tHapType::DigitalZoom => \"11D\".into(),\n\t\t\tHapType::DisplayOrder => \"136\".into(),\n\t\t\tHapType::EventRetransmissionMaximum => \"23D\".into(),\n\t\t\tHapType::EventSnapshotsActive => \"223\".into(),\n\t\t\tHapType::EventTransmissionCounters => \"23E\".into(),\n\t\t\tHapType::FilterChangeIndication => \"AC\".into(),\n\t\t\tHapType::FilterLifeLevel => \"AB\".into(),\n\t\t\tHapType::FilterResetChangeIndication => \"AD\".into(),\n\t\t\tHapType::FirmwareRevision => \"52\".into(),\n\t\t\tHapType::FirmwareUpdateReadiness => \"234\".into(),\n\t\t\tHapType::FirmwareUpdateStatus => \"235\".into(),\n\t\t\tHapType::HardwareFinish => \"26C\".into(),\n\t\t\tHapType::HardwareRevision => \"53\".into(),\n\t\t\tHapType::HeartBeat => \"24A\".into(),\n\t\t\tHapType::HeatingThresholdTemperature => \"12\".into(),\n\t\t\tHapType::HoldPosition => \"6F\".into(),\n\t\t\tHapType::HomekitCameraActive => \"21B\".into(),\n\t\t\tHapType::Hue => \"13\".into(),\n\t\t\tHapType::Identifier => \"E6\".into(),\n\t\t\tHapType::Identify => \"14\".into(),\n\t\t\tHapType::ImageMirroring => \"11F\".into(),\n\t\t\tHapType::ImageRotation => \"11E\".into(),\n\t\t\tHapType::InUse => \"D2\".into(),\n\t\t\tHapType::InputDeviceType => \"DC\".into(),\n\t\t\tHapType::InputSourceType => \"DB\".into(),\n\t\t\tHapType::IsConfigured => \"D6\".into(),\n\t\t\tHapType::LabelIndex => \"CB\".into(),\n\t\t\tHapType::LabelNamespace => \"CD\".into(),\n\t\t\tHapType::LeakDetected => \"70\".into(),\n\t\t\tHapType::ListPairings => \"50\".into(),\n\t\t\tHapType::LockControlPoint => \"19\".into(),\n\t\t\tHapType::LockCurrentState => \"1D\".into(),\n\t\t\tHapType::LockLastKnownAction => \"1C\".into(),\n\t\t\tHapType::LockManagementAutoSecurityTimeout => \"1A\".into(),\n\t\t\tHapType::LockPhysicalControls => \"A7\".into(),\n\t\t\tHapType::LockTargetState => \"1E\".into(),\n\t\t\tHapType::Logs => \"1F\".into(),\n\t\t\tHapType::MacRetransmissionMaximum => \"247\".into(),\n\t\t\tHapType::MacTransmissionCounters => \"248\".into(),\n\t\t\tHapType::ManagedNetworkEnable => \"215\".into(),\n\t\t\tHapType::ManuallyDisabled => \"227\".into(),\n\t\t\tHapType::Manufacturer => \"20\".into(),\n\t\t\tHapType::MaximumTransmitPower => \"243\".into(),\n\t\t\tHapType::Model => \"21\".into(),\n\t\t\tHapType::MotionDetected => \"22\".into(),\n\t\t\tHapType::MultifunctionButton => \"26B\".into(),\n\t\t\tHapType::Mute => \"11A\".into(),\n\t\t\tHapType::NfcAccessControlPoint => \"264\".into(),\n\t\t\tHapType::NfcAccessSupportedConfiguration => \"265\".into(),\n\t\t\tHapType::Name => \"23\".into(),\n\t\t\tHapType::NetworkAccessViolationControl => \"21F\".into(),\n\t\t\tHapType::NetworkClientControl => \"20C\".into(),\n\t\t\tHapType::NetworkClientStatusControl => \"20D\".into(),\n\t\t\tHapType::NightVision => \"11B\".into(),\n\t\t\tHapType::NitrogenDioxideDensity => \"C4\".into(),\n\t\t\tHapType::ObstructionDetected => \"24\".into(),\n\t\t\tHapType::OccupancyDetected => \"71\".into(),\n\t\t\tHapType::OperatingStateResponse => \"232\".into(),\n\t\t\tHapType::OpticalZoom => \"11C\".into(),\n\t\t\tHapType::OutletInUse => \"26\".into(),\n\t\t\tHapType::OzoneDensity => \"C3\".into(),\n\t\t\tHapType::Pm10Density => \"C7\".into(),\n\t\t\tHapType::Pm2_5Density => \"C6\".into(),\n\t\t\tHapType::PairSetup => \"4C\".into(),\n\t\t\tHapType::PairVerify => \"4E\".into(),\n\t\t\tHapType::PairingFeatures => \"4F\".into(),\n\t\t\tHapType::PasswordSetting => \"E4\".into(),\n\t\t\tHapType::PeriodicSnapshotsActive => \"225\".into(),\n\t\t\tHapType::PictureMode => \"E2\".into(),\n\t\t\tHapType::Ping => \"23C\".into(),\n\t\t\tHapType::PositionState => \"72\".into(),\n\t\t\tHapType::PowerModeSelection => \"DF\".into(),\n\t\t\tHapType::PowerState => \"25\".into(),\n\t\t\tHapType::ProductData => \"220\".into(),\n\t\t\tHapType::ProgramMode => \"D1\".into(),\n\t\t\tHapType::ProgrammableSwitchEvent => \"73\".into(),\n\t\t\tHapType::ProgrammableSwitchOutputState => \"74\".into(),\n\t\t\tHapType::ReceivedSignalStrengthIndication => \"23F\".into(),\n\t\t\tHapType::ReceiverSensitivity => \"244\".into(),\n\t\t\tHapType::RelativeHumidityDehumidifierThreshold => \"C9\".into(),\n\t\t\tHapType::RelativeHumidityHumidifierThreshold => \"CA\".into(),\n\t\t\tHapType::RemainingDuration => \"D4\".into(),\n\t\t\tHapType::RemoteKey => \"E1\".into(),\n\t\t\tHapType::RotationDirection => \"28\".into(),\n\t\t\tHapType::RotationSpeed => \"29\".into(),\n\t\t\tHapType::RouterStatus => \"20E\".into(),\n\t\t\tHapType::Saturation => \"2F\".into(),\n\t\t\tHapType::SecuritySystemAlarmType => \"8E\".into(),\n\t\t\tHapType::SecuritySystemCurrentState => \"66\".into(),\n\t\t\tHapType::SecuritySystemTargetState => \"67\".into(),\n\t\t\tHapType::SelectedAudioStreamConfiguration => \"128\".into(),\n\t\t\tHapType::SelectedCameraRecordingConfiguration => \"209\".into(),\n\t\t\tHapType::SelectedDiagnosticsModes => \"24D\".into(),\n\t\t\tHapType::SelectedStreamConfiguration => \"117\".into(),\n\t\t\tHapType::SerialNumber => \"30\".into(),\n\t\t\tHapType::ServiceSignature => \"A5\".into(),\n\t\t\tHapType::SetDuration => \"D3\".into(),\n\t\t\tHapType::SetupDataStreamTransport => \"131\".into(),\n\t\t\tHapType::SetupEndpoint => \"118\".into(),\n\t\t\tHapType::SetupTransferTransport => \"201\".into(),\n\t\t\tHapType::SignalToNoiseRatio => \"241\".into(),\n\t\t\tHapType::SiriEnable => \"255\".into(),\n\t\t\tHapType::SiriEndpointSessionStatus => \"254\".into(),\n\t\t\tHapType::SiriEngineVersion => \"25A\".into(),\n\t\t\tHapType::SiriInputType => \"132\".into(),\n\t\t\tHapType::SiriLightOnUse => \"258\".into(),\n\t\t\tHapType::SiriListening => \"256\".into(),\n\t\t\tHapType::SiriTouchToUse => \"257\".into(),\n\t\t\tHapType::SlatType => \"C0\".into(),\n\t\t\tHapType::SleepDiscoveryMode => \"E8\".into(),\n\t\t\tHapType::SleepInterval => \"23A\".into(),\n\t\t\tHapType::SmokeDetected => \"76\".into(),\n\t\t\tHapType::SoftwareRevision => \"54\".into(),\n\t\t\tHapType::StagedFirmwareVersion => \"249\".into(),\n\t\t\tHapType::StatusActive => \"75\".into(),\n\t\t\tHapType::StatusFault => \"77\".into(),\n\t\t\tHapType::StatusJammed => \"78\".into(),\n\t\t\tHapType::StatusLowBattery => \"79\".into(),\n\t\t\tHapType::StatusTampered => \"7A\".into(),\n\t\t\tHapType::StreamingStatus => \"120\".into(),\n\t\t\tHapType::SulphurDioxideDensity => \"C5\".into(),\n\t\t\tHapType::SupportedAssetTypes => \"268\".into(),\n\t\t\tHapType::SupportedAudioRecordingConfiguration => \"207\".into(),\n\t\t\tHapType::SupportedAudioStreamConfiguration => \"115\".into(),\n\t\t\tHapType::SupportedCameraRecordingConfiguration => \"205\".into(),\n\t\t\tHapType::SupportedCharacteristicValueTransitionConfiguration => \"144\".into(),\n\t\t\tHapType::SupportedDataStreamTransportConfiguration => \"130\".into(),\n\t\t\tHapType::SupportedDiagnosticsModes => \"24C\".into(),\n\t\t\tHapType::SupportedDiagnosticsSnapshot => \"238\".into(),\n\t\t\tHapType::SupportedFirmwareUpdateConfiguration => \"233\".into(),\n\t\t\tHapType::SupportedRtpConfiguration => \"116\".into(),\n\t\t\tHapType::SupportedRouterConfiguration => \"210\".into(),\n\t\t\tHapType::SupportedTargetConfiguration => \"123\".into(),\n\t\t\tHapType::SupportedTransferTransportConfiguration => \"202\".into(),\n\t\t\tHapType::SupportedVideoRecordingConfiguration => \"206\".into(),\n\t\t\tHapType::SupportedVideoStreamConfiguration => \"114\".into(),\n\t\t\tHapType::SwingMode => \"B6\".into(),\n\t\t\tHapType::TargetAirPurifierState => \"A8\".into(),\n\t\t\tHapType::TargetDoorState => \"32\".into(),\n\t\t\tHapType::TargetFanState => \"BF\".into(),\n\t\t\tHapType::TargetHeaterCoolerState => \"B2\".into(),\n\t\t\tHapType::TargetHeatingCoolingState => \"33\".into(),\n\t\t\tHapType::TargetHorizontalTiltAngle => \"7B\".into(),\n\t\t\tHapType::TargetHumidifierDehumidifierState => \"B4\".into(),\n\t\t\tHapType::TargetListConfiguration => \"124\".into(),\n\t\t\tHapType::TargetMediaState => \"137\".into(),\n\t\t\tHapType::TargetPosition => \"7C\".into(),\n\t\t\tHapType::TargetRelativeHumidity => \"34\".into(),\n\t\t\tHapType::TargetTemperature => \"35\".into(),\n\t\t\tHapType::TargetTiltAngle => \"C2\".into(),\n\t\t\tHapType::TargetVerticalTiltAngle => \"7D\".into(),\n\t\t\tHapType::TargetVisibilityState => \"134\".into(),\n\t\t\tHapType::TemperatureDisplayUnits => \"36\".into(),\n\t\t\tHapType::ThirdPartyCameraActive => \"21C\".into(),\n\t\t\tHapType::ThreadControlPoint => \"704\".into(),\n\t\t\tHapType::ThreadNodeCapabilities => \"702\".into(),\n\t\t\tHapType::ThreadOpenthreadVersion => \"706\".into(),\n\t\t\tHapType::ThreadStatus => \"703\".into(),\n\t\t\tHapType::TransmitPower => \"242\".into(),\n\t\t\tHapType::ValveType => \"D5\".into(),\n\t\t\tHapType::Version => \"37\".into(),\n\t\t\tHapType::VideoAnalysisActive => \"229\".into(),\n\t\t\tHapType::VolatileOrganicCompoundDensity => \"C8\".into(),\n\t\t\tHapType::Volume => \"119\".into(),\n\t\t\tHapType::VolumeControlType => \"E9\".into(),\n\t\t\tHapType::VolumeSelector => \"EA\".into(),\n\t\t\tHapType::WanConfigurationList => \"211\".into(),\n\t\t\tHapType::WanStatusList => \"212\".into(),\n\t\t\tHapType::WakeConfiguration => \"222\".into(),\n\t\t\tHapType::WiFiCapabilities => \"22C\".into(),\n\t\t\tHapType::WiFiConfigurationControl => \"22D\".into(),\n\t\t\tHapType::WiFiSatelliteStatus => \"21E\".into(),\n\t\t\tHapType::RecordingAudioActive => \"226\".into(),\n\t\t\tHapType::AccessCode => \"260\".into(),\n\t\t\tHapType::AccessControl => \"DA\".into(),\n\t\t\tHapType::AccessoryInformation => \"3E\".into(),\n\t\t\tHapType::AccessoryMetrics => \"270\".into(),\n\t\t\tHapType::AccessoryRuntimeInformation => \"239\".into(),\n\t\t\tHapType::AirPurifier => \"BB\".into(),\n\t\t\tHapType::AirQualitySensor => \"8D\".into(),\n\t\t\tHapType::AssetUpdate => \"267\".into(),\n\t\t\tHapType::Assistant => \"26A\".into(),\n\t\t\tHapType::AudioStreamManagement => \"127\".into(),\n\t\t\tHapType::Battery => \"96\".into(),\n\t\t\tHapType::CameraOperatingMode => \"21A\".into(),\n\t\t\tHapType::CameraRecordingManagement => \"204\".into(),\n\t\t\tHapType::CameraStreamManagement => \"110\".into(),\n\t\t\tHapType::CarbonDioxideSensor => \"97\".into(),\n\t\t\tHapType::CarbonMonoxideSensor => \"7F\".into(),\n\t\t\tHapType::CloudRelay => \"5A\".into(),\n\t\t\tHapType::ContactSensor => \"80\".into(),\n\t\t\tHapType::DataStreamTransportManagement => \"129\".into(),\n\t\t\tHapType::Diagnostics => \"237\".into(),\n\t\t\tHapType::Door => \"81\".into(),\n\t\t\tHapType::Doorbell => \"121\".into(),\n\t\t\tHapType::Fan => \"40\".into(),\n\t\t\tHapType::FanV2 => \"B7\".into(),\n\t\t\tHapType::Faucet => \"D7\".into(),\n\t\t\tHapType::FilterMaintenance => \"BA\".into(),\n\t\t\tHapType::GarageDoorOpener => \"41\".into(),\n\t\t\tHapType::HeaterCooler => \"BC\".into(),\n\t\t\tHapType::HumidifierDehumidifier => \"BD\".into(),\n\t\t\tHapType::HumiditySensor => \"82\".into(),\n\t\t\tHapType::InputSource => \"D9\".into(),\n\t\t\tHapType::IrrigationSystem => \"CF\".into(),\n\t\t\tHapType::Label => \"CC\".into(),\n\t\t\tHapType::LeakSensor => \"83\".into(),\n\t\t\tHapType::LightSensor => \"84\".into(),\n\t\t\tHapType::Lightbulb => \"43\".into(),\n\t\t\tHapType::LockManagement => \"44\".into(),\n\t\t\tHapType::LockMechanism => \"45\".into(),\n\t\t\tHapType::Microphone => \"112\".into(),\n\t\t\tHapType::MotionSensor => \"85\".into(),\n\t\t\tHapType::NfcAccessService => \"266\".into(),\n\t\t\tHapType::OccupancySensor => \"86\".into(),\n\t\t\tHapType::Outlet => \"47\".into(),\n\t\t\tHapType::Pairing => \"55\".into(),\n\t\t\tHapType::PowerManagement => \"221\".into(),\n\t\t\tHapType::ProtocolInformation => \"A2\".into(),\n\t\t\tHapType::SecuritySystem => \"7E\".into(),\n\t\t\tHapType::Siri => \"133\".into(),\n\t\t\tHapType::SiriEndpoint => \"253\".into(),\n\t\t\tHapType::Slats => \"B9\".into(),\n\t\t\tHapType::SmartSpeaker => \"228\".into(),\n\t\t\tHapType::SmokeSensor => \"87\".into(),\n\t\t\tHapType::Speaker => \"113\".into(),\n\t\t\tHapType::StatefulProgrammableSwitch => \"88\".into(),\n\t\t\tHapType::StatelessProgrammableSwitch => \"89\".into(),\n\t\t\tHapType::Switch => \"49\".into(),\n\t\t\tHapType::TargetControl => \"125\".into(),\n\t\t\tHapType::TargetControlManagement => \"122\".into(),\n\t\t\tHapType::Television => \"D8\".into(),\n\t\t\tHapType::TemperatureSensor => \"8A\".into(),\n\t\t\tHapType::Thermostat => \"4A\".into(),\n\t\t\tHapType::ThreadTransport => \"701\".into(),\n\t\t\tHapType::TransferTransportManagement => \"203\".into(),\n\t\t\tHapType::Valve => \"D0\".into(),\n\t\t\tHapType::WiFiRouter => \"20A\".into(),\n\t\t\tHapType::WiFiSatellite => \"20F\".into(),\n\t\t\tHapType::WiFiTransport => \"22A\".into(),\n\t\t\tHapType::Window => \"8B\".into(),\n\t\t\tHapType::WindowCovering => \"8C\".into(),\n\t\t}\n    }\n}\n\nimpl FromStr for HapType {\n    type Err = Error;\n\n    fn from_str(s: &str) -> Result<Self, Self::Err> {\n        if let Ok(uuid) = Uuid::parse_str(s) {\n            return Ok(HapType::Custom(uuid));\n        }\n\n        match s {\n            \"unknown\" => Ok(HapType::Unknown),\n\t\t\t\"262\" => Ok(HapType::AccessCodeControlPoint),\n\t\t\t\"261\" => Ok(HapType::AccessCodeSupportedConfiguration),\n\t\t\t\"E5\" => Ok(HapType::AccessControlLevel),\n\t\t\t\"A6\" => Ok(HapType::AccessoryFlags),\n\t\t\t\"57\" => Ok(HapType::AccessoryIdentifier),\n\t\t\t\"B0\" => Ok(HapType::Active),\n\t\t\t\"E7\" => Ok(HapType::ActiveIdentifier),\n\t\t\t\"23B\" => Ok(HapType::ActivityInterval),\n\t\t\t\"1\" => Ok(HapType::AdministratorOnlyAccess),\n\t\t\t\"64\" => Ok(HapType::AirParticulateDensity),\n\t\t\t\"65\" => Ok(HapType::AirParticulateSize),\n\t\t\t\"25B\" => Ok(HapType::AirplayEnable),\n\t\t\t\"A4\" => Ok(HapType::ApplicationMatchingIdentifier),\n\t\t\t\"269\" => Ok(HapType::AssetUpdateReadiness),\n\t\t\t\"5\" => Ok(HapType::AudioFeedback),\n\t\t\t\"68\" => Ok(HapType::BatteryLevel),\n\t\t\t\"8\" => Ok(HapType::Brightness),\n\t\t\t\"126\" => Ok(HapType::ButtonEvent),\n\t\t\t\"246\" => Ok(HapType::CcaEnergyDetectThreshold),\n\t\t\t\"245\" => Ok(HapType::CcaSignalDetectThreshold),\n\t\t\t\"21D\" => Ok(HapType::CameraOperatingModeIndicator),\n\t\t\t\"92\" => Ok(HapType::CarbonDioxideDetected),\n\t\t\t\"93\" => Ok(HapType::CarbonDioxideLevel),\n\t\t\t\"94\" => Ok(HapType::CarbonDioxidePeakLevel),\n\t\t\t\"69\" => Ok(HapType::CarbonMonoxideDetected),\n\t\t\t\"90\" => Ok(HapType::CarbonMonoxideLevel),\n\t\t\t\"91\" => Ok(HapType::CarbonMonoxidePeakLevel),\n\t\t\t\"24B\" => Ok(HapType::CharacteristicValueActiveTransitionCount),\n\t\t\t\"143\" => Ok(HapType::CharacteristicValueTransitionControl),\n\t\t\t\"8F\" => Ok(HapType::ChargingState),\n\t\t\t\"DD\" => Ok(HapType::ClosedCaptions),\n\t\t\t\"5E\" => Ok(HapType::CloudRelayControlPoint),\n\t\t\t\"5C\" => Ok(HapType::CloudRelayCurrentState),\n\t\t\t\"5B\" => Ok(HapType::CloudRelayEnableStatus),\n\t\t\t\"CE\" => Ok(HapType::ColorTemperature),\n\t\t\t\"263\" => Ok(HapType::ConfigurationState),\n\t\t\t\"E3\" => Ok(HapType::ConfiguredName),\n\t\t\t\"6A\" => Ok(HapType::ContactSensorState),\n\t\t\t\"D\" => Ok(HapType::CoolingThresholdTemperature),\n\t\t\t\"A9\" => Ok(HapType::CurrentAirPurifierState),\n\t\t\t\"95\" => Ok(HapType::CurrentAirQuality),\n\t\t\t\"E\" => Ok(HapType::CurrentDoorState),\n\t\t\t\"AF\" => Ok(HapType::CurrentFanState),\n\t\t\t\"B1\" => Ok(HapType::CurrentHeaterCoolerState),\n\t\t\t\"F\" => Ok(HapType::CurrentHeatingCoolingState),\n\t\t\t\"6C\" => Ok(HapType::CurrentHorizontalTiltAngle),\n\t\t\t\"B3\" => Ok(HapType::CurrentHumidifierDehumidifierState),\n\t\t\t\"6B\" => Ok(HapType::CurrentLightLevel),\n\t\t\t\"E0\" => Ok(HapType::CurrentMediaState),\n\t\t\t\"6D\" => Ok(HapType::CurrentPosition),\n\t\t\t\"10\" => Ok(HapType::CurrentRelativeHumidity),\n\t\t\t\"AA\" => Ok(HapType::CurrentSlatState),\n\t\t\t\"11\" => Ok(HapType::CurrentTemperature),\n\t\t\t\"C1\" => Ok(HapType::CurrentTiltAngle),\n\t\t\t\"22B\" => Ok(HapType::CurrentTransport),\n\t\t\t\"6E\" => Ok(HapType::CurrentVerticalTiltAngle),\n\t\t\t\"135\" => Ok(HapType::CurrentVisibilityState),\n\t\t\t\"B5\" => Ok(HapType::CurrentWaterLevel),\n\t\t\t\"138\" => Ok(HapType::DataStreamHapTransport),\n\t\t\t\"139\" => Ok(HapType::DataStreamHapTransportInterrupt),\n\t\t\t\"11D\" => Ok(HapType::DigitalZoom),\n\t\t\t\"136\" => Ok(HapType::DisplayOrder),\n\t\t\t\"23D\" => Ok(HapType::EventRetransmissionMaximum),\n\t\t\t\"223\" => Ok(HapType::EventSnapshotsActive),\n\t\t\t\"23E\" => Ok(HapType::EventTransmissionCounters),\n\t\t\t\"AC\" => Ok(HapType::FilterChangeIndication),\n\t\t\t\"AB\" => Ok(HapType::FilterLifeLevel),\n\t\t\t\"AD\" => Ok(HapType::FilterResetChangeIndication),\n\t\t\t\"52\" => Ok(HapType::FirmwareRevision),\n\t\t\t\"234\" => Ok(HapType::FirmwareUpdateReadiness),\n\t\t\t\"235\" => Ok(HapType::FirmwareUpdateStatus),\n\t\t\t\"26C\" => Ok(HapType::HardwareFinish),\n\t\t\t\"53\" => Ok(HapType::HardwareRevision),\n\t\t\t\"24A\" => Ok(HapType::HeartBeat),\n\t\t\t\"12\" => Ok(HapType::HeatingThresholdTemperature),\n\t\t\t\"6F\" => Ok(HapType::HoldPosition),\n\t\t\t\"21B\" => Ok(HapType::HomekitCameraActive),\n\t\t\t\"13\" => Ok(HapType::Hue),\n\t\t\t\"E6\" => Ok(HapType::Identifier),\n\t\t\t\"14\" => Ok(HapType::Identify),\n\t\t\t\"11F\" => Ok(HapType::ImageMirroring),\n\t\t\t\"11E\" => Ok(HapType::ImageRotation),\n\t\t\t\"D2\" => Ok(HapType::InUse),\n\t\t\t\"DC\" => Ok(HapType::InputDeviceType),\n\t\t\t\"DB\" => Ok(HapType::InputSourceType),\n\t\t\t\"D6\" => Ok(HapType::IsConfigured),\n\t\t\t\"CB\" => Ok(HapType::LabelIndex),\n\t\t\t\"CD\" => Ok(HapType::LabelNamespace),\n\t\t\t\"70\" => Ok(HapType::LeakDetected),\n\t\t\t\"50\" => Ok(HapType::ListPairings),\n\t\t\t\"19\" => Ok(HapType::LockControlPoint),\n\t\t\t\"1D\" => Ok(HapType::LockCurrentState),\n\t\t\t\"1C\" => Ok(HapType::LockLastKnownAction),\n\t\t\t\"1A\" => Ok(HapType::LockManagementAutoSecurityTimeout),\n\t\t\t\"A7\" => Ok(HapType::LockPhysicalControls),\n\t\t\t\"1E\" => Ok(HapType::LockTargetState),\n\t\t\t\"1F\" => Ok(HapType::Logs),\n\t\t\t\"247\" => Ok(HapType::MacRetransmissionMaximum),\n\t\t\t\"248\" => Ok(HapType::MacTransmissionCounters),\n\t\t\t\"215\" => Ok(HapType::ManagedNetworkEnable),\n\t\t\t\"227\" => Ok(HapType::ManuallyDisabled),\n\t\t\t\"20\" => Ok(HapType::Manufacturer),\n\t\t\t\"243\" => Ok(HapType::MaximumTransmitPower),\n\t\t\t\"21\" => Ok(HapType::Model),\n\t\t\t\"22\" => Ok(HapType::MotionDetected),\n\t\t\t\"26B\" => Ok(HapType::MultifunctionButton),\n\t\t\t\"11A\" => Ok(HapType::Mute),\n\t\t\t\"264\" => Ok(HapType::NfcAccessControlPoint),\n\t\t\t\"265\" => Ok(HapType::NfcAccessSupportedConfiguration),\n\t\t\t\"23\" => Ok(HapType::Name),\n\t\t\t\"21F\" => Ok(HapType::NetworkAccessViolationControl),\n\t\t\t\"20C\" => Ok(HapType::NetworkClientControl),\n\t\t\t\"20D\" => Ok(HapType::NetworkClientStatusControl),\n\t\t\t\"11B\" => Ok(HapType::NightVision),\n\t\t\t\"C4\" => Ok(HapType::NitrogenDioxideDensity),\n\t\t\t\"24\" => Ok(HapType::ObstructionDetected),\n\t\t\t\"71\" => Ok(HapType::OccupancyDetected),\n\t\t\t\"232\" => Ok(HapType::OperatingStateResponse),\n\t\t\t\"11C\" => Ok(HapType::OpticalZoom),\n\t\t\t\"26\" => Ok(HapType::OutletInUse),\n\t\t\t\"C3\" => Ok(HapType::OzoneDensity),\n\t\t\t\"C7\" => Ok(HapType::Pm10Density),\n\t\t\t\"C6\" => Ok(HapType::Pm2_5Density),\n\t\t\t\"4C\" => Ok(HapType::PairSetup),\n\t\t\t\"4E\" => Ok(HapType::PairVerify),\n\t\t\t\"4F\" => Ok(HapType::PairingFeatures),\n\t\t\t\"E4\" => Ok(HapType::PasswordSetting),\n\t\t\t\"225\" => Ok(HapType::PeriodicSnapshotsActive),\n\t\t\t\"E2\" => Ok(HapType::PictureMode),\n\t\t\t\"23C\" => Ok(HapType::Ping),\n\t\t\t\"72\" => Ok(HapType::PositionState),\n\t\t\t\"DF\" => Ok(HapType::PowerModeSelection),\n\t\t\t\"25\" => Ok(HapType::PowerState),\n\t\t\t\"220\" => Ok(HapType::ProductData),\n\t\t\t\"D1\" => Ok(HapType::ProgramMode),\n\t\t\t\"73\" => Ok(HapType::ProgrammableSwitchEvent),\n\t\t\t\"74\" => Ok(HapType::ProgrammableSwitchOutputState),\n\t\t\t\"23F\" => Ok(HapType::ReceivedSignalStrengthIndication),\n\t\t\t\"244\" => Ok(HapType::ReceiverSensitivity),\n\t\t\t\"C9\" => Ok(HapType::RelativeHumidityDehumidifierThreshold),\n\t\t\t\"CA\" => Ok(HapType::RelativeHumidityHumidifierThreshold),\n\t\t\t\"D4\" => Ok(HapType::RemainingDuration),\n\t\t\t\"E1\" => Ok(HapType::RemoteKey),\n\t\t\t\"28\" => Ok(HapType::RotationDirection),\n\t\t\t\"29\" => Ok(HapType::RotationSpeed),\n\t\t\t\"20E\" => Ok(HapType::RouterStatus),\n\t\t\t\"2F\" => Ok(HapType::Saturation),\n\t\t\t\"8E\" => Ok(HapType::SecuritySystemAlarmType),\n\t\t\t\"66\" => Ok(HapType::SecuritySystemCurrentState),\n\t\t\t\"67\" => Ok(HapType::SecuritySystemTargetState),\n\t\t\t\"128\" => Ok(HapType::SelectedAudioStreamConfiguration),\n\t\t\t\"209\" => Ok(HapType::SelectedCameraRecordingConfiguration),\n\t\t\t\"24D\" => Ok(HapType::SelectedDiagnosticsModes),\n\t\t\t\"117\" => Ok(HapType::SelectedStreamConfiguration),\n\t\t\t\"30\" => Ok(HapType::SerialNumber),\n\t\t\t\"A5\" => Ok(HapType::ServiceSignature),\n\t\t\t\"D3\" => Ok(HapType::SetDuration),\n\t\t\t\"131\" => Ok(HapType::SetupDataStreamTransport),\n\t\t\t\"118\" => Ok(HapType::SetupEndpoint),\n\t\t\t\"201\" => Ok(HapType::SetupTransferTransport),\n\t\t\t\"241\" => Ok(HapType::SignalToNoiseRatio),\n\t\t\t\"255\" => Ok(HapType::SiriEnable),\n\t\t\t\"254\" => Ok(HapType::SiriEndpointSessionStatus),\n\t\t\t\"25A\" => Ok(HapType::SiriEngineVersion),\n\t\t\t\"132\" => Ok(HapType::SiriInputType),\n\t\t\t\"258\" => Ok(HapType::SiriLightOnUse),\n\t\t\t\"256\" => Ok(HapType::SiriListening),\n\t\t\t\"257\" => Ok(HapType::SiriTouchToUse),\n\t\t\t\"C0\" => Ok(HapType::SlatType),\n\t\t\t\"E8\" => Ok(HapType::SleepDiscoveryMode),\n\t\t\t\"23A\" => Ok(HapType::SleepInterval),\n\t\t\t\"76\" => Ok(HapType::SmokeDetected),\n\t\t\t\"54\" => Ok(HapType::SoftwareRevision),\n\t\t\t\"249\" => Ok(HapType::StagedFirmwareVersion),\n\t\t\t\"75\" => Ok(HapType::StatusActive),\n\t\t\t\"77\" => Ok(HapType::StatusFault),\n\t\t\t\"78\" => Ok(HapType::StatusJammed),\n\t\t\t\"79\" => Ok(HapType::StatusLowBattery),\n\t\t\t\"7A\" => Ok(HapType::StatusTampered),\n\t\t\t\"120\" => Ok(HapType::StreamingStatus),\n\t\t\t\"C5\" => Ok(HapType::SulphurDioxideDensity),\n\t\t\t\"268\" => Ok(HapType::SupportedAssetTypes),\n\t\t\t\"207\" => Ok(HapType::SupportedAudioRecordingConfiguration),\n\t\t\t\"115\" => Ok(HapType::SupportedAudioStreamConfiguration),\n\t\t\t\"205\" => Ok(HapType::SupportedCameraRecordingConfiguration),\n\t\t\t\"144\" => Ok(HapType::SupportedCharacteristicValueTransitionConfiguration),\n\t\t\t\"130\" => Ok(HapType::SupportedDataStreamTransportConfiguration),\n\t\t\t\"24C\" => Ok(HapType::SupportedDiagnosticsModes),\n\t\t\t\"238\" => Ok(HapType::SupportedDiagnosticsSnapshot),\n\t\t\t\"233\" => Ok(HapType::SupportedFirmwareUpdateConfiguration),\n\t\t\t\"116\" => Ok(HapType::SupportedRtpConfiguration),\n\t\t\t\"210\" => Ok(HapType::SupportedRouterConfiguration),\n\t\t\t\"123\" => Ok(HapType::SupportedTargetConfiguration),\n\t\t\t\"202\" => Ok(HapType::SupportedTransferTransportConfiguration),\n\t\t\t\"206\" => Ok(HapType::SupportedVideoRecordingConfiguration),\n\t\t\t\"114\" => Ok(HapType::SupportedVideoStreamConfiguration),\n\t\t\t\"B6\" => Ok(HapType::SwingMode),\n\t\t\t\"A8\" => Ok(HapType::TargetAirPurifierState),\n\t\t\t\"32\" => Ok(HapType::TargetDoorState),\n\t\t\t\"BF\" => Ok(HapType::TargetFanState),\n\t\t\t\"B2\" => Ok(HapType::TargetHeaterCoolerState),\n\t\t\t\"33\" => Ok(HapType::TargetHeatingCoolingState),\n\t\t\t\"7B\" => Ok(HapType::TargetHorizontalTiltAngle),\n\t\t\t\"B4\" => Ok(HapType::TargetHumidifierDehumidifierState),\n\t\t\t\"124\" => Ok(HapType::TargetListConfiguration),\n\t\t\t\"137\" => Ok(HapType::TargetMediaState),\n\t\t\t\"7C\" => Ok(HapType::TargetPosition),\n\t\t\t\"34\" => Ok(HapType::TargetRelativeHumidity),\n\t\t\t\"35\" => Ok(HapType::TargetTemperature),\n\t\t\t\"C2\" => Ok(HapType::TargetTiltAngle),\n\t\t\t\"7D\" => Ok(HapType::TargetVerticalTiltAngle),\n\t\t\t\"134\" => Ok(HapType::TargetVisibilityState),\n\t\t\t\"36\" => Ok(HapType::TemperatureDisplayUnits),\n\t\t\t\"21C\" => Ok(HapType::ThirdPartyCameraActive),\n\t\t\t\"704\" => Ok(HapType::ThreadControlPoint),\n\t\t\t\"702\" => Ok(HapType::ThreadNodeCapabilities),\n\t\t\t\"706\" => Ok(HapType::ThreadOpenthreadVersion),\n\t\t\t\"703\" => Ok(HapType::ThreadStatus),\n\t\t\t\"242\" => Ok(HapType::TransmitPower),\n\t\t\t\"D5\" => Ok(HapType::ValveType),\n\t\t\t\"37\" => Ok(HapType::Version),\n\t\t\t\"229\" => Ok(HapType::VideoAnalysisActive),\n\t\t\t\"C8\" => Ok(HapType::VolatileOrganicCompoundDensity),\n\t\t\t\"119\" => Ok(HapType::Volume),\n\t\t\t\"E9\" => Ok(HapType::VolumeControlType),\n\t\t\t\"EA\" => Ok(HapType::VolumeSelector),\n\t\t\t\"211\" => Ok(HapType::WanConfigurationList),\n\t\t\t\"212\" => Ok(HapType::WanStatusList),\n\t\t\t\"222\" => Ok(HapType::WakeConfiguration),\n\t\t\t\"22C\" => Ok(HapType::WiFiCapabilities),\n\t\t\t\"22D\" => Ok(HapType::WiFiConfigurationControl),\n\t\t\t\"21E\" => Ok(HapType::WiFiSatelliteStatus),\n\t\t\t\"226\" => Ok(HapType::RecordingAudioActive),\n\t\t\t\"260\" => Ok(HapType::AccessCode),\n\t\t\t\"DA\" => Ok(HapType::AccessControl),\n\t\t\t\"3E\" => Ok(HapType::AccessoryInformation),\n\t\t\t\"270\" => Ok(HapType::AccessoryMetrics),\n\t\t\t\"239\" => Ok(HapType::AccessoryRuntimeInformation),\n\t\t\t\"BB\" => Ok(HapType::AirPurifier),\n\t\t\t\"8D\" => Ok(HapType::AirQualitySensor),\n\t\t\t\"267\" => Ok(HapType::AssetUpdate),\n\t\t\t\"26A\" => Ok(HapType::Assistant),\n\t\t\t\"127\" => Ok(HapType::AudioStreamManagement),\n\t\t\t\"96\" => Ok(HapType::Battery),\n\t\t\t\"21A\" => Ok(HapType::CameraOperatingMode),\n\t\t\t\"204\" => Ok(HapType::CameraRecordingManagement),\n\t\t\t\"110\" => Ok(HapType::CameraStreamManagement),\n\t\t\t\"97\" => Ok(HapType::CarbonDioxideSensor),\n\t\t\t\"7F\" => Ok(HapType::CarbonMonoxideSensor),\n\t\t\t\"5A\" => Ok(HapType::CloudRelay),\n\t\t\t\"80\" => Ok(HapType::ContactSensor),\n\t\t\t\"129\" => Ok(HapType::DataStreamTransportManagement),\n\t\t\t\"237\" => Ok(HapType::Diagnostics),\n\t\t\t\"81\" => Ok(HapType::Door),\n\t\t\t\"121\" => Ok(HapType::Doorbell),\n\t\t\t\"40\" => Ok(HapType::Fan),\n\t\t\t\"B7\" => Ok(HapType::FanV2),\n\t\t\t\"D7\" => Ok(HapType::Faucet),\n\t\t\t\"BA\" => Ok(HapType::FilterMaintenance),\n\t\t\t\"41\" => Ok(HapType::GarageDoorOpener),\n\t\t\t\"BC\" => Ok(HapType::HeaterCooler),\n\t\t\t\"BD\" => Ok(HapType::HumidifierDehumidifier),\n\t\t\t\"82\" => Ok(HapType::HumiditySensor),\n\t\t\t\"D9\" => Ok(HapType::InputSource),\n\t\t\t\"CF\" => Ok(HapType::IrrigationSystem),\n\t\t\t\"CC\" => Ok(HapType::Label),\n\t\t\t\"83\" => Ok(HapType::LeakSensor),\n\t\t\t\"84\" => Ok(HapType::LightSensor),\n\t\t\t\"43\" => Ok(HapType::Lightbulb),\n\t\t\t\"44\" => Ok(HapType::LockManagement),\n\t\t\t\"45\" => Ok(HapType::LockMechanism),\n\t\t\t\"112\" => Ok(HapType::Microphone),\n\t\t\t\"85\" => Ok(HapType::MotionSensor),\n\t\t\t\"266\" => Ok(HapType::NfcAccessService),\n\t\t\t\"86\" => Ok(HapType::OccupancySensor),\n\t\t\t\"47\" => Ok(HapType::Outlet),\n\t\t\t\"55\" => Ok(HapType::Pairing),\n\t\t\t\"221\" => Ok(HapType::PowerManagement),\n\t\t\t\"A2\" => Ok(HapType::ProtocolInformation),\n\t\t\t\"7E\" => Ok(HapType::SecuritySystem),\n\t\t\t\"133\" => Ok(HapType::Siri),\n\t\t\t\"253\" => Ok(HapType::SiriEndpoint),\n\t\t\t\"B9\" => Ok(HapType::Slats),\n\t\t\t\"228\" => Ok(HapType::SmartSpeaker),\n\t\t\t\"87\" => Ok(HapType::SmokeSensor),\n\t\t\t\"113\" => Ok(HapType::Speaker),\n\t\t\t\"88\" => Ok(HapType::StatefulProgrammableSwitch),\n\t\t\t\"89\" => Ok(HapType::StatelessProgrammableSwitch),\n\t\t\t\"49\" => Ok(HapType::Switch),\n\t\t\t\"125\" => Ok(HapType::TargetControl),\n\t\t\t\"122\" => Ok(HapType::TargetControlManagement),\n\t\t\t\"D8\" => Ok(HapType::Television),\n\t\t\t\"8A\" => Ok(HapType::TemperatureSensor),\n\t\t\t\"4A\" => Ok(HapType::Thermostat),\n\t\t\t\"701\" => Ok(HapType::ThreadTransport),\n\t\t\t\"203\" => Ok(HapType::TransferTransportManagement),\n\t\t\t\"D0\" => Ok(HapType::Valve),\n\t\t\t\"20A\" => Ok(HapType::WiFiRouter),\n\t\t\t\"20F\" => Ok(HapType::WiFiSatellite),\n\t\t\t\"22A\" => Ok(HapType::WiFiTransport),\n\t\t\t\"8B\" => Ok(HapType::Window),\n\t\t\t\"8C\" => Ok(HapType::WindowCovering),\n\t\t\t_ => Err(Error::InvalidHapTypeString(s.to_string())),\n\t\t}\n    }\n}\n\nimpl Default for HapType {\n    fn default() -> HapType { HapType::Unknown }\n}\n\nimpl<'de> Deserialize<'de> for HapType {\n    fn deserialize<D>(deserializer: D) -> Result<HapType, D::Error>\n    where\n        D: Deserializer<'de>,\n    {\n        let s = String::deserialize(deserializer)?;\n        let hap_type = HapType::from_str(&s).map_err(de::Error::custom)?;\n        Ok(hap_type)\n    }\n}\n\nimpl Serialize for HapType {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        serializer.serialize_str(&self.to_string())\n    }\n}\n"
  },
  {
    "path": "src/lib.rs",
    "content": "pub use ed25519_dalek::Keypair as Ed25519Keypair;\npub use futures;\npub use macaddr::MacAddr6 as MacAddress;\npub use serde_json;\n\npub use crate::{\n    config::Config,\n    error::Error,\n    hap_type::HapType,\n    pin::Pin,\n    transport::bonjour::{BonjourFeatureFlag, BonjourStatusFlag},\n};\n\nmod config;\nmod error;\nmod event;\nmod hap_type;\nmod pin;\nmod pointer;\nmod tlv;\nmod transport;\n\n/// Definitions of HomeKit accessories.\npub mod accessory;\n/// Definitions of HomeKit characteristics.\npub mod characteristic;\n/// Representation of paired controllers.\npub mod pairing;\n/// The HomeKit Accessory Server implementation.\npub mod server;\n/// Definitions of HomeKit services.\npub mod service;\n/// Representations of persistent storage.\npub mod storage;\n\n/// `Result` type redefinition.\npub type Result<T> = std::result::Result<T, Error>;\n"
  },
  {
    "path": "src/pairing.rs",
    "content": "use serde::{Deserialize, Serialize};\nuse uuid::Uuid;\n\nuse crate::{Error, Result};\n\n/// A [`Pairing`](Pairing) represents a paired controller.\n#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]\npub struct Pairing {\n    pub id: Uuid,\n    pub permissions: Permissions,\n    pub public_key: [u8; 32],\n}\n\nimpl Pairing {\n    /// Creates a new [`Pairing`](Pairing).\n    pub fn new(id: Uuid, permissions: Permissions, public_key: [u8; 32]) -> Pairing {\n        Pairing {\n            id,\n            permissions,\n            public_key,\n        }\n    }\n\n    /// Deserializes a [`Pairing`](Pairing) from bytes.\n    pub fn from_bytes(bytes: &[u8]) -> Result<Pairing> {\n        let value = serde_json::from_slice(&bytes)?;\n        Ok(value)\n    }\n\n    /// Serializes a [`Pairing`](Pairing) to bytes.\n    pub fn as_bytes(&self) -> Result<Vec<u8>> {\n        let value = serde_json::to_vec(&self)?;\n        Ok(value)\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn test_pairing_from_bytes() {\n        let pairing = Pairing {\n            id: Uuid::parse_str(\"bc158b86-cabf-432d-aee4-422ef0e3f1d5\").unwrap(),\n            permissions: Permissions::Admin,\n            public_key: [\n                215, 90, 152, 1, 130, 177, 10, 183, 213, 75, 254, 211, 201, 100, 7, 58, 14, 225, 114, 243, 218, 166,\n                35, 37, 175, 2, 26, 104, 247, 7, 81, 26,\n            ],\n        };\n        assert_eq!(\n            Pairing::from_bytes(&b\"{\\\"id\\\":\\\"bc158b86-cabf-432d-aee4-422ef0e3f1d5\\\",\\\"permissions\\\":\\\"0x01\\\",\\\"public_key\\\":[215,90,152,1,130,177,10,183,213,75,254,211,201,100,7,58,14,225,114,243,218,166,35,37,175,2,26,104,247,7,81,26]}\".to_vec()).unwrap(),\n            pairing\n        );\n    }\n\n    #[test]\n    fn test_pairing_to_bytes() {\n        let pairing = Pairing {\n            id: Uuid::parse_str(\"bc158b86-cabf-432d-aee4-422ef0e3f1d5\").unwrap(),\n            permissions: Permissions::User,\n            public_key: [\n                215, 90, 152, 1, 130, 177, 10, 183, 213, 75, 254, 211, 201, 100, 7, 58, 14, 225, 114, 243, 218, 166,\n                35, 37, 175, 2, 26, 104, 247, 7, 81, 26,\n            ],\n        };\n        assert_eq!(\n            pairing.as_bytes().unwrap(),\n            b\"{\\\"id\\\":\\\"bc158b86-cabf-432d-aee4-422ef0e3f1d5\\\",\\\"permissions\\\":\\\"0x00\\\",\\\"public_key\\\":[215,90,152,1,130,177,10,183,213,75,254,211,201,100,7,58,14,225,114,243,218,166,35,37,175,2,26,104,247,7,81,26]}\".to_vec()\n        );\n    }\n}\n\n/// The permissions of a paired controller.\n#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]\npub enum Permissions {\n    #[serde(rename = \"0x00\")]\n    User,\n    /// Admins are pairings that have the admin bit set. Admins are exclusively authorized to add, remove, and list\n    /// pairings.\n    #[serde(rename = \"0x01\")]\n    Admin,\n}\n\nimpl Permissions {\n    /// Converts a Byte value to the corresponding `Permissions` variant.\n    pub fn from_byte(byte: u8) -> Result<Permissions> {\n        match byte {\n            0x00 => Ok(Permissions::User),\n            0x01 => Ok(Permissions::Admin),\n            _ => Err(Error::InvalidPairingPermission(byte)),\n        }\n    }\n\n    /// Converts a `Permissions` variant to the corresponding Byte value.\n    pub fn as_byte(&self) -> u8 {\n        match *self {\n            Permissions::User => 0x00,\n            Permissions::Admin => 0x01,\n        }\n    }\n}\n"
  },
  {
    "path": "src/pin.rs",
    "content": "use serde::{Deserialize, Serialize};\n\nuse crate::{Error, Result};\n\nconst INVALID_PINS: [[u8; 8]; 12] = [\n    [0, 0, 0, 0, 0, 0, 0, 0],\n    [1, 1, 1, 1, 1, 1, 1, 1],\n    [2, 2, 2, 2, 2, 2, 2, 2],\n    [3, 3, 3, 3, 3, 3, 3, 3],\n    [4, 4, 4, 4, 4, 4, 4, 4],\n    [5, 5, 5, 5, 5, 5, 5, 5],\n    [6, 6, 6, 6, 6, 6, 6, 6],\n    [7, 7, 7, 7, 7, 7, 7, 7],\n    [8, 8, 8, 8, 8, 8, 8, 8],\n    [9, 9, 9, 9, 9, 9, 9, 9],\n    [1, 2, 3, 4, 5, 6, 7, 8],\n    [8, 7, 6, 5, 4, 3, 2, 1],\n];\n\n/// The `Pin` struct represents the server's 8 digit pin used for pairing.\n///\n/// The pin consists of eight digits between 0 and 9 and defaults to `11122333`.\n///\n/// The following pins are considered too easy and are therefore not allowed:\n/// - `00000000`\n/// - `11111111`\n/// - `22222222`\n/// - `33333333`\n/// - `44444444`\n/// - `55555555`\n/// - `66666666`\n/// - `77777777`\n/// - `88888888`\n/// - `99999999`\n/// - `12345678`\n/// - `87654321`\n#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]\npub struct Pin {\n    pin: [u8; 8],\n}\n\nimpl Pin {\n    /// Creates a new `Pin`.\n    pub fn new(pin: [u8; 8]) -> Result<Self> {\n        if INVALID_PINS.contains(&pin) {\n            return Err(Error::PinTooEasy);\n        }\n        for digit in &pin {\n            if digit > &9 {\n                return Err(Error::InvalidPin);\n            }\n        }\n\n        Ok(Pin { pin })\n    }\n\n    // TODO: fix UTF-8 encoding here\n    // pub fn as_bytes(&self) -> [u8; 10] {\n    //     [\n    //         self.pin[0],\n    //         self.pin[1],\n    //         self.pin[2],\n    //         45, // '-'\n    //         self.pin[3],\n    //         self.pin[4],\n    //         45, // '-'\n    //         self.pin[5],\n    //         self.pin[6],\n    //         self.pin[7],\n    //     ]\n    // }\n}\n\nimpl ToString for Pin {\n    fn to_string(&self) -> String {\n        format!(\n            \"{}{}{}-{}{}-{}{}{}\",\n            &self.pin[0],\n            &self.pin[1],\n            &self.pin[2],\n            &self.pin[3],\n            &self.pin[4],\n            &self.pin[5],\n            &self.pin[6],\n            &self.pin[7],\n        )\n    }\n}\n\nmod tests {\n    #[allow(unused_imports)]\n    use super::*;\n\n    // #[test]\n    // fn test_invalid_pin() {\n    //     let too_easy_pin = Pin::new([1, 2, 3, 4, 5, 6, 7, 8]);\n    //     let pin_with_invalid_number = Pin::new([0, 0, 0, 0, 0, 0, 0, 123]);\n    // }\n\n    #[test]\n    fn test_to_string() {\n        let pin = Pin::new([1, 1, 1, 2, 2, 3, 3, 3]).unwrap();\n        assert_eq!(pin.to_string(), \"111-22-333\".to_string());\n    }\n\n    // #[test]\n    // fn test_as_bytes() {\n    //     let pin = Pin::new([1, 1, 1, 2, 2, 3, 3, 3]).unwrap();\n    //     let bytes = pin.as_bytes();\n    //     assert_eq!(bytes, \"111-22-333\".to_string().as_bytes());\n    // }\n}\n"
  },
  {
    "path": "src/pointer.rs",
    "content": "use futures::lock::Mutex;\nuse std::sync::{Arc, RwLock};\nuse uuid::Uuid;\n\nuse crate::{accessory, event, storage};\n\npub type ControllerId = Arc<RwLock<Option<Uuid>>>;\n\npub type EventEmitter = Arc<Mutex<event::EventEmitter>>;\n\npub type EventSubscriptions = Arc<Mutex<Vec<(u64, u64)>>>;\n\npub type AccessoryDatabase = Arc<Mutex<storage::accessory_database::AccessoryDatabase>>;\n\npub type Accessory = Arc<Mutex<Box<dyn accessory::HapAccessory>>>;\n\npub type Storage = Arc<Mutex<Box<dyn storage::Storage>>>;\n\npub type Config = Arc<Mutex<crate::Config>>;\n\npub type MdnsResponder = Arc<Mutex<crate::transport::mdns::MdnsResponder>>;\n"
  },
  {
    "path": "src/server/ip.rs",
    "content": "use async_trait::async_trait;\nuse futures::{\n    future::{BoxFuture, FutureExt},\n    lock::Mutex,\n};\nuse log::{error, info};\nuse std::sync::Arc;\n\nuse crate::{\n    accessory::HapAccessory,\n    config::Config,\n    event::{Event, EventEmitter},\n    pointer,\n    server::Server,\n    storage::{accessory_database::AccessoryDatabase, Storage},\n    transport::{http::server::Server as HttpServer, mdns::MdnsResponder},\n    BonjourStatusFlag,\n    Result,\n};\n\n/// HAP Server via TCP/IP.\n#[derive(Clone)]\npub struct IpServer {\n    config: pointer::Config,\n    storage: pointer::Storage,\n    accessory_database: pointer::AccessoryDatabase,\n    http_server: HttpServer,\n    mdns_responder: pointer::MdnsResponder,\n    aid_cache: Arc<Mutex<Vec<u64>>>,\n}\n\nimpl IpServer {\n    /// Creates a new [`IpServer`](IpServer).\n    ///\n    /// # Examples\n    /// ```no_run\n    /// use tokio;\n    ///\n    /// use hap::{\n    ///     accessory::{lightbulb::LightbulbAccessory, AccessoryCategory, AccessoryInformation},\n    ///     server::{IpServer, Server},\n    ///     storage::{FileStorage, Storage},\n    ///     Config,\n    ///     MacAddress,\n    ///     Pin,\n    ///     Result,\n    /// };\n    ///\n    /// #[tokio::main]\n    /// async fn main() -> Result<()> {\n    ///     let lightbulb = LightbulbAccessory::new(1, AccessoryInformation {\n    ///         name: \"Acme Lightbulb\".into(),\n    ///         ..Default::default()\n    ///     })?;\n    ///\n    ///     let mut storage = FileStorage::current_dir().await?;\n    ///\n    ///     let config = match storage.load_config().await {\n    ///         Ok(mut config) => {\n    ///             config.redetermine_local_ip();\n    ///             storage.save_config(&config).await?;\n    ///             config\n    ///         },\n    ///         Err(_) => {\n    ///             let config = Config {\n    ///                 pin: Pin::new([1, 1, 1, 2, 2, 3, 3, 3])?,\n    ///                 name: \"Acme Lightbulb\".into(),\n    ///                 device_id: MacAddress::from([10, 20, 30, 40, 50, 60]),\n    ///                 category: AccessoryCategory::Lightbulb,\n    ///                 ..Default::default()\n    ///             };\n    ///             storage.save_config(&config).await?;\n    ///             config\n    ///         },\n    ///     };\n    ///\n    ///     let mut server = IpServer::new(config, storage).await?;\n    ///     server.add_accessory(lightbulb).await?;\n    ///\n    ///     let handle = server.run_handle();\n    ///\n    ///     std::env::set_var(\"RUST_LOG\", \"hap=info\");\n    ///     env_logger::init();\n    ///\n    ///     handle.await\n    /// }\n    /// ```\n    pub async fn new<S: Storage + Send + Sync + 'static>(config: Config, storage: S) -> Result<Self> {\n        let config = Arc::new(Mutex::new(config));\n        let storage: pointer::Storage = Arc::new(Mutex::new(Box::new(storage)));\n\n        let config_ = config.clone();\n        let storage_ = storage.clone();\n        let mut event_emitter = EventEmitter::new();\n\n        let mut s = storage_.lock().await;\n        if s.count_pairings().await? > 0 {\n            info!(\"1 or more controllers paired; setting Bonjour status flag to `Zero`\");\n\n            let mut c = config_.lock().await;\n            c.status_flag = BonjourStatusFlag::Zero;\n\n            s.save_config(&c).await?;\n        } else {\n            info!(\"0 controllers paired; setting Bonjour status flag to `Not Paired`\");\n\n            let mut c = config_.lock().await;\n            c.status_flag = BonjourStatusFlag::NotPaired;\n\n            s.save_config(&c).await?;\n        }\n        drop(s);\n\n        let mdns_responder = Arc::new(Mutex::new(MdnsResponder::new(config.clone()).await));\n        let mdns_responder_ = mdns_responder.clone();\n\n        event_emitter.add_listener(Box::new(move |event| {\n            let config_ = config_.clone();\n            let storage_ = storage_.clone();\n            let mdns_responder_ = mdns_responder_.clone();\n            async move {\n                match *event {\n                    Event::ControllerPaired { id } => {\n                        info!(\"controller {} paired\", id);\n\n                        let pairing_count = storage_.lock().await.count_pairings().await;\n                        if let Ok(count) = pairing_count {\n                            if count > 0 {\n                                info!(\"1 or more controllers paired; setting Bonjour status flag to `Zero`\");\n\n                                let mut c = config_.lock().await;\n                                c.status_flag = BonjourStatusFlag::Zero;\n\n                                storage_\n                                    .lock()\n                                    .await\n                                    .save_config(&c)\n                                    .await\n                                    .map_err(|e| error!(\"error saving the config: {:?}\", e))\n                                    .ok();\n\n                                drop(c);\n\n                                mdns_responder_.lock().await.update_records().await;\n                            }\n                        }\n                    },\n                    Event::ControllerUnpaired { id } => {\n                        info!(\"controller {} unpaired\", id);\n\n                        let pairing_count = storage_.lock().await.count_pairings().await;\n                        // TODO - `pairing_count` is an Err\n                        if let Ok(count) = pairing_count {\n                            if count == 0 {\n                                info!(\"0 controllers paired; setting Bonjour status flag to `Not Paired`\");\n\n                                let mut c = config_.lock().await;\n                                c.status_flag = BonjourStatusFlag::NotPaired;\n\n                                storage_\n                                    .lock()\n                                    .await\n                                    .save_config(&c)\n                                    .await\n                                    .map_err(|e| error!(\"error saving the config: {:?}\", e))\n                                    .ok();\n\n                                drop(c);\n\n                                mdns_responder_.lock().await.update_records().await;\n                            }\n                        }\n                    },\n                    _ => {},\n                }\n            }\n            .boxed()\n        }));\n\n        let event_emitter = Arc::new(Mutex::new(event_emitter));\n        let accessory_database = Arc::new(Mutex::new(AccessoryDatabase::new(event_emitter.clone())));\n\n        let http_server = HttpServer::new(\n            config.clone(),\n            storage.clone(),\n            accessory_database.clone(),\n            event_emitter,\n            mdns_responder.clone(),\n        );\n\n        let mut storage_lock = storage.lock().await;\n        let aid_cache = Arc::new(Mutex::new(match storage_lock.load_aid_cache().await {\n            Ok(aid_cache) => aid_cache,\n            Err(_) => {\n                storage_lock.delete_aid_cache().await.ok();\n                let aid_cache = Vec::new();\n                storage_lock.save_aid_cache(&aid_cache).await?;\n                aid_cache\n            },\n        }));\n        drop(storage_lock);\n\n        let server = IpServer {\n            config,\n            storage,\n            accessory_database,\n            http_server,\n            mdns_responder,\n            aid_cache,\n        };\n\n        Ok(server)\n    }\n}\n\n#[async_trait]\nimpl Server for IpServer {\n    fn run_handle(&self) -> BoxFuture<Result<()>> {\n        let http_handle = self.http_server.run_handle();\n        let mdns_responder = self.mdns_responder.clone();\n\n        let handle = async move {\n            let mdns_handle = mdns_responder.lock().await.run_handle();\n\n            futures::try_join!(http_handle, mdns_handle.map(|_| Ok(())))?;\n\n            Ok(())\n        }\n        .boxed();\n\n        Box::pin(handle)\n    }\n\n    fn config_pointer(&self) -> pointer::Config { self.config.clone() }\n\n    fn storage_pointer(&self) -> pointer::Storage { self.storage.clone() }\n\n    async fn add_accessory<A: HapAccessory + 'static>(&self, accessory: A) -> Result<pointer::Accessory> {\n        let aid = accessory.get_id();\n\n        let accessory = self\n            .accessory_database\n            .lock()\n            .await\n            .add_accessory(Box::new(accessory))?;\n\n        let mut aid_cache = self.aid_cache.lock().await;\n        if !aid_cache.contains(&aid) {\n            aid_cache.push(aid);\n            self.storage.lock().await.save_aid_cache(&aid_cache).await?;\n\n            let mut config = self.config.lock().await;\n            config.configuration_number += 1;\n            self.storage.lock().await.save_config(&config).await?;\n        }\n\n        Ok(accessory)\n    }\n\n    async fn remove_accessory(&self, accessory: &pointer::Accessory) -> Result<()> {\n        let aid = accessory.lock().await.get_id();\n\n        self.accessory_database\n            .lock()\n            .await\n            .remove_accessory(&accessory)\n            .await?;\n\n        let mut aid_cache = self.aid_cache.lock().await;\n        if aid_cache.contains(&aid) {\n            aid_cache.retain(|id| *id != aid);\n            self.storage.lock().await.save_aid_cache(&aid_cache).await?;\n\n            let mut config = self.config.lock().await;\n            config.configuration_number += 1;\n        }\n\n        Ok(())\n    }\n\n    // async fn factory_reset(&mut self) -> Result<()> {\n    //     unimplemented!();\n\n    //     Ok(())\n    // }\n}\n"
  },
  {
    "path": "src/server/mod.rs",
    "content": "use async_trait::async_trait;\nuse futures::future::BoxFuture;\n\nuse crate::{accessory::HapAccessory, pointer, Result};\npub use ip::IpServer;\n\nmod ip;\n\n/// [`Server`](Server) is implemented by the transport methods this crate supports. Currently, that's just\n/// [`IpServer`](IpServer).\n#[async_trait]\npub trait Server {\n    /// Returns a [`BoxFuture`](BoxFuture) run handle to the server that can be passed to an executor.\n    fn run_handle(&self) -> BoxFuture<Result<()>>;\n    /// Returns a pointer to the [`Config`](crate::Config) of the server.\n    fn config_pointer(&self) -> pointer::Config;\n    /// Returns a pointer to the [`Storage`](crate::storage::Storage) of the server.\n    fn storage_pointer(&self) -> pointer::Storage;\n    /// Adds an accessory to the server and returns a pointer to it.\n    async fn add_accessory<A: HapAccessory + 'static>(&self, accessory: A) -> Result<pointer::Accessory>;\n    /// Takes a pointer to an accessory and removes it from the server.\n    async fn remove_accessory(&self, accessory: &pointer::Accessory) -> Result<()>;\n    // /// Every accessory must support a manufacturer-defined mechanism to restore itself to a “factory reset” state\n    // where /// all pairing information is erased and restored to factory default settings. This method is doing\n    // just that. async fn factory_reset(&mut self) -> Result<()>;\n}\n"
  },
  {
    "path": "src/service/generated/access_code.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\taccess_code_control_point::AccessCodeControlPointCharacteristic,\n\t\taccess_code_supported_configuration::AccessCodeSupportedConfigurationCharacteristic,\n\t\tconfiguration_state::ConfigurationStateCharacteristic,\n\t},\n    HapType,\n};\n\n/// Access Code service.\n#[derive(Debug, Default)]\npub struct AccessCodeService {\n    /// Instance ID of the Access Code service.\n    id: u64,\n    /// [`HapType`](HapType) of the Access Code service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Access Code Control Point characteristic (required).\n\tpub access_code_control_point: AccessCodeControlPointCharacteristic,\n\t/// Access Code Supported Configuration characteristic (required).\n\tpub access_code_supported_configuration: AccessCodeSupportedConfigurationCharacteristic,\n\t/// Configuration State characteristic (required).\n\tpub configuration_state: ConfigurationStateCharacteristic,\n\n}\n\nimpl AccessCodeService {\n    /// Creates a new Access Code service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::AccessCode,\n\t\t\taccess_code_control_point: AccessCodeControlPointCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\taccess_code_supported_configuration: AccessCodeSupportedConfigurationCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tconfiguration_state: ConfigurationStateCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for AccessCodeService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.access_code_control_point,\n\t\t\t&self.access_code_supported_configuration,\n\t\t\t&self.configuration_state,\n\t\t];\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.access_code_control_point,\n\t\t\t&mut self.access_code_supported_configuration,\n\t\t\t&mut self.configuration_state,\n\t\t];\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for AccessCodeService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/access_control.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\taccess_control_level::AccessControlLevelCharacteristic,\n\t\tpassword_setting::PasswordSettingCharacteristic,\n\t},\n    HapType,\n};\n\n/// Access Control service.\n#[derive(Debug, Default)]\npub struct AccessControlService {\n    /// Instance ID of the Access Control service.\n    id: u64,\n    /// [`HapType`](HapType) of the Access Control service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Access Control Level characteristic (required).\n\tpub access_control_level: AccessControlLevelCharacteristic,\n\n\t/// Password Setting characteristic (optional).\n\tpub password_setting: Option<PasswordSettingCharacteristic>,\n}\n\nimpl AccessControlService {\n    /// Creates a new Access Control service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::AccessControl,\n\t\t\taccess_control_level: AccessControlLevelCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tpassword_setting: Some(PasswordSettingCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for AccessControlService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.access_control_level,\n\t\t];\n\t\tif let Some(c) = &self.password_setting {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.access_control_level,\n\t\t];\n\t\tif let Some(c) = &mut self.password_setting {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for AccessControlService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/accessory_information.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tidentify::IdentifyCharacteristic,\n\t\tmanufacturer::ManufacturerCharacteristic,\n\t\tmodel::ModelCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tserial_number::SerialNumberCharacteristic,\n\t\taccessory_flags::AccessoryFlagsCharacteristic,\n\t\tapplication_matching_identifier::ApplicationMatchingIdentifierCharacteristic,\n\t\tconfigured_name::ConfiguredNameCharacteristic,\n\t\tfirmware_revision::FirmwareRevisionCharacteristic,\n\t\thardware_finish::HardwareFinishCharacteristic,\n\t\thardware_revision::HardwareRevisionCharacteristic,\n\t\tproduct_data::ProductDataCharacteristic,\n\t\tsoftware_revision::SoftwareRevisionCharacteristic,\n\t},\n    HapType,\n};\n\n/// Accessory Information service.\n#[derive(Debug, Default)]\npub struct AccessoryInformationService {\n    /// Instance ID of the Accessory Information service.\n    id: u64,\n    /// [`HapType`](HapType) of the Accessory Information service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Identify characteristic (required).\n\tpub identify: IdentifyCharacteristic,\n\t/// Manufacturer characteristic (required).\n\tpub manufacturer: ManufacturerCharacteristic,\n\t/// Model characteristic (required).\n\tpub model: ModelCharacteristic,\n\t/// Name characteristic (required).\n\tpub name: NameCharacteristic,\n\t/// Serial Number characteristic (required).\n\tpub serial_number: SerialNumberCharacteristic,\n\n\t/// Accessory Flags characteristic (optional).\n\tpub accessory_flags: Option<AccessoryFlagsCharacteristic>,\n\t/// Application Matching Identifier characteristic (optional).\n\tpub application_matching_identifier: Option<ApplicationMatchingIdentifierCharacteristic>,\n\t/// Configured Name characteristic (optional).\n\tpub configured_name: Option<ConfiguredNameCharacteristic>,\n\t/// Firmware Revision characteristic (optional).\n\tpub firmware_revision: Option<FirmwareRevisionCharacteristic>,\n\t/// Hardware Finish characteristic (optional).\n\tpub hardware_finish: Option<HardwareFinishCharacteristic>,\n\t/// Hardware Revision characteristic (optional).\n\tpub hardware_revision: Option<HardwareRevisionCharacteristic>,\n\t/// Product Data characteristic (optional).\n\tpub product_data: Option<ProductDataCharacteristic>,\n\t/// Software Revision characteristic (optional).\n\tpub software_revision: Option<SoftwareRevisionCharacteristic>,\n}\n\nimpl AccessoryInformationService {\n    /// Creates a new Accessory Information service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::AccessoryInformation,\n\t\t\tidentify: IdentifyCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tmanufacturer: ManufacturerCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tmodel: ModelCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\tname: NameCharacteristic::new(id + 1 + 3, accessory_id),\n\t\t\tserial_number: SerialNumberCharacteristic::new(id + 1 + 4, accessory_id),\n\t\t\taccessory_flags: Some(AccessoryFlagsCharacteristic::new(id + 1 + 0 + 5, accessory_id)),\n\t\t\tapplication_matching_identifier: Some(ApplicationMatchingIdentifierCharacteristic::new(id + 1 + 1 + 5, accessory_id)),\n\t\t\tconfigured_name: Some(ConfiguredNameCharacteristic::new(id + 1 + 2 + 5, accessory_id)),\n\t\t\tfirmware_revision: Some(FirmwareRevisionCharacteristic::new(id + 1 + 3 + 5, accessory_id)),\n\t\t\thardware_finish: Some(HardwareFinishCharacteristic::new(id + 1 + 4 + 5, accessory_id)),\n\t\t\thardware_revision: Some(HardwareRevisionCharacteristic::new(id + 1 + 5 + 5, accessory_id)),\n\t\t\tproduct_data: Some(ProductDataCharacteristic::new(id + 1 + 6 + 5, accessory_id)),\n\t\t\tsoftware_revision: Some(SoftwareRevisionCharacteristic::new(id + 1 + 7 + 5, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for AccessoryInformationService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.identify,\n\t\t\t&self.manufacturer,\n\t\t\t&self.model,\n\t\t\t&self.name,\n\t\t\t&self.serial_number,\n\t\t];\n\t\tif let Some(c) = &self.accessory_flags {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.application_matching_identifier {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.configured_name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.firmware_revision {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.hardware_finish {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.hardware_revision {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.product_data {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.software_revision {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.identify,\n\t\t\t&mut self.manufacturer,\n\t\t\t&mut self.model,\n\t\t\t&mut self.name,\n\t\t\t&mut self.serial_number,\n\t\t];\n\t\tif let Some(c) = &mut self.accessory_flags {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.application_matching_identifier {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.configured_name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.firmware_revision {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.hardware_finish {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.hardware_revision {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.product_data {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.software_revision {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for AccessoryInformationService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/accessory_metrics.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tactive::ActiveCharacteristic,\n\t},\n    HapType,\n};\n\n/// Accessory Metrics service.\n#[derive(Debug, Default)]\npub struct AccessoryMetricsService {\n    /// Instance ID of the Accessory Metrics service.\n    id: u64,\n    /// [`HapType`](HapType) of the Accessory Metrics service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Active characteristic (required).\n\tpub active: ActiveCharacteristic,\n\n}\n\nimpl AccessoryMetricsService {\n    /// Creates a new Accessory Metrics service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::AccessoryMetrics,\n\t\t\tactive: ActiveCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for AccessoryMetricsService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.active,\n\t\t];\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.active,\n\t\t];\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for AccessoryMetricsService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/accessory_runtime_information.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tping::PingCharacteristic,\n\t\tactivity_interval::ActivityIntervalCharacteristic,\n\t\theart_beat::HeartBeatCharacteristic,\n\t\tsleep_interval::SleepIntervalCharacteristic,\n\t},\n    HapType,\n};\n\n/// Accessory Runtime Information service.\n#[derive(Debug, Default)]\npub struct AccessoryRuntimeInformationService {\n    /// Instance ID of the Accessory Runtime Information service.\n    id: u64,\n    /// [`HapType`](HapType) of the Accessory Runtime Information service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Ping characteristic (required).\n\tpub ping: PingCharacteristic,\n\n\t/// Activity Interval characteristic (optional).\n\tpub activity_interval: Option<ActivityIntervalCharacteristic>,\n\t/// Heart Beat characteristic (optional).\n\tpub heart_beat: Option<HeartBeatCharacteristic>,\n\t/// Sleep Interval characteristic (optional).\n\tpub sleep_interval: Option<SleepIntervalCharacteristic>,\n}\n\nimpl AccessoryRuntimeInformationService {\n    /// Creates a new Accessory Runtime Information service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::AccessoryRuntimeInformation,\n\t\t\tping: PingCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tactivity_interval: Some(ActivityIntervalCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\theart_beat: Some(HeartBeatCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\tsleep_interval: Some(SleepIntervalCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for AccessoryRuntimeInformationService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.ping,\n\t\t];\n\t\tif let Some(c) = &self.activity_interval {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.heart_beat {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.sleep_interval {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.ping,\n\t\t];\n\t\tif let Some(c) = &mut self.activity_interval {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.heart_beat {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.sleep_interval {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for AccessoryRuntimeInformationService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/air_purifier.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tactive::ActiveCharacteristic,\n\t\tcurrent_air_purifier_state::CurrentAirPurifierStateCharacteristic,\n\t\ttarget_air_purifier_state::TargetAirPurifierStateCharacteristic,\n\t\tlock_physical_controls::LockPhysicalControlsCharacteristic,\n\t\tname::NameCharacteristic,\n\t\trotation_speed::RotationSpeedCharacteristic,\n\t\tswing_mode::SwingModeCharacteristic,\n\t},\n    HapType,\n};\n\n/// Air Purifier service.\n#[derive(Debug, Default)]\npub struct AirPurifierService {\n    /// Instance ID of the Air Purifier service.\n    id: u64,\n    /// [`HapType`](HapType) of the Air Purifier service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Active characteristic (required).\n\tpub active: ActiveCharacteristic,\n\t/// Current Air Purifier State characteristic (required).\n\tpub current_air_purifier_state: CurrentAirPurifierStateCharacteristic,\n\t/// Target Air Purifier State characteristic (required).\n\tpub target_air_purifier_state: TargetAirPurifierStateCharacteristic,\n\n\t/// Lock Physical Controls characteristic (optional).\n\tpub lock_physical_controls: Option<LockPhysicalControlsCharacteristic>,\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Rotation Speed characteristic (optional).\n\tpub rotation_speed: Option<RotationSpeedCharacteristic>,\n\t/// Swing Mode characteristic (optional).\n\tpub swing_mode: Option<SwingModeCharacteristic>,\n}\n\nimpl AirPurifierService {\n    /// Creates a new Air Purifier service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::AirPurifier,\n\t\t\tactive: ActiveCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tcurrent_air_purifier_state: CurrentAirPurifierStateCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\ttarget_air_purifier_state: TargetAirPurifierStateCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\tlock_physical_controls: Some(LockPhysicalControlsCharacteristic::new(id + 1 + 0 + 3, accessory_id)),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 1 + 3, accessory_id)),\n\t\t\trotation_speed: Some(RotationSpeedCharacteristic::new(id + 1 + 2 + 3, accessory_id)),\n\t\t\tswing_mode: Some(SwingModeCharacteristic::new(id + 1 + 3 + 3, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for AirPurifierService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.active,\n\t\t\t&self.current_air_purifier_state,\n\t\t\t&self.target_air_purifier_state,\n\t\t];\n\t\tif let Some(c) = &self.lock_physical_controls {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.rotation_speed {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.swing_mode {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.active,\n\t\t\t&mut self.current_air_purifier_state,\n\t\t\t&mut self.target_air_purifier_state,\n\t\t];\n\t\tif let Some(c) = &mut self.lock_physical_controls {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.rotation_speed {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.swing_mode {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for AirPurifierService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/air_quality_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tcurrent_air_quality::CurrentAirQualityCharacteristic,\n\t\tnitrogen_dioxide_density::NitrogenDioxideDensityCharacteristic,\n\t\tozone_density::OzoneDensityCharacteristic,\n\t\tpm10_density::Pm10DensityCharacteristic,\n\t\tpm2_5_density::Pm2_5DensityCharacteristic,\n\t\tsulphur_dioxide_density::SulphurDioxideDensityCharacteristic,\n\t\tvolatile_organic_compound_density::VolatileOrganicCompoundDensityCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tstatus_active::StatusActiveCharacteristic,\n\t\tstatus_fault::StatusFaultCharacteristic,\n\t\tstatus_low_battery::StatusLowBatteryCharacteristic,\n\t\tstatus_tampered::StatusTamperedCharacteristic,\n\t},\n    HapType,\n};\n\n/// Air Quality Sensor service.\n#[derive(Debug, Default)]\npub struct AirQualitySensorService {\n    /// Instance ID of the Air Quality Sensor service.\n    id: u64,\n    /// [`HapType`](HapType) of the Air Quality Sensor service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Current Air Quality characteristic (required).\n\tpub current_air_quality: CurrentAirQualityCharacteristic,\n\n\t/// Nitrogen dioxide Density characteristic (optional).\n\tpub nitrogen_dioxide_density: Option<NitrogenDioxideDensityCharacteristic>,\n\t/// Ozone Density characteristic (optional).\n\tpub ozone_density: Option<OzoneDensityCharacteristic>,\n\t/// PM10 Density characteristic (optional).\n\tpub pm10_density: Option<Pm10DensityCharacteristic>,\n\t/// PM2.5 Density characteristic (optional).\n\tpub pm2_5_density: Option<Pm2_5DensityCharacteristic>,\n\t/// Sulphur dioxide Density characteristic (optional).\n\tpub sulphur_dioxide_density: Option<SulphurDioxideDensityCharacteristic>,\n\t/// Volatile Organic Compound Density characteristic (optional).\n\tpub volatile_organic_compound_density: Option<VolatileOrganicCompoundDensityCharacteristic>,\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Status Active characteristic (optional).\n\tpub status_active: Option<StatusActiveCharacteristic>,\n\t/// Status Fault characteristic (optional).\n\tpub status_fault: Option<StatusFaultCharacteristic>,\n\t/// Status Low Battery characteristic (optional).\n\tpub status_low_battery: Option<StatusLowBatteryCharacteristic>,\n\t/// Status Tampered characteristic (optional).\n\tpub status_tampered: Option<StatusTamperedCharacteristic>,\n}\n\nimpl AirQualitySensorService {\n    /// Creates a new Air Quality Sensor service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::AirQualitySensor,\n\t\t\tcurrent_air_quality: CurrentAirQualityCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tnitrogen_dioxide_density: Some(NitrogenDioxideDensityCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tozone_density: Some(OzoneDensityCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\tpm10_density: Some(Pm10DensityCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\tpm2_5_density: Some(Pm2_5DensityCharacteristic::new(id + 1 + 3 + 1, accessory_id)),\n\t\t\tsulphur_dioxide_density: Some(SulphurDioxideDensityCharacteristic::new(id + 1 + 4 + 1, accessory_id)),\n\t\t\tvolatile_organic_compound_density: Some(VolatileOrganicCompoundDensityCharacteristic::new(id + 1 + 5 + 1, accessory_id)),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 6 + 1, accessory_id)),\n\t\t\tstatus_active: Some(StatusActiveCharacteristic::new(id + 1 + 7 + 1, accessory_id)),\n\t\t\tstatus_fault: Some(StatusFaultCharacteristic::new(id + 1 + 8 + 1, accessory_id)),\n\t\t\tstatus_low_battery: Some(StatusLowBatteryCharacteristic::new(id + 1 + 9 + 1, accessory_id)),\n\t\t\tstatus_tampered: Some(StatusTamperedCharacteristic::new(id + 1 + 10 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for AirQualitySensorService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.current_air_quality,\n\t\t];\n\t\tif let Some(c) = &self.nitrogen_dioxide_density {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.ozone_density {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.pm10_density {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.pm2_5_density {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.sulphur_dioxide_density {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.volatile_organic_compound_density {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.current_air_quality,\n\t\t];\n\t\tif let Some(c) = &mut self.nitrogen_dioxide_density {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.ozone_density {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.pm10_density {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.pm2_5_density {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.sulphur_dioxide_density {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.volatile_organic_compound_density {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for AirQualitySensorService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/asset_update.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tasset_update_readiness::AssetUpdateReadinessCharacteristic,\n\t\tsupported_asset_types::SupportedAssetTypesCharacteristic,\n\t},\n    HapType,\n};\n\n/// Asset Update service.\n#[derive(Debug, Default)]\npub struct AssetUpdateService {\n    /// Instance ID of the Asset Update service.\n    id: u64,\n    /// [`HapType`](HapType) of the Asset Update service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Asset Update Readiness characteristic (required).\n\tpub asset_update_readiness: AssetUpdateReadinessCharacteristic,\n\t/// Supported Asset Types characteristic (required).\n\tpub supported_asset_types: SupportedAssetTypesCharacteristic,\n\n}\n\nimpl AssetUpdateService {\n    /// Creates a new Asset Update service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::AssetUpdate,\n\t\t\tasset_update_readiness: AssetUpdateReadinessCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tsupported_asset_types: SupportedAssetTypesCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for AssetUpdateService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.asset_update_readiness,\n\t\t\t&self.supported_asset_types,\n\t\t];\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.asset_update_readiness,\n\t\t\t&mut self.supported_asset_types,\n\t\t];\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for AssetUpdateService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/assistant.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tactive::ActiveCharacteristic,\n\t\tidentifier::IdentifierCharacteristic,\n\t\tname::NameCharacteristic,\n\t},\n    HapType,\n};\n\n/// Assistant service.\n#[derive(Debug, Default)]\npub struct AssistantService {\n    /// Instance ID of the Assistant service.\n    id: u64,\n    /// [`HapType`](HapType) of the Assistant service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Active characteristic (required).\n\tpub active: ActiveCharacteristic,\n\t/// Identifier characteristic (required).\n\tpub identifier: IdentifierCharacteristic,\n\t/// Name characteristic (required).\n\tpub name: NameCharacteristic,\n\n}\n\nimpl AssistantService {\n    /// Creates a new Assistant service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Assistant,\n\t\t\tactive: ActiveCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tidentifier: IdentifierCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tname: NameCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for AssistantService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.active,\n\t\t\t&self.identifier,\n\t\t\t&self.name,\n\t\t];\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.active,\n\t\t\t&mut self.identifier,\n\t\t\t&mut self.name,\n\t\t];\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for AssistantService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/audio_stream_management.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tsupported_audio_stream_configuration::SupportedAudioStreamConfigurationCharacteristic,\n\t\tselected_audio_stream_configuration::SelectedAudioStreamConfigurationCharacteristic,\n\t},\n    HapType,\n};\n\n/// Audio Stream Management service.\n#[derive(Debug, Default)]\npub struct AudioStreamManagementService {\n    /// Instance ID of the Audio Stream Management service.\n    id: u64,\n    /// [`HapType`](HapType) of the Audio Stream Management service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Supported Audio Stream Configuration characteristic (required).\n\tpub supported_audio_stream_configuration: SupportedAudioStreamConfigurationCharacteristic,\n\t/// Selected Audio Stream Configuration characteristic (required).\n\tpub selected_audio_stream_configuration: SelectedAudioStreamConfigurationCharacteristic,\n\n}\n\nimpl AudioStreamManagementService {\n    /// Creates a new Audio Stream Management service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::AudioStreamManagement,\n\t\t\tsupported_audio_stream_configuration: SupportedAudioStreamConfigurationCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tselected_audio_stream_configuration: SelectedAudioStreamConfigurationCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for AudioStreamManagementService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.supported_audio_stream_configuration,\n\t\t\t&self.selected_audio_stream_configuration,\n\t\t];\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.supported_audio_stream_configuration,\n\t\t\t&mut self.selected_audio_stream_configuration,\n\t\t];\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for AudioStreamManagementService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/battery.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tstatus_low_battery::StatusLowBatteryCharacteristic,\n\t\tbattery_level::BatteryLevelCharacteristic,\n\t\tcharging_state::ChargingStateCharacteristic,\n\t\tname::NameCharacteristic,\n\t},\n    HapType,\n};\n\n/// Battery service.\n#[derive(Debug, Default)]\npub struct BatteryService {\n    /// Instance ID of the Battery service.\n    id: u64,\n    /// [`HapType`](HapType) of the Battery service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Status Low Battery characteristic (required).\n\tpub status_low_battery: StatusLowBatteryCharacteristic,\n\n\t/// Battery Level characteristic (optional).\n\tpub battery_level: Option<BatteryLevelCharacteristic>,\n\t/// Charging State characteristic (optional).\n\tpub charging_state: Option<ChargingStateCharacteristic>,\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n}\n\nimpl BatteryService {\n    /// Creates a new Battery service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Battery,\n\t\t\tstatus_low_battery: StatusLowBatteryCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tbattery_level: Some(BatteryLevelCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tcharging_state: Some(ChargingStateCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for BatteryService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.status_low_battery,\n\t\t];\n\t\tif let Some(c) = &self.battery_level {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.charging_state {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.status_low_battery,\n\t\t];\n\t\tif let Some(c) = &mut self.battery_level {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.charging_state {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for BatteryService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/camera_operating_mode.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tevent_snapshots_active::EventSnapshotsActiveCharacteristic,\n\t\thomekit_camera_active::HomekitCameraActiveCharacteristic,\n\t\tcamera_operating_mode_indicator::CameraOperatingModeIndicatorCharacteristic,\n\t\tmanually_disabled::ManuallyDisabledCharacteristic,\n\t\tnight_vision::NightVisionCharacteristic,\n\t\tperiodic_snapshots_active::PeriodicSnapshotsActiveCharacteristic,\n\t\tthird_party_camera_active::ThirdPartyCameraActiveCharacteristic,\n\t},\n    HapType,\n};\n\n/// Camera Operating Mode service.\n#[derive(Debug, Default)]\npub struct CameraOperatingModeService {\n    /// Instance ID of the Camera Operating Mode service.\n    id: u64,\n    /// [`HapType`](HapType) of the Camera Operating Mode service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Event Snapshots Active characteristic (required).\n\tpub event_snapshots_active: EventSnapshotsActiveCharacteristic,\n\t/// HomeKit Camera Active characteristic (required).\n\tpub homekit_camera_active: HomekitCameraActiveCharacteristic,\n\n\t/// Camera Operating Mode Indicator characteristic (optional).\n\tpub camera_operating_mode_indicator: Option<CameraOperatingModeIndicatorCharacteristic>,\n\t/// Manually disabled characteristic (optional).\n\tpub manually_disabled: Option<ManuallyDisabledCharacteristic>,\n\t/// Night Vision characteristic (optional).\n\tpub night_vision: Option<NightVisionCharacteristic>,\n\t/// Periodic Snapshots Active characteristic (optional).\n\tpub periodic_snapshots_active: Option<PeriodicSnapshotsActiveCharacteristic>,\n\t/// Third Party Camera Active characteristic (optional).\n\tpub third_party_camera_active: Option<ThirdPartyCameraActiveCharacteristic>,\n}\n\nimpl CameraOperatingModeService {\n    /// Creates a new Camera Operating Mode service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::CameraOperatingMode,\n\t\t\tevent_snapshots_active: EventSnapshotsActiveCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\thomekit_camera_active: HomekitCameraActiveCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tcamera_operating_mode_indicator: Some(CameraOperatingModeIndicatorCharacteristic::new(id + 1 + 0 + 2, accessory_id)),\n\t\t\tmanually_disabled: Some(ManuallyDisabledCharacteristic::new(id + 1 + 1 + 2, accessory_id)),\n\t\t\tnight_vision: Some(NightVisionCharacteristic::new(id + 1 + 2 + 2, accessory_id)),\n\t\t\tperiodic_snapshots_active: Some(PeriodicSnapshotsActiveCharacteristic::new(id + 1 + 3 + 2, accessory_id)),\n\t\t\tthird_party_camera_active: Some(ThirdPartyCameraActiveCharacteristic::new(id + 1 + 4 + 2, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for CameraOperatingModeService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.event_snapshots_active,\n\t\t\t&self.homekit_camera_active,\n\t\t];\n\t\tif let Some(c) = &self.camera_operating_mode_indicator {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.manually_disabled {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.night_vision {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.periodic_snapshots_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.third_party_camera_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.event_snapshots_active,\n\t\t\t&mut self.homekit_camera_active,\n\t\t];\n\t\tif let Some(c) = &mut self.camera_operating_mode_indicator {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.manually_disabled {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.night_vision {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.periodic_snapshots_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.third_party_camera_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for CameraOperatingModeService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/camera_recording_management.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tactive::ActiveCharacteristic,\n\t\tsupported_camera_recording_configuration::SupportedCameraRecordingConfigurationCharacteristic,\n\t\tsupported_video_recording_configuration::SupportedVideoRecordingConfigurationCharacteristic,\n\t\tsupported_audio_recording_configuration::SupportedAudioRecordingConfigurationCharacteristic,\n\t\tselected_camera_recording_configuration::SelectedCameraRecordingConfigurationCharacteristic,\n\t\trecording_audio_active::RecordingAudioActiveCharacteristic,\n\t},\n    HapType,\n};\n\n/// Camera Recording Management service.\n#[derive(Debug, Default)]\npub struct CameraRecordingManagementService {\n    /// Instance ID of the Camera Recording Management service.\n    id: u64,\n    /// [`HapType`](HapType) of the Camera Recording Management service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Active characteristic (required).\n\tpub active: ActiveCharacteristic,\n\t/// Supported Camera Recording Configuration characteristic (required).\n\tpub supported_camera_recording_configuration: SupportedCameraRecordingConfigurationCharacteristic,\n\t/// Supported Video Recording Configuration characteristic (required).\n\tpub supported_video_recording_configuration: SupportedVideoRecordingConfigurationCharacteristic,\n\t/// Supported Audio Recording Configuration characteristic (required).\n\tpub supported_audio_recording_configuration: SupportedAudioRecordingConfigurationCharacteristic,\n\t/// Selected Camera Recording Configuration characteristic (required).\n\tpub selected_camera_recording_configuration: SelectedCameraRecordingConfigurationCharacteristic,\n\n\t/// recording audio active characteristic (optional).\n\tpub recording_audio_active: Option<RecordingAudioActiveCharacteristic>,\n}\n\nimpl CameraRecordingManagementService {\n    /// Creates a new Camera Recording Management service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::CameraRecordingManagement,\n\t\t\tactive: ActiveCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tsupported_camera_recording_configuration: SupportedCameraRecordingConfigurationCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tsupported_video_recording_configuration: SupportedVideoRecordingConfigurationCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\tsupported_audio_recording_configuration: SupportedAudioRecordingConfigurationCharacteristic::new(id + 1 + 3, accessory_id),\n\t\t\tselected_camera_recording_configuration: SelectedCameraRecordingConfigurationCharacteristic::new(id + 1 + 4, accessory_id),\n\t\t\trecording_audio_active: Some(RecordingAudioActiveCharacteristic::new(id + 1 + 0 + 5, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for CameraRecordingManagementService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.active,\n\t\t\t&self.supported_camera_recording_configuration,\n\t\t\t&self.supported_video_recording_configuration,\n\t\t\t&self.supported_audio_recording_configuration,\n\t\t\t&self.selected_camera_recording_configuration,\n\t\t];\n\t\tif let Some(c) = &self.recording_audio_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.active,\n\t\t\t&mut self.supported_camera_recording_configuration,\n\t\t\t&mut self.supported_video_recording_configuration,\n\t\t\t&mut self.supported_audio_recording_configuration,\n\t\t\t&mut self.selected_camera_recording_configuration,\n\t\t];\n\t\tif let Some(c) = &mut self.recording_audio_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for CameraRecordingManagementService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/camera_stream_management.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tselected_stream_configuration::SelectedStreamConfigurationCharacteristic,\n\t\tsetup_endpoint::SetupEndpointCharacteristic,\n\t\tstreaming_status::StreamingStatusCharacteristic,\n\t\tsupported_audio_stream_configuration::SupportedAudioStreamConfigurationCharacteristic,\n\t\tsupported_rtp_configuration::SupportedRtpConfigurationCharacteristic,\n\t\tsupported_video_stream_configuration::SupportedVideoStreamConfigurationCharacteristic,\n\t\tactive::ActiveCharacteristic,\n\t},\n    HapType,\n};\n\n/// Camera Stream Management service.\n#[derive(Debug, Default)]\npub struct CameraStreamManagementService {\n    /// Instance ID of the Camera Stream Management service.\n    id: u64,\n    /// [`HapType`](HapType) of the Camera Stream Management service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Selected Stream Configuration characteristic (required).\n\tpub selected_stream_configuration: SelectedStreamConfigurationCharacteristic,\n\t/// Setup Endpoint characteristic (required).\n\tpub setup_endpoint: SetupEndpointCharacteristic,\n\t/// Streaming Status characteristic (required).\n\tpub streaming_status: StreamingStatusCharacteristic,\n\t/// Supported Audio Stream Configuration characteristic (required).\n\tpub supported_audio_stream_configuration: SupportedAudioStreamConfigurationCharacteristic,\n\t/// Supported RTP Configuration characteristic (required).\n\tpub supported_rtp_configuration: SupportedRtpConfigurationCharacteristic,\n\t/// Supported Video Stream Configuration characteristic (required).\n\tpub supported_video_stream_configuration: SupportedVideoStreamConfigurationCharacteristic,\n\n\t/// Active characteristic (optional).\n\tpub active: Option<ActiveCharacteristic>,\n}\n\nimpl CameraStreamManagementService {\n    /// Creates a new Camera Stream Management service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::CameraStreamManagement,\n\t\t\tselected_stream_configuration: SelectedStreamConfigurationCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tsetup_endpoint: SetupEndpointCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tstreaming_status: StreamingStatusCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\tsupported_audio_stream_configuration: SupportedAudioStreamConfigurationCharacteristic::new(id + 1 + 3, accessory_id),\n\t\t\tsupported_rtp_configuration: SupportedRtpConfigurationCharacteristic::new(id + 1 + 4, accessory_id),\n\t\t\tsupported_video_stream_configuration: SupportedVideoStreamConfigurationCharacteristic::new(id + 1 + 5, accessory_id),\n\t\t\tactive: Some(ActiveCharacteristic::new(id + 1 + 0 + 6, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for CameraStreamManagementService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.selected_stream_configuration,\n\t\t\t&self.setup_endpoint,\n\t\t\t&self.streaming_status,\n\t\t\t&self.supported_audio_stream_configuration,\n\t\t\t&self.supported_rtp_configuration,\n\t\t\t&self.supported_video_stream_configuration,\n\t\t];\n\t\tif let Some(c) = &self.active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.selected_stream_configuration,\n\t\t\t&mut self.setup_endpoint,\n\t\t\t&mut self.streaming_status,\n\t\t\t&mut self.supported_audio_stream_configuration,\n\t\t\t&mut self.supported_rtp_configuration,\n\t\t\t&mut self.supported_video_stream_configuration,\n\t\t];\n\t\tif let Some(c) = &mut self.active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for CameraStreamManagementService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/carbon_dioxide_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tcarbon_dioxide_detected::CarbonDioxideDetectedCharacteristic,\n\t\tcarbon_dioxide_level::CarbonDioxideLevelCharacteristic,\n\t\tcarbon_dioxide_peak_level::CarbonDioxidePeakLevelCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tstatus_active::StatusActiveCharacteristic,\n\t\tstatus_fault::StatusFaultCharacteristic,\n\t\tstatus_low_battery::StatusLowBatteryCharacteristic,\n\t\tstatus_tampered::StatusTamperedCharacteristic,\n\t},\n    HapType,\n};\n\n/// Carbon dioxide Sensor service.\n#[derive(Debug, Default)]\npub struct CarbonDioxideSensorService {\n    /// Instance ID of the Carbon dioxide Sensor service.\n    id: u64,\n    /// [`HapType`](HapType) of the Carbon dioxide Sensor service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Carbon dioxide Detected characteristic (required).\n\tpub carbon_dioxide_detected: CarbonDioxideDetectedCharacteristic,\n\n\t/// Carbon dioxide Level characteristic (optional).\n\tpub carbon_dioxide_level: Option<CarbonDioxideLevelCharacteristic>,\n\t/// Carbon dioxide Peak Level characteristic (optional).\n\tpub carbon_dioxide_peak_level: Option<CarbonDioxidePeakLevelCharacteristic>,\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Status Active characteristic (optional).\n\tpub status_active: Option<StatusActiveCharacteristic>,\n\t/// Status Fault characteristic (optional).\n\tpub status_fault: Option<StatusFaultCharacteristic>,\n\t/// Status Low Battery characteristic (optional).\n\tpub status_low_battery: Option<StatusLowBatteryCharacteristic>,\n\t/// Status Tampered characteristic (optional).\n\tpub status_tampered: Option<StatusTamperedCharacteristic>,\n}\n\nimpl CarbonDioxideSensorService {\n    /// Creates a new Carbon dioxide Sensor service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::CarbonDioxideSensor,\n\t\t\tcarbon_dioxide_detected: CarbonDioxideDetectedCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tcarbon_dioxide_level: Some(CarbonDioxideLevelCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tcarbon_dioxide_peak_level: Some(CarbonDioxidePeakLevelCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\tstatus_active: Some(StatusActiveCharacteristic::new(id + 1 + 3 + 1, accessory_id)),\n\t\t\tstatus_fault: Some(StatusFaultCharacteristic::new(id + 1 + 4 + 1, accessory_id)),\n\t\t\tstatus_low_battery: Some(StatusLowBatteryCharacteristic::new(id + 1 + 5 + 1, accessory_id)),\n\t\t\tstatus_tampered: Some(StatusTamperedCharacteristic::new(id + 1 + 6 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for CarbonDioxideSensorService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.carbon_dioxide_detected,\n\t\t];\n\t\tif let Some(c) = &self.carbon_dioxide_level {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.carbon_dioxide_peak_level {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.carbon_dioxide_detected,\n\t\t];\n\t\tif let Some(c) = &mut self.carbon_dioxide_level {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.carbon_dioxide_peak_level {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for CarbonDioxideSensorService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/carbon_monoxide_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tcarbon_monoxide_detected::CarbonMonoxideDetectedCharacteristic,\n\t\tcarbon_monoxide_level::CarbonMonoxideLevelCharacteristic,\n\t\tcarbon_monoxide_peak_level::CarbonMonoxidePeakLevelCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tstatus_active::StatusActiveCharacteristic,\n\t\tstatus_fault::StatusFaultCharacteristic,\n\t\tstatus_low_battery::StatusLowBatteryCharacteristic,\n\t\tstatus_tampered::StatusTamperedCharacteristic,\n\t},\n    HapType,\n};\n\n/// Carbon monoxide Sensor service.\n#[derive(Debug, Default)]\npub struct CarbonMonoxideSensorService {\n    /// Instance ID of the Carbon monoxide Sensor service.\n    id: u64,\n    /// [`HapType`](HapType) of the Carbon monoxide Sensor service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Carbon monoxide Detected characteristic (required).\n\tpub carbon_monoxide_detected: CarbonMonoxideDetectedCharacteristic,\n\n\t/// Carbon monoxide Level characteristic (optional).\n\tpub carbon_monoxide_level: Option<CarbonMonoxideLevelCharacteristic>,\n\t/// Carbon monoxide Peak Level characteristic (optional).\n\tpub carbon_monoxide_peak_level: Option<CarbonMonoxidePeakLevelCharacteristic>,\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Status Active characteristic (optional).\n\tpub status_active: Option<StatusActiveCharacteristic>,\n\t/// Status Fault characteristic (optional).\n\tpub status_fault: Option<StatusFaultCharacteristic>,\n\t/// Status Low Battery characteristic (optional).\n\tpub status_low_battery: Option<StatusLowBatteryCharacteristic>,\n\t/// Status Tampered characteristic (optional).\n\tpub status_tampered: Option<StatusTamperedCharacteristic>,\n}\n\nimpl CarbonMonoxideSensorService {\n    /// Creates a new Carbon monoxide Sensor service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::CarbonMonoxideSensor,\n\t\t\tcarbon_monoxide_detected: CarbonMonoxideDetectedCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tcarbon_monoxide_level: Some(CarbonMonoxideLevelCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tcarbon_monoxide_peak_level: Some(CarbonMonoxidePeakLevelCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\tstatus_active: Some(StatusActiveCharacteristic::new(id + 1 + 3 + 1, accessory_id)),\n\t\t\tstatus_fault: Some(StatusFaultCharacteristic::new(id + 1 + 4 + 1, accessory_id)),\n\t\t\tstatus_low_battery: Some(StatusLowBatteryCharacteristic::new(id + 1 + 5 + 1, accessory_id)),\n\t\t\tstatus_tampered: Some(StatusTamperedCharacteristic::new(id + 1 + 6 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for CarbonMonoxideSensorService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.carbon_monoxide_detected,\n\t\t];\n\t\tif let Some(c) = &self.carbon_monoxide_level {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.carbon_monoxide_peak_level {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.carbon_monoxide_detected,\n\t\t];\n\t\tif let Some(c) = &mut self.carbon_monoxide_level {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.carbon_monoxide_peak_level {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for CarbonMonoxideSensorService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/cloud_relay.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tcloud_relay_control_point::CloudRelayControlPointCharacteristic,\n\t\tcloud_relay_current_state::CloudRelayCurrentStateCharacteristic,\n\t\tcloud_relay_enable_status::CloudRelayEnableStatusCharacteristic,\n\t},\n    HapType,\n};\n\n/// Cloud Relay service.\n#[derive(Debug, Default)]\npub struct CloudRelayService {\n    /// Instance ID of the Cloud Relay service.\n    id: u64,\n    /// [`HapType`](HapType) of the Cloud Relay service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Cloud Relay Control Point characteristic (required).\n\tpub cloud_relay_control_point: CloudRelayControlPointCharacteristic,\n\t/// Cloud Relay Current State characteristic (required).\n\tpub cloud_relay_current_state: CloudRelayCurrentStateCharacteristic,\n\t/// Cloud Relay Enable Status characteristic (required).\n\tpub cloud_relay_enable_status: CloudRelayEnableStatusCharacteristic,\n\n}\n\nimpl CloudRelayService {\n    /// Creates a new Cloud Relay service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::CloudRelay,\n\t\t\tcloud_relay_control_point: CloudRelayControlPointCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tcloud_relay_current_state: CloudRelayCurrentStateCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tcloud_relay_enable_status: CloudRelayEnableStatusCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for CloudRelayService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.cloud_relay_control_point,\n\t\t\t&self.cloud_relay_current_state,\n\t\t\t&self.cloud_relay_enable_status,\n\t\t];\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.cloud_relay_control_point,\n\t\t\t&mut self.cloud_relay_current_state,\n\t\t\t&mut self.cloud_relay_enable_status,\n\t\t];\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for CloudRelayService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/contact_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tcontact_sensor_state::ContactSensorStateCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tstatus_active::StatusActiveCharacteristic,\n\t\tstatus_fault::StatusFaultCharacteristic,\n\t\tstatus_low_battery::StatusLowBatteryCharacteristic,\n\t\tstatus_tampered::StatusTamperedCharacteristic,\n\t},\n    HapType,\n};\n\n/// Contact Sensor service.\n#[derive(Debug, Default)]\npub struct ContactSensorService {\n    /// Instance ID of the Contact Sensor service.\n    id: u64,\n    /// [`HapType`](HapType) of the Contact Sensor service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Contact Sensor State characteristic (required).\n\tpub contact_sensor_state: ContactSensorStateCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Status Active characteristic (optional).\n\tpub status_active: Option<StatusActiveCharacteristic>,\n\t/// Status Fault characteristic (optional).\n\tpub status_fault: Option<StatusFaultCharacteristic>,\n\t/// Status Low Battery characteristic (optional).\n\tpub status_low_battery: Option<StatusLowBatteryCharacteristic>,\n\t/// Status Tampered characteristic (optional).\n\tpub status_tampered: Option<StatusTamperedCharacteristic>,\n}\n\nimpl ContactSensorService {\n    /// Creates a new Contact Sensor service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::ContactSensor,\n\t\t\tcontact_sensor_state: ContactSensorStateCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tstatus_active: Some(StatusActiveCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\tstatus_fault: Some(StatusFaultCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\tstatus_low_battery: Some(StatusLowBatteryCharacteristic::new(id + 1 + 3 + 1, accessory_id)),\n\t\t\tstatus_tampered: Some(StatusTamperedCharacteristic::new(id + 1 + 4 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for ContactSensorService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.contact_sensor_state,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.contact_sensor_state,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for ContactSensorService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/data_stream_transport_management.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tsetup_data_stream_transport::SetupDataStreamTransportCharacteristic,\n\t\tsupported_data_stream_transport_configuration::SupportedDataStreamTransportConfigurationCharacteristic,\n\t\tversion::VersionCharacteristic,\n\t},\n    HapType,\n};\n\n/// Data Stream Transport Management service.\n#[derive(Debug, Default)]\npub struct DataStreamTransportManagementService {\n    /// Instance ID of the Data Stream Transport Management service.\n    id: u64,\n    /// [`HapType`](HapType) of the Data Stream Transport Management service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Setup Data Stream Transport characteristic (required).\n\tpub setup_data_stream_transport: SetupDataStreamTransportCharacteristic,\n\t/// Supported Data Stream Transport Configuration characteristic (required).\n\tpub supported_data_stream_transport_configuration: SupportedDataStreamTransportConfigurationCharacteristic,\n\t/// Version characteristic (required).\n\tpub version: VersionCharacteristic,\n\n}\n\nimpl DataStreamTransportManagementService {\n    /// Creates a new Data Stream Transport Management service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::DataStreamTransportManagement,\n\t\t\tsetup_data_stream_transport: SetupDataStreamTransportCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tsupported_data_stream_transport_configuration: SupportedDataStreamTransportConfigurationCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tversion: VersionCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for DataStreamTransportManagementService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.setup_data_stream_transport,\n\t\t\t&self.supported_data_stream_transport_configuration,\n\t\t\t&self.version,\n\t\t];\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.setup_data_stream_transport,\n\t\t\t&mut self.supported_data_stream_transport_configuration,\n\t\t\t&mut self.version,\n\t\t];\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for DataStreamTransportManagementService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/diagnostics.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tsupported_diagnostics_snapshot::SupportedDiagnosticsSnapshotCharacteristic,\n\t\tselected_diagnostics_modes::SelectedDiagnosticsModesCharacteristic,\n\t\tsupported_diagnostics_modes::SupportedDiagnosticsModesCharacteristic,\n\t},\n    HapType,\n};\n\n/// Diagnostics service.\n#[derive(Debug, Default)]\npub struct DiagnosticsService {\n    /// Instance ID of the Diagnostics service.\n    id: u64,\n    /// [`HapType`](HapType) of the Diagnostics service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Supported Diagnostics Snapshot characteristic (required).\n\tpub supported_diagnostics_snapshot: SupportedDiagnosticsSnapshotCharacteristic,\n\n\t/// Selected Diagnostics Modes characteristic (optional).\n\tpub selected_diagnostics_modes: Option<SelectedDiagnosticsModesCharacteristic>,\n\t/// Supported Diagnostics Modes characteristic (optional).\n\tpub supported_diagnostics_modes: Option<SupportedDiagnosticsModesCharacteristic>,\n}\n\nimpl DiagnosticsService {\n    /// Creates a new Diagnostics service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Diagnostics,\n\t\t\tsupported_diagnostics_snapshot: SupportedDiagnosticsSnapshotCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tselected_diagnostics_modes: Some(SelectedDiagnosticsModesCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tsupported_diagnostics_modes: Some(SupportedDiagnosticsModesCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for DiagnosticsService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.supported_diagnostics_snapshot,\n\t\t];\n\t\tif let Some(c) = &self.selected_diagnostics_modes {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.supported_diagnostics_modes {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.supported_diagnostics_snapshot,\n\t\t];\n\t\tif let Some(c) = &mut self.selected_diagnostics_modes {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.supported_diagnostics_modes {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for DiagnosticsService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/door.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tcurrent_position::CurrentPositionCharacteristic,\n\t\tposition_state::PositionStateCharacteristic,\n\t\ttarget_position::TargetPositionCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tobstruction_detected::ObstructionDetectedCharacteristic,\n\t\thold_position::HoldPositionCharacteristic,\n\t},\n    HapType,\n};\n\n/// Door service.\n#[derive(Debug, Default)]\npub struct DoorService {\n    /// Instance ID of the Door service.\n    id: u64,\n    /// [`HapType`](HapType) of the Door service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Current Position characteristic (required).\n\tpub current_position: CurrentPositionCharacteristic,\n\t/// Position State characteristic (required).\n\tpub position_state: PositionStateCharacteristic,\n\t/// Target Position characteristic (required).\n\tpub target_position: TargetPositionCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Obstruction Detected characteristic (optional).\n\tpub obstruction_detected: Option<ObstructionDetectedCharacteristic>,\n\t/// Hold Position characteristic (optional).\n\tpub hold_position: Option<HoldPositionCharacteristic>,\n}\n\nimpl DoorService {\n    /// Creates a new Door service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Door,\n\t\t\tcurrent_position: CurrentPositionCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tposition_state: PositionStateCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\ttarget_position: TargetPositionCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 3, accessory_id)),\n\t\t\tobstruction_detected: Some(ObstructionDetectedCharacteristic::new(id + 1 + 1 + 3, accessory_id)),\n\t\t\thold_position: Some(HoldPositionCharacteristic::new(id + 1 + 2 + 3, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for DoorService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.current_position,\n\t\t\t&self.position_state,\n\t\t\t&self.target_position,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.obstruction_detected {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.hold_position {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.current_position,\n\t\t\t&mut self.position_state,\n\t\t\t&mut self.target_position,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.obstruction_detected {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.hold_position {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for DoorService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/doorbell.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tprogrammable_switch_event::ProgrammableSwitchEventCharacteristic,\n\t\tbrightness::BrightnessCharacteristic,\n\t\tmute::MuteCharacteristic,\n\t\tname::NameCharacteristic,\n\t\toperating_state_response::OperatingStateResponseCharacteristic,\n\t\tvolume::VolumeCharacteristic,\n\t},\n    HapType,\n};\n\n/// Doorbell service.\n#[derive(Debug, Default)]\npub struct DoorbellService {\n    /// Instance ID of the Doorbell service.\n    id: u64,\n    /// [`HapType`](HapType) of the Doorbell service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Programmable Switch Event characteristic (required).\n\tpub programmable_switch_event: ProgrammableSwitchEventCharacteristic,\n\n\t/// Brightness characteristic (optional).\n\tpub brightness: Option<BrightnessCharacteristic>,\n\t/// Mute characteristic (optional).\n\tpub mute: Option<MuteCharacteristic>,\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Operating State Response characteristic (optional).\n\tpub operating_state_response: Option<OperatingStateResponseCharacteristic>,\n\t/// Volume characteristic (optional).\n\tpub volume: Option<VolumeCharacteristic>,\n}\n\nimpl DoorbellService {\n    /// Creates a new Doorbell service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Doorbell,\n\t\t\tprogrammable_switch_event: ProgrammableSwitchEventCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tbrightness: Some(BrightnessCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tmute: Some(MuteCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\toperating_state_response: Some(OperatingStateResponseCharacteristic::new(id + 1 + 3 + 1, accessory_id)),\n\t\t\tvolume: Some(VolumeCharacteristic::new(id + 1 + 4 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for DoorbellService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.programmable_switch_event,\n\t\t];\n\t\tif let Some(c) = &self.brightness {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.mute {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.operating_state_response {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.volume {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.programmable_switch_event,\n\t\t];\n\t\tif let Some(c) = &mut self.brightness {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.mute {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.operating_state_response {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.volume {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for DoorbellService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/fan.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tpower_state::PowerStateCharacteristic,\n\t\tname::NameCharacteristic,\n\t\trotation_direction::RotationDirectionCharacteristic,\n\t\trotation_speed::RotationSpeedCharacteristic,\n\t},\n    HapType,\n};\n\n/// Fan service.\n#[derive(Debug, Default)]\npub struct FanService {\n    /// Instance ID of the Fan service.\n    id: u64,\n    /// [`HapType`](HapType) of the Fan service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Power State characteristic (required).\n\tpub power_state: PowerStateCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Rotation Direction characteristic (optional).\n\tpub rotation_direction: Option<RotationDirectionCharacteristic>,\n\t/// Rotation Speed characteristic (optional).\n\tpub rotation_speed: Option<RotationSpeedCharacteristic>,\n}\n\nimpl FanService {\n    /// Creates a new Fan service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Fan,\n\t\t\tpower_state: PowerStateCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\trotation_direction: Some(RotationDirectionCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\trotation_speed: Some(RotationSpeedCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for FanService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.power_state,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.rotation_direction {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.rotation_speed {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.power_state,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.rotation_direction {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.rotation_speed {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for FanService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/fan_v2.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tactive::ActiveCharacteristic,\n\t\tcurrent_fan_state::CurrentFanStateCharacteristic,\n\t\ttarget_fan_state::TargetFanStateCharacteristic,\n\t\tlock_physical_controls::LockPhysicalControlsCharacteristic,\n\t\tname::NameCharacteristic,\n\t\trotation_direction::RotationDirectionCharacteristic,\n\t\trotation_speed::RotationSpeedCharacteristic,\n\t\tswing_mode::SwingModeCharacteristic,\n\t},\n    HapType,\n};\n\n/// Fan v2 service.\n#[derive(Debug, Default)]\npub struct FanV2Service {\n    /// Instance ID of the Fan v2 service.\n    id: u64,\n    /// [`HapType`](HapType) of the Fan v2 service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Active characteristic (required).\n\tpub active: ActiveCharacteristic,\n\n\t/// Current Fan State characteristic (optional).\n\tpub current_fan_state: Option<CurrentFanStateCharacteristic>,\n\t/// Target Fan State characteristic (optional).\n\tpub target_fan_state: Option<TargetFanStateCharacteristic>,\n\t/// Lock Physical Controls characteristic (optional).\n\tpub lock_physical_controls: Option<LockPhysicalControlsCharacteristic>,\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Rotation Direction characteristic (optional).\n\tpub rotation_direction: Option<RotationDirectionCharacteristic>,\n\t/// Rotation Speed characteristic (optional).\n\tpub rotation_speed: Option<RotationSpeedCharacteristic>,\n\t/// Swing Mode characteristic (optional).\n\tpub swing_mode: Option<SwingModeCharacteristic>,\n}\n\nimpl FanV2Service {\n    /// Creates a new Fan v2 service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::FanV2,\n\t\t\tactive: ActiveCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tcurrent_fan_state: Some(CurrentFanStateCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\ttarget_fan_state: Some(TargetFanStateCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\tlock_physical_controls: Some(LockPhysicalControlsCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 3 + 1, accessory_id)),\n\t\t\trotation_direction: Some(RotationDirectionCharacteristic::new(id + 1 + 4 + 1, accessory_id)),\n\t\t\trotation_speed: Some(RotationSpeedCharacteristic::new(id + 1 + 5 + 1, accessory_id)),\n\t\t\tswing_mode: Some(SwingModeCharacteristic::new(id + 1 + 6 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for FanV2Service {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.active,\n\t\t];\n\t\tif let Some(c) = &self.current_fan_state {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.target_fan_state {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.lock_physical_controls {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.rotation_direction {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.rotation_speed {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.swing_mode {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.active,\n\t\t];\n\t\tif let Some(c) = &mut self.current_fan_state {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.target_fan_state {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.lock_physical_controls {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.rotation_direction {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.rotation_speed {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.swing_mode {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for FanV2Service {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/faucet.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tactive::ActiveCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tstatus_fault::StatusFaultCharacteristic,\n\t},\n    HapType,\n};\n\n/// Faucet service.\n#[derive(Debug, Default)]\npub struct FaucetService {\n    /// Instance ID of the Faucet service.\n    id: u64,\n    /// [`HapType`](HapType) of the Faucet service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Active characteristic (required).\n\tpub active: ActiveCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Status Fault characteristic (optional).\n\tpub status_fault: Option<StatusFaultCharacteristic>,\n}\n\nimpl FaucetService {\n    /// Creates a new Faucet service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Faucet,\n\t\t\tactive: ActiveCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tstatus_fault: Some(StatusFaultCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for FaucetService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.active,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.active,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for FaucetService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/filter_maintenance.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tfilter_change_indication::FilterChangeIndicationCharacteristic,\n\t\tfilter_life_level::FilterLifeLevelCharacteristic,\n\t\tfilter_reset_change_indication::FilterResetChangeIndicationCharacteristic,\n\t\tname::NameCharacteristic,\n\t},\n    HapType,\n};\n\n/// Filter Maintenance service.\n#[derive(Debug, Default)]\npub struct FilterMaintenanceService {\n    /// Instance ID of the Filter Maintenance service.\n    id: u64,\n    /// [`HapType`](HapType) of the Filter Maintenance service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Filter Change indication characteristic (required).\n\tpub filter_change_indication: FilterChangeIndicationCharacteristic,\n\n\t/// Filter Life Level characteristic (optional).\n\tpub filter_life_level: Option<FilterLifeLevelCharacteristic>,\n\t/// Filter Reset Change Indication characteristic (optional).\n\tpub filter_reset_change_indication: Option<FilterResetChangeIndicationCharacteristic>,\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n}\n\nimpl FilterMaintenanceService {\n    /// Creates a new Filter Maintenance service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::FilterMaintenance,\n\t\t\tfilter_change_indication: FilterChangeIndicationCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tfilter_life_level: Some(FilterLifeLevelCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tfilter_reset_change_indication: Some(FilterResetChangeIndicationCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for FilterMaintenanceService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.filter_change_indication,\n\t\t];\n\t\tif let Some(c) = &self.filter_life_level {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.filter_reset_change_indication {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.filter_change_indication,\n\t\t];\n\t\tif let Some(c) = &mut self.filter_life_level {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.filter_reset_change_indication {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for FilterMaintenanceService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/garage_door_opener.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tcurrent_door_state::CurrentDoorStateCharacteristic,\n\t\ttarget_door_state::TargetDoorStateCharacteristic,\n\t\tobstruction_detected::ObstructionDetectedCharacteristic,\n\t\tlock_current_state::LockCurrentStateCharacteristic,\n\t\tlock_target_state::LockTargetStateCharacteristic,\n\t\tname::NameCharacteristic,\n\t},\n    HapType,\n};\n\n/// Garage Door Opener service.\n#[derive(Debug, Default)]\npub struct GarageDoorOpenerService {\n    /// Instance ID of the Garage Door Opener service.\n    id: u64,\n    /// [`HapType`](HapType) of the Garage Door Opener service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Current Door State characteristic (required).\n\tpub current_door_state: CurrentDoorStateCharacteristic,\n\t/// Target Door State characteristic (required).\n\tpub target_door_state: TargetDoorStateCharacteristic,\n\t/// Obstruction Detected characteristic (required).\n\tpub obstruction_detected: ObstructionDetectedCharacteristic,\n\n\t/// Lock Current State characteristic (optional).\n\tpub lock_current_state: Option<LockCurrentStateCharacteristic>,\n\t/// Lock Target State characteristic (optional).\n\tpub lock_target_state: Option<LockTargetStateCharacteristic>,\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n}\n\nimpl GarageDoorOpenerService {\n    /// Creates a new Garage Door Opener service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::GarageDoorOpener,\n\t\t\tcurrent_door_state: CurrentDoorStateCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\ttarget_door_state: TargetDoorStateCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tobstruction_detected: ObstructionDetectedCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\tlock_current_state: Some(LockCurrentStateCharacteristic::new(id + 1 + 0 + 3, accessory_id)),\n\t\t\tlock_target_state: Some(LockTargetStateCharacteristic::new(id + 1 + 1 + 3, accessory_id)),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 2 + 3, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for GarageDoorOpenerService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.current_door_state,\n\t\t\t&self.target_door_state,\n\t\t\t&self.obstruction_detected,\n\t\t];\n\t\tif let Some(c) = &self.lock_current_state {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.lock_target_state {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.current_door_state,\n\t\t\t&mut self.target_door_state,\n\t\t\t&mut self.obstruction_detected,\n\t\t];\n\t\tif let Some(c) = &mut self.lock_current_state {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.lock_target_state {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for GarageDoorOpenerService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/heater_cooler.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tactive::ActiveCharacteristic,\n\t\tcurrent_heater_cooler_state::CurrentHeaterCoolerStateCharacteristic,\n\t\ttarget_heater_cooler_state::TargetHeaterCoolerStateCharacteristic,\n\t\tcurrent_temperature::CurrentTemperatureCharacteristic,\n\t\tlock_physical_controls::LockPhysicalControlsCharacteristic,\n\t\tname::NameCharacteristic,\n\t\trotation_speed::RotationSpeedCharacteristic,\n\t\tswing_mode::SwingModeCharacteristic,\n\t\tcooling_threshold_temperature::CoolingThresholdTemperatureCharacteristic,\n\t\theating_threshold_temperature::HeatingThresholdTemperatureCharacteristic,\n\t\ttemperature_display_units::TemperatureDisplayUnitsCharacteristic,\n\t},\n    HapType,\n};\n\n/// Heater-Cooler service.\n#[derive(Debug, Default)]\npub struct HeaterCoolerService {\n    /// Instance ID of the Heater-Cooler service.\n    id: u64,\n    /// [`HapType`](HapType) of the Heater-Cooler service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Active characteristic (required).\n\tpub active: ActiveCharacteristic,\n\t/// Current Heater-Cooler State characteristic (required).\n\tpub current_heater_cooler_state: CurrentHeaterCoolerStateCharacteristic,\n\t/// Target Heater-Cooler State characteristic (required).\n\tpub target_heater_cooler_state: TargetHeaterCoolerStateCharacteristic,\n\t/// Current Temperature characteristic (required).\n\tpub current_temperature: CurrentTemperatureCharacteristic,\n\n\t/// Lock Physical Controls characteristic (optional).\n\tpub lock_physical_controls: Option<LockPhysicalControlsCharacteristic>,\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Rotation Speed characteristic (optional).\n\tpub rotation_speed: Option<RotationSpeedCharacteristic>,\n\t/// Swing Mode characteristic (optional).\n\tpub swing_mode: Option<SwingModeCharacteristic>,\n\t/// Cooling Threshold Temperature characteristic (optional).\n\tpub cooling_threshold_temperature: Option<CoolingThresholdTemperatureCharacteristic>,\n\t/// Heating Threshold Temperature characteristic (optional).\n\tpub heating_threshold_temperature: Option<HeatingThresholdTemperatureCharacteristic>,\n\t/// Temperature Display Units characteristic (optional).\n\tpub temperature_display_units: Option<TemperatureDisplayUnitsCharacteristic>,\n}\n\nimpl HeaterCoolerService {\n    /// Creates a new Heater-Cooler service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::HeaterCooler,\n\t\t\tactive: ActiveCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tcurrent_heater_cooler_state: CurrentHeaterCoolerStateCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\ttarget_heater_cooler_state: TargetHeaterCoolerStateCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\tcurrent_temperature: CurrentTemperatureCharacteristic::new(id + 1 + 3, accessory_id),\n\t\t\tlock_physical_controls: Some(LockPhysicalControlsCharacteristic::new(id + 1 + 0 + 4, accessory_id)),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 1 + 4, accessory_id)),\n\t\t\trotation_speed: Some(RotationSpeedCharacteristic::new(id + 1 + 2 + 4, accessory_id)),\n\t\t\tswing_mode: Some(SwingModeCharacteristic::new(id + 1 + 3 + 4, accessory_id)),\n\t\t\tcooling_threshold_temperature: Some(CoolingThresholdTemperatureCharacteristic::new(id + 1 + 4 + 4, accessory_id)),\n\t\t\theating_threshold_temperature: Some(HeatingThresholdTemperatureCharacteristic::new(id + 1 + 5 + 4, accessory_id)),\n\t\t\ttemperature_display_units: Some(TemperatureDisplayUnitsCharacteristic::new(id + 1 + 6 + 4, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for HeaterCoolerService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.active,\n\t\t\t&self.current_heater_cooler_state,\n\t\t\t&self.target_heater_cooler_state,\n\t\t\t&self.current_temperature,\n\t\t];\n\t\tif let Some(c) = &self.lock_physical_controls {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.rotation_speed {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.swing_mode {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.cooling_threshold_temperature {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.heating_threshold_temperature {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.temperature_display_units {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.active,\n\t\t\t&mut self.current_heater_cooler_state,\n\t\t\t&mut self.target_heater_cooler_state,\n\t\t\t&mut self.current_temperature,\n\t\t];\n\t\tif let Some(c) = &mut self.lock_physical_controls {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.rotation_speed {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.swing_mode {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.cooling_threshold_temperature {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.heating_threshold_temperature {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.temperature_display_units {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for HeaterCoolerService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/humidifier_dehumidifier.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tactive::ActiveCharacteristic,\n\t\tcurrent_humidifier_dehumidifier_state::CurrentHumidifierDehumidifierStateCharacteristic,\n\t\ttarget_humidifier_dehumidifier_state::TargetHumidifierDehumidifierStateCharacteristic,\n\t\tcurrent_relative_humidity::CurrentRelativeHumidityCharacteristic,\n\t\tlock_physical_controls::LockPhysicalControlsCharacteristic,\n\t\tname::NameCharacteristic,\n\t\trelative_humidity_dehumidifier_threshold::RelativeHumidityDehumidifierThresholdCharacteristic,\n\t\trelative_humidity_humidifier_threshold::RelativeHumidityHumidifierThresholdCharacteristic,\n\t\trotation_speed::RotationSpeedCharacteristic,\n\t\tswing_mode::SwingModeCharacteristic,\n\t\tcurrent_water_level::CurrentWaterLevelCharacteristic,\n\t},\n    HapType,\n};\n\n/// Humidifier-Dehumidifier service.\n#[derive(Debug, Default)]\npub struct HumidifierDehumidifierService {\n    /// Instance ID of the Humidifier-Dehumidifier service.\n    id: u64,\n    /// [`HapType`](HapType) of the Humidifier-Dehumidifier service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Active characteristic (required).\n\tpub active: ActiveCharacteristic,\n\t/// Current Humidifier-Dehumidifier State characteristic (required).\n\tpub current_humidifier_dehumidifier_state: CurrentHumidifierDehumidifierStateCharacteristic,\n\t/// Target Humidifier-Dehumidifier State characteristic (required).\n\tpub target_humidifier_dehumidifier_state: TargetHumidifierDehumidifierStateCharacteristic,\n\t/// Current Relative Humidity characteristic (required).\n\tpub current_relative_humidity: CurrentRelativeHumidityCharacteristic,\n\n\t/// Lock Physical Controls characteristic (optional).\n\tpub lock_physical_controls: Option<LockPhysicalControlsCharacteristic>,\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Relative Humidity Dehumidifier Threshold characteristic (optional).\n\tpub relative_humidity_dehumidifier_threshold: Option<RelativeHumidityDehumidifierThresholdCharacteristic>,\n\t/// Relative Humidity Humidifier Threshold characteristic (optional).\n\tpub relative_humidity_humidifier_threshold: Option<RelativeHumidityHumidifierThresholdCharacteristic>,\n\t/// Rotation Speed characteristic (optional).\n\tpub rotation_speed: Option<RotationSpeedCharacteristic>,\n\t/// Swing Mode characteristic (optional).\n\tpub swing_mode: Option<SwingModeCharacteristic>,\n\t/// Current Water Level characteristic (optional).\n\tpub current_water_level: Option<CurrentWaterLevelCharacteristic>,\n}\n\nimpl HumidifierDehumidifierService {\n    /// Creates a new Humidifier-Dehumidifier service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::HumidifierDehumidifier,\n\t\t\tactive: ActiveCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tcurrent_humidifier_dehumidifier_state: CurrentHumidifierDehumidifierStateCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\ttarget_humidifier_dehumidifier_state: TargetHumidifierDehumidifierStateCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\tcurrent_relative_humidity: CurrentRelativeHumidityCharacteristic::new(id + 1 + 3, accessory_id),\n\t\t\tlock_physical_controls: Some(LockPhysicalControlsCharacteristic::new(id + 1 + 0 + 4, accessory_id)),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 1 + 4, accessory_id)),\n\t\t\trelative_humidity_dehumidifier_threshold: Some(RelativeHumidityDehumidifierThresholdCharacteristic::new(id + 1 + 2 + 4, accessory_id)),\n\t\t\trelative_humidity_humidifier_threshold: Some(RelativeHumidityHumidifierThresholdCharacteristic::new(id + 1 + 3 + 4, accessory_id)),\n\t\t\trotation_speed: Some(RotationSpeedCharacteristic::new(id + 1 + 4 + 4, accessory_id)),\n\t\t\tswing_mode: Some(SwingModeCharacteristic::new(id + 1 + 5 + 4, accessory_id)),\n\t\t\tcurrent_water_level: Some(CurrentWaterLevelCharacteristic::new(id + 1 + 6 + 4, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for HumidifierDehumidifierService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.active,\n\t\t\t&self.current_humidifier_dehumidifier_state,\n\t\t\t&self.target_humidifier_dehumidifier_state,\n\t\t\t&self.current_relative_humidity,\n\t\t];\n\t\tif let Some(c) = &self.lock_physical_controls {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.relative_humidity_dehumidifier_threshold {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.relative_humidity_humidifier_threshold {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.rotation_speed {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.swing_mode {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.current_water_level {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.active,\n\t\t\t&mut self.current_humidifier_dehumidifier_state,\n\t\t\t&mut self.target_humidifier_dehumidifier_state,\n\t\t\t&mut self.current_relative_humidity,\n\t\t];\n\t\tif let Some(c) = &mut self.lock_physical_controls {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.relative_humidity_dehumidifier_threshold {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.relative_humidity_humidifier_threshold {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.rotation_speed {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.swing_mode {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.current_water_level {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for HumidifierDehumidifierService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/humidity_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tcurrent_relative_humidity::CurrentRelativeHumidityCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tstatus_active::StatusActiveCharacteristic,\n\t\tstatus_fault::StatusFaultCharacteristic,\n\t\tstatus_low_battery::StatusLowBatteryCharacteristic,\n\t\tstatus_tampered::StatusTamperedCharacteristic,\n\t},\n    HapType,\n};\n\n/// Humidity Sensor service.\n#[derive(Debug, Default)]\npub struct HumiditySensorService {\n    /// Instance ID of the Humidity Sensor service.\n    id: u64,\n    /// [`HapType`](HapType) of the Humidity Sensor service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Current Relative Humidity characteristic (required).\n\tpub current_relative_humidity: CurrentRelativeHumidityCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Status Active characteristic (optional).\n\tpub status_active: Option<StatusActiveCharacteristic>,\n\t/// Status Fault characteristic (optional).\n\tpub status_fault: Option<StatusFaultCharacteristic>,\n\t/// Status Low Battery characteristic (optional).\n\tpub status_low_battery: Option<StatusLowBatteryCharacteristic>,\n\t/// Status Tampered characteristic (optional).\n\tpub status_tampered: Option<StatusTamperedCharacteristic>,\n}\n\nimpl HumiditySensorService {\n    /// Creates a new Humidity Sensor service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::HumiditySensor,\n\t\t\tcurrent_relative_humidity: CurrentRelativeHumidityCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tstatus_active: Some(StatusActiveCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\tstatus_fault: Some(StatusFaultCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\tstatus_low_battery: Some(StatusLowBatteryCharacteristic::new(id + 1 + 3 + 1, accessory_id)),\n\t\t\tstatus_tampered: Some(StatusTamperedCharacteristic::new(id + 1 + 4 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for HumiditySensorService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.current_relative_humidity,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.current_relative_humidity,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for HumiditySensorService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/input_source.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tconfigured_name::ConfiguredNameCharacteristic,\n\t\tinput_source_type::InputSourceTypeCharacteristic,\n\t\tis_configured::IsConfiguredCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tcurrent_visibility_state::CurrentVisibilityStateCharacteristic,\n\t\tidentifier::IdentifierCharacteristic,\n\t\tinput_device_type::InputDeviceTypeCharacteristic,\n\t\ttarget_visibility_state::TargetVisibilityStateCharacteristic,\n\t},\n    HapType,\n};\n\n/// Input Source service.\n#[derive(Debug, Default)]\npub struct InputSourceService {\n    /// Instance ID of the Input Source service.\n    id: u64,\n    /// [`HapType`](HapType) of the Input Source service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Configured Name characteristic (required).\n\tpub configured_name: ConfiguredNameCharacteristic,\n\t/// Input Source Type characteristic (required).\n\tpub input_source_type: InputSourceTypeCharacteristic,\n\t/// Is Configured characteristic (required).\n\tpub is_configured: IsConfiguredCharacteristic,\n\t/// Name characteristic (required).\n\tpub name: NameCharacteristic,\n\t/// Current Visibility State characteristic (required).\n\tpub current_visibility_state: CurrentVisibilityStateCharacteristic,\n\n\t/// Identifier characteristic (optional).\n\tpub identifier: Option<IdentifierCharacteristic>,\n\t/// Input Device Type characteristic (optional).\n\tpub input_device_type: Option<InputDeviceTypeCharacteristic>,\n\t/// Target Visibility State characteristic (optional).\n\tpub target_visibility_state: Option<TargetVisibilityStateCharacteristic>,\n}\n\nimpl InputSourceService {\n    /// Creates a new Input Source service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::InputSource,\n\t\t\tconfigured_name: ConfiguredNameCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tinput_source_type: InputSourceTypeCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tis_configured: IsConfiguredCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\tname: NameCharacteristic::new(id + 1 + 3, accessory_id),\n\t\t\tcurrent_visibility_state: CurrentVisibilityStateCharacteristic::new(id + 1 + 4, accessory_id),\n\t\t\tidentifier: Some(IdentifierCharacteristic::new(id + 1 + 0 + 5, accessory_id)),\n\t\t\tinput_device_type: Some(InputDeviceTypeCharacteristic::new(id + 1 + 1 + 5, accessory_id)),\n\t\t\ttarget_visibility_state: Some(TargetVisibilityStateCharacteristic::new(id + 1 + 2 + 5, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for InputSourceService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.configured_name,\n\t\t\t&self.input_source_type,\n\t\t\t&self.is_configured,\n\t\t\t&self.name,\n\t\t\t&self.current_visibility_state,\n\t\t];\n\t\tif let Some(c) = &self.identifier {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.input_device_type {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.target_visibility_state {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.configured_name,\n\t\t\t&mut self.input_source_type,\n\t\t\t&mut self.is_configured,\n\t\t\t&mut self.name,\n\t\t\t&mut self.current_visibility_state,\n\t\t];\n\t\tif let Some(c) = &mut self.identifier {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.input_device_type {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.target_visibility_state {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for InputSourceService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/irrigation_system.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tactive::ActiveCharacteristic,\n\t\tprogram_mode::ProgramModeCharacteristic,\n\t\tin_use::InUseCharacteristic,\n\t\tremaining_duration::RemainingDurationCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tstatus_fault::StatusFaultCharacteristic,\n\t},\n    HapType,\n};\n\n/// Irrigation-System service.\n#[derive(Debug, Default)]\npub struct IrrigationSystemService {\n    /// Instance ID of the Irrigation-System service.\n    id: u64,\n    /// [`HapType`](HapType) of the Irrigation-System service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Active characteristic (required).\n\tpub active: ActiveCharacteristic,\n\t/// Program Mode characteristic (required).\n\tpub program_mode: ProgramModeCharacteristic,\n\t/// In Use characteristic (required).\n\tpub in_use: InUseCharacteristic,\n\n\t/// Remaining Duration characteristic (optional).\n\tpub remaining_duration: Option<RemainingDurationCharacteristic>,\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Status Fault characteristic (optional).\n\tpub status_fault: Option<StatusFaultCharacteristic>,\n}\n\nimpl IrrigationSystemService {\n    /// Creates a new Irrigation-System service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::IrrigationSystem,\n\t\t\tactive: ActiveCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tprogram_mode: ProgramModeCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tin_use: InUseCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\tremaining_duration: Some(RemainingDurationCharacteristic::new(id + 1 + 0 + 3, accessory_id)),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 1 + 3, accessory_id)),\n\t\t\tstatus_fault: Some(StatusFaultCharacteristic::new(id + 1 + 2 + 3, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for IrrigationSystemService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.active,\n\t\t\t&self.program_mode,\n\t\t\t&self.in_use,\n\t\t];\n\t\tif let Some(c) = &self.remaining_duration {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.active,\n\t\t\t&mut self.program_mode,\n\t\t\t&mut self.in_use,\n\t\t];\n\t\tif let Some(c) = &mut self.remaining_duration {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for IrrigationSystemService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/label.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tlabel_namespace::LabelNamespaceCharacteristic,\n\t},\n    HapType,\n};\n\n/// Label service.\n#[derive(Debug, Default)]\npub struct LabelService {\n    /// Instance ID of the Label service.\n    id: u64,\n    /// [`HapType`](HapType) of the Label service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Label Namespace characteristic (required).\n\tpub label_namespace: LabelNamespaceCharacteristic,\n\n}\n\nimpl LabelService {\n    /// Creates a new Label service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Label,\n\t\t\tlabel_namespace: LabelNamespaceCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for LabelService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.label_namespace,\n\t\t];\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.label_namespace,\n\t\t];\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for LabelService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/leak_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tleak_detected::LeakDetectedCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tstatus_active::StatusActiveCharacteristic,\n\t\tstatus_fault::StatusFaultCharacteristic,\n\t\tstatus_low_battery::StatusLowBatteryCharacteristic,\n\t\tstatus_tampered::StatusTamperedCharacteristic,\n\t},\n    HapType,\n};\n\n/// Leak Sensor service.\n#[derive(Debug, Default)]\npub struct LeakSensorService {\n    /// Instance ID of the Leak Sensor service.\n    id: u64,\n    /// [`HapType`](HapType) of the Leak Sensor service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Leak Detected characteristic (required).\n\tpub leak_detected: LeakDetectedCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Status Active characteristic (optional).\n\tpub status_active: Option<StatusActiveCharacteristic>,\n\t/// Status Fault characteristic (optional).\n\tpub status_fault: Option<StatusFaultCharacteristic>,\n\t/// Status Low Battery characteristic (optional).\n\tpub status_low_battery: Option<StatusLowBatteryCharacteristic>,\n\t/// Status Tampered characteristic (optional).\n\tpub status_tampered: Option<StatusTamperedCharacteristic>,\n}\n\nimpl LeakSensorService {\n    /// Creates a new Leak Sensor service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::LeakSensor,\n\t\t\tleak_detected: LeakDetectedCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tstatus_active: Some(StatusActiveCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\tstatus_fault: Some(StatusFaultCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\tstatus_low_battery: Some(StatusLowBatteryCharacteristic::new(id + 1 + 3 + 1, accessory_id)),\n\t\t\tstatus_tampered: Some(StatusTamperedCharacteristic::new(id + 1 + 4 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for LeakSensorService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.leak_detected,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.leak_detected,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for LeakSensorService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/light_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tcurrent_light_level::CurrentLightLevelCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tstatus_active::StatusActiveCharacteristic,\n\t\tstatus_fault::StatusFaultCharacteristic,\n\t\tstatus_low_battery::StatusLowBatteryCharacteristic,\n\t\tstatus_tampered::StatusTamperedCharacteristic,\n\t},\n    HapType,\n};\n\n/// Light Sensor service.\n#[derive(Debug, Default)]\npub struct LightSensorService {\n    /// Instance ID of the Light Sensor service.\n    id: u64,\n    /// [`HapType`](HapType) of the Light Sensor service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Current Light Level characteristic (required).\n\tpub current_light_level: CurrentLightLevelCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Status Active characteristic (optional).\n\tpub status_active: Option<StatusActiveCharacteristic>,\n\t/// Status Fault characteristic (optional).\n\tpub status_fault: Option<StatusFaultCharacteristic>,\n\t/// Status Low Battery characteristic (optional).\n\tpub status_low_battery: Option<StatusLowBatteryCharacteristic>,\n\t/// Status Tampered characteristic (optional).\n\tpub status_tampered: Option<StatusTamperedCharacteristic>,\n}\n\nimpl LightSensorService {\n    /// Creates a new Light Sensor service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::LightSensor,\n\t\t\tcurrent_light_level: CurrentLightLevelCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tstatus_active: Some(StatusActiveCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\tstatus_fault: Some(StatusFaultCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\tstatus_low_battery: Some(StatusLowBatteryCharacteristic::new(id + 1 + 3 + 1, accessory_id)),\n\t\t\tstatus_tampered: Some(StatusTamperedCharacteristic::new(id + 1 + 4 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for LightSensorService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.current_light_level,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.current_light_level,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for LightSensorService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/lightbulb.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tpower_state::PowerStateCharacteristic,\n\t\tbrightness::BrightnessCharacteristic,\n\t\tcharacteristic_value_active_transition_count::CharacteristicValueActiveTransitionCountCharacteristic,\n\t\tcharacteristic_value_transition_control::CharacteristicValueTransitionControlCharacteristic,\n\t\tcolor_temperature::ColorTemperatureCharacteristic,\n\t\thue::HueCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tsaturation::SaturationCharacteristic,\n\t\tsupported_characteristic_value_transition_configuration::SupportedCharacteristicValueTransitionConfigurationCharacteristic,\n\t},\n    HapType,\n};\n\n/// Lightbulb service.\n#[derive(Debug, Default)]\npub struct LightbulbService {\n    /// Instance ID of the Lightbulb service.\n    id: u64,\n    /// [`HapType`](HapType) of the Lightbulb service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Power State characteristic (required).\n\tpub power_state: PowerStateCharacteristic,\n\n\t/// Brightness characteristic (optional).\n\tpub brightness: Option<BrightnessCharacteristic>,\n\t/// Characteristic Value Active Transition Count characteristic (optional).\n\tpub characteristic_value_active_transition_count: Option<CharacteristicValueActiveTransitionCountCharacteristic>,\n\t/// Characteristic Value Transition Control characteristic (optional).\n\tpub characteristic_value_transition_control: Option<CharacteristicValueTransitionControlCharacteristic>,\n\t/// Color Temperature characteristic (optional).\n\tpub color_temperature: Option<ColorTemperatureCharacteristic>,\n\t/// Hue characteristic (optional).\n\tpub hue: Option<HueCharacteristic>,\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Saturation characteristic (optional).\n\tpub saturation: Option<SaturationCharacteristic>,\n\t/// Supported Characteristic Value Transition Configuration characteristic (optional).\n\tpub supported_characteristic_value_transition_configuration: Option<SupportedCharacteristicValueTransitionConfigurationCharacteristic>,\n}\n\nimpl LightbulbService {\n    /// Creates a new Lightbulb service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Lightbulb,\n\t\t\tpower_state: PowerStateCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tbrightness: Some(BrightnessCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tcharacteristic_value_active_transition_count: Some(CharacteristicValueActiveTransitionCountCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\tcharacteristic_value_transition_control: Some(CharacteristicValueTransitionControlCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\tcolor_temperature: Some(ColorTemperatureCharacteristic::new(id + 1 + 3 + 1, accessory_id)),\n\t\t\thue: Some(HueCharacteristic::new(id + 1 + 4 + 1, accessory_id)),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 5 + 1, accessory_id)),\n\t\t\tsaturation: Some(SaturationCharacteristic::new(id + 1 + 6 + 1, accessory_id)),\n\t\t\tsupported_characteristic_value_transition_configuration: Some(SupportedCharacteristicValueTransitionConfigurationCharacteristic::new(id + 1 + 7 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for LightbulbService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.power_state,\n\t\t];\n\t\tif let Some(c) = &self.brightness {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.characteristic_value_active_transition_count {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.characteristic_value_transition_control {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.color_temperature {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.hue {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.saturation {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.supported_characteristic_value_transition_configuration {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.power_state,\n\t\t];\n\t\tif let Some(c) = &mut self.brightness {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.characteristic_value_active_transition_count {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.characteristic_value_transition_control {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.color_temperature {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.hue {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.saturation {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.supported_characteristic_value_transition_configuration {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for LightbulbService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/lock_management.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tlock_control_point::LockControlPointCharacteristic,\n\t\tversion::VersionCharacteristic,\n\t\tadministrator_only_access::AdministratorOnlyAccessCharacteristic,\n\t\taudio_feedback::AudioFeedbackCharacteristic,\n\t\tcurrent_door_state::CurrentDoorStateCharacteristic,\n\t\tlock_management_auto_security_timeout::LockManagementAutoSecurityTimeoutCharacteristic,\n\t\tlock_last_known_action::LockLastKnownActionCharacteristic,\n\t\tlogs::LogsCharacteristic,\n\t\tmotion_detected::MotionDetectedCharacteristic,\n\t},\n    HapType,\n};\n\n/// Lock Management service.\n#[derive(Debug, Default)]\npub struct LockManagementService {\n    /// Instance ID of the Lock Management service.\n    id: u64,\n    /// [`HapType`](HapType) of the Lock Management service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Lock Control Point characteristic (required).\n\tpub lock_control_point: LockControlPointCharacteristic,\n\t/// Version characteristic (required).\n\tpub version: VersionCharacteristic,\n\n\t/// Administrator Only Access characteristic (optional).\n\tpub administrator_only_access: Option<AdministratorOnlyAccessCharacteristic>,\n\t/// Audio Feedback characteristic (optional).\n\tpub audio_feedback: Option<AudioFeedbackCharacteristic>,\n\t/// Current Door State characteristic (optional).\n\tpub current_door_state: Option<CurrentDoorStateCharacteristic>,\n\t/// Lock Management Auto Security Timeout characteristic (optional).\n\tpub lock_management_auto_security_timeout: Option<LockManagementAutoSecurityTimeoutCharacteristic>,\n\t/// Lock Last Known Action characteristic (optional).\n\tpub lock_last_known_action: Option<LockLastKnownActionCharacteristic>,\n\t/// Logs characteristic (optional).\n\tpub logs: Option<LogsCharacteristic>,\n\t/// Motion Detected characteristic (optional).\n\tpub motion_detected: Option<MotionDetectedCharacteristic>,\n}\n\nimpl LockManagementService {\n    /// Creates a new Lock Management service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::LockManagement,\n\t\t\tlock_control_point: LockControlPointCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tversion: VersionCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tadministrator_only_access: Some(AdministratorOnlyAccessCharacteristic::new(id + 1 + 0 + 2, accessory_id)),\n\t\t\taudio_feedback: Some(AudioFeedbackCharacteristic::new(id + 1 + 1 + 2, accessory_id)),\n\t\t\tcurrent_door_state: Some(CurrentDoorStateCharacteristic::new(id + 1 + 2 + 2, accessory_id)),\n\t\t\tlock_management_auto_security_timeout: Some(LockManagementAutoSecurityTimeoutCharacteristic::new(id + 1 + 3 + 2, accessory_id)),\n\t\t\tlock_last_known_action: Some(LockLastKnownActionCharacteristic::new(id + 1 + 4 + 2, accessory_id)),\n\t\t\tlogs: Some(LogsCharacteristic::new(id + 1 + 5 + 2, accessory_id)),\n\t\t\tmotion_detected: Some(MotionDetectedCharacteristic::new(id + 1 + 6 + 2, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for LockManagementService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.lock_control_point,\n\t\t\t&self.version,\n\t\t];\n\t\tif let Some(c) = &self.administrator_only_access {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.audio_feedback {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.current_door_state {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.lock_management_auto_security_timeout {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.lock_last_known_action {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.logs {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.motion_detected {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.lock_control_point,\n\t\t\t&mut self.version,\n\t\t];\n\t\tif let Some(c) = &mut self.administrator_only_access {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.audio_feedback {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.current_door_state {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.lock_management_auto_security_timeout {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.lock_last_known_action {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.logs {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.motion_detected {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for LockManagementService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/lock_mechanism.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tlock_current_state::LockCurrentStateCharacteristic,\n\t\tlock_target_state::LockTargetStateCharacteristic,\n\t\tname::NameCharacteristic,\n\t},\n    HapType,\n};\n\n/// Lock Mechanism service.\n#[derive(Debug, Default)]\npub struct LockMechanismService {\n    /// Instance ID of the Lock Mechanism service.\n    id: u64,\n    /// [`HapType`](HapType) of the Lock Mechanism service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Lock Current State characteristic (required).\n\tpub lock_current_state: LockCurrentStateCharacteristic,\n\t/// Lock Target State characteristic (required).\n\tpub lock_target_state: LockTargetStateCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n}\n\nimpl LockMechanismService {\n    /// Creates a new Lock Mechanism service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::LockMechanism,\n\t\t\tlock_current_state: LockCurrentStateCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tlock_target_state: LockTargetStateCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 2, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for LockMechanismService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.lock_current_state,\n\t\t\t&self.lock_target_state,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.lock_current_state,\n\t\t\t&mut self.lock_target_state,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for LockMechanismService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/microphone.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tmute::MuteCharacteristic,\n\t\tvolume::VolumeCharacteristic,\n\t},\n    HapType,\n};\n\n/// Microphone service.\n#[derive(Debug, Default)]\npub struct MicrophoneService {\n    /// Instance ID of the Microphone service.\n    id: u64,\n    /// [`HapType`](HapType) of the Microphone service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Mute characteristic (required).\n\tpub mute: MuteCharacteristic,\n\n\t/// Volume characteristic (optional).\n\tpub volume: Option<VolumeCharacteristic>,\n}\n\nimpl MicrophoneService {\n    /// Creates a new Microphone service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Microphone,\n\t\t\tmute: MuteCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tvolume: Some(VolumeCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for MicrophoneService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.mute,\n\t\t];\n\t\tif let Some(c) = &self.volume {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.mute,\n\t\t];\n\t\tif let Some(c) = &mut self.volume {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for MicrophoneService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/mod.rs",
    "content": "// this file is auto-generated by hap-codegen\n\n/// Access Code service definition.\npub mod access_code;\n/// Access Control service definition.\npub mod access_control;\n/// Accessory Information service definition.\npub mod accessory_information;\n/// Accessory Metrics service definition.\npub mod accessory_metrics;\n/// Accessory Runtime Information service definition.\npub mod accessory_runtime_information;\n/// Air Purifier service definition.\npub mod air_purifier;\n/// Air Quality Sensor service definition.\npub mod air_quality_sensor;\n/// Asset Update service definition.\npub mod asset_update;\n/// Assistant service definition.\npub mod assistant;\n/// Audio Stream Management service definition.\npub mod audio_stream_management;\n/// Battery service definition.\npub mod battery;\n/// Camera Operating Mode service definition.\npub mod camera_operating_mode;\n/// Camera Recording Management service definition.\npub mod camera_recording_management;\n/// Camera Stream Management service definition.\npub mod camera_stream_management;\n/// Carbon dioxide Sensor service definition.\npub mod carbon_dioxide_sensor;\n/// Carbon monoxide Sensor service definition.\npub mod carbon_monoxide_sensor;\n/// Cloud Relay service definition.\npub mod cloud_relay;\n/// Contact Sensor service definition.\npub mod contact_sensor;\n/// Data Stream Transport Management service definition.\npub mod data_stream_transport_management;\n/// Diagnostics service definition.\npub mod diagnostics;\n/// Door service definition.\npub mod door;\n/// Doorbell service definition.\npub mod doorbell;\n/// Fan service definition.\npub mod fan;\n/// Fan v2 service definition.\npub mod fan_v2;\n/// Faucet service definition.\npub mod faucet;\n/// Filter Maintenance service definition.\npub mod filter_maintenance;\n/// Garage Door Opener service definition.\npub mod garage_door_opener;\n/// Heater-Cooler service definition.\npub mod heater_cooler;\n/// Humidifier-Dehumidifier service definition.\npub mod humidifier_dehumidifier;\n/// Humidity Sensor service definition.\npub mod humidity_sensor;\n/// Input Source service definition.\npub mod input_source;\n/// Irrigation-System service definition.\npub mod irrigation_system;\n/// Label service definition.\npub mod label;\n/// Leak Sensor service definition.\npub mod leak_sensor;\n/// Light Sensor service definition.\npub mod light_sensor;\n/// Lightbulb service definition.\npub mod lightbulb;\n/// Lock Management service definition.\npub mod lock_management;\n/// Lock Mechanism service definition.\npub mod lock_mechanism;\n/// Microphone service definition.\npub mod microphone;\n/// Motion Sensor service definition.\npub mod motion_sensor;\n/// NFC Access Service service definition.\npub mod nfc_access_service;\n/// Occupancy Sensor service definition.\npub mod occupancy_sensor;\n/// Outlet service definition.\npub mod outlet;\n/// Pairing service definition.\npub mod pairing;\n/// Power Management service definition.\npub mod power_management;\n/// Protocol Information service definition.\npub mod protocol_information;\n/// Security System service definition.\npub mod security_system;\n/// Siri service definition.\npub mod siri;\n/// Siri Endpoint service definition.\npub mod siri_endpoint;\n/// Slats service definition.\npub mod slats;\n/// Smart Speaker service definition.\npub mod smart_speaker;\n/// Smoke Sensor service definition.\npub mod smoke_sensor;\n/// Speaker service definition.\npub mod speaker;\n/// Stateful Programmable Switch service definition.\npub mod stateful_programmable_switch;\n/// Stateless Programmable Switch service definition.\npub mod stateless_programmable_switch;\n/// Switch service definition.\npub mod switch;\n/// Target Control service definition.\npub mod target_control;\n/// Target Control Management service definition.\npub mod target_control_management;\n/// Television service definition.\npub mod television;\n/// Temperature Sensor service definition.\npub mod temperature_sensor;\n/// Thermostat service definition.\npub mod thermostat;\n/// Thread Transport service definition.\npub mod thread_transport;\n/// Transfer Transport Management service definition.\npub mod transfer_transport_management;\n/// Valve service definition.\npub mod valve;\n/// Wi-Fi Router service definition.\npub mod wi_fi_router;\n/// Wi-Fi Satellite service definition.\npub mod wi_fi_satellite;\n/// Wi-Fi Transport service definition.\npub mod wi_fi_transport;\n/// Window service definition.\npub mod window;\n/// Window Covering service definition.\npub mod window_covering;\n"
  },
  {
    "path": "src/service/generated/motion_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tmotion_detected::MotionDetectedCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tstatus_active::StatusActiveCharacteristic,\n\t\tstatus_fault::StatusFaultCharacteristic,\n\t\tstatus_low_battery::StatusLowBatteryCharacteristic,\n\t\tstatus_tampered::StatusTamperedCharacteristic,\n\t},\n    HapType,\n};\n\n/// Motion Sensor service.\n#[derive(Debug, Default)]\npub struct MotionSensorService {\n    /// Instance ID of the Motion Sensor service.\n    id: u64,\n    /// [`HapType`](HapType) of the Motion Sensor service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Motion Detected characteristic (required).\n\tpub motion_detected: MotionDetectedCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Status Active characteristic (optional).\n\tpub status_active: Option<StatusActiveCharacteristic>,\n\t/// Status Fault characteristic (optional).\n\tpub status_fault: Option<StatusFaultCharacteristic>,\n\t/// Status Low Battery characteristic (optional).\n\tpub status_low_battery: Option<StatusLowBatteryCharacteristic>,\n\t/// Status Tampered characteristic (optional).\n\tpub status_tampered: Option<StatusTamperedCharacteristic>,\n}\n\nimpl MotionSensorService {\n    /// Creates a new Motion Sensor service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::MotionSensor,\n\t\t\tmotion_detected: MotionDetectedCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tstatus_active: Some(StatusActiveCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\tstatus_fault: Some(StatusFaultCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\tstatus_low_battery: Some(StatusLowBatteryCharacteristic::new(id + 1 + 3 + 1, accessory_id)),\n\t\t\tstatus_tampered: Some(StatusTamperedCharacteristic::new(id + 1 + 4 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for MotionSensorService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.motion_detected,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.motion_detected,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for MotionSensorService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/nfc_access_service.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tconfiguration_state::ConfigurationStateCharacteristic,\n\t\tnfc_access_control_point::NfcAccessControlPointCharacteristic,\n\t\tnfc_access_supported_configuration::NfcAccessSupportedConfigurationCharacteristic,\n\t},\n    HapType,\n};\n\n/// NFC Access Service service.\n#[derive(Debug, Default)]\npub struct NfcAccessServiceService {\n    /// Instance ID of the NFC Access Service service.\n    id: u64,\n    /// [`HapType`](HapType) of the NFC Access Service service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Configuration State characteristic (required).\n\tpub configuration_state: ConfigurationStateCharacteristic,\n\t/// NFC Access Control Point characteristic (required).\n\tpub nfc_access_control_point: NfcAccessControlPointCharacteristic,\n\t/// NFC Access Supported Configuration characteristic (required).\n\tpub nfc_access_supported_configuration: NfcAccessSupportedConfigurationCharacteristic,\n\n}\n\nimpl NfcAccessServiceService {\n    /// Creates a new NFC Access Service service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::NfcAccessService,\n\t\t\tconfiguration_state: ConfigurationStateCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tnfc_access_control_point: NfcAccessControlPointCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tnfc_access_supported_configuration: NfcAccessSupportedConfigurationCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for NfcAccessServiceService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.configuration_state,\n\t\t\t&self.nfc_access_control_point,\n\t\t\t&self.nfc_access_supported_configuration,\n\t\t];\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.configuration_state,\n\t\t\t&mut self.nfc_access_control_point,\n\t\t\t&mut self.nfc_access_supported_configuration,\n\t\t];\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for NfcAccessServiceService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/occupancy_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\toccupancy_detected::OccupancyDetectedCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tstatus_active::StatusActiveCharacteristic,\n\t\tstatus_fault::StatusFaultCharacteristic,\n\t\tstatus_low_battery::StatusLowBatteryCharacteristic,\n\t\tstatus_tampered::StatusTamperedCharacteristic,\n\t},\n    HapType,\n};\n\n/// Occupancy Sensor service.\n#[derive(Debug, Default)]\npub struct OccupancySensorService {\n    /// Instance ID of the Occupancy Sensor service.\n    id: u64,\n    /// [`HapType`](HapType) of the Occupancy Sensor service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Occupancy Detected characteristic (required).\n\tpub occupancy_detected: OccupancyDetectedCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Status Active characteristic (optional).\n\tpub status_active: Option<StatusActiveCharacteristic>,\n\t/// Status Fault characteristic (optional).\n\tpub status_fault: Option<StatusFaultCharacteristic>,\n\t/// Status Low Battery characteristic (optional).\n\tpub status_low_battery: Option<StatusLowBatteryCharacteristic>,\n\t/// Status Tampered characteristic (optional).\n\tpub status_tampered: Option<StatusTamperedCharacteristic>,\n}\n\nimpl OccupancySensorService {\n    /// Creates a new Occupancy Sensor service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::OccupancySensor,\n\t\t\toccupancy_detected: OccupancyDetectedCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tstatus_active: Some(StatusActiveCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\tstatus_fault: Some(StatusFaultCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\tstatus_low_battery: Some(StatusLowBatteryCharacteristic::new(id + 1 + 3 + 1, accessory_id)),\n\t\t\tstatus_tampered: Some(StatusTamperedCharacteristic::new(id + 1 + 4 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for OccupancySensorService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.occupancy_detected,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.occupancy_detected,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for OccupancySensorService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/outlet.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tpower_state::PowerStateCharacteristic,\n\t\tname::NameCharacteristic,\n\t\toutlet_in_use::OutletInUseCharacteristic,\n\t},\n    HapType,\n};\n\n/// Outlet service.\n#[derive(Debug, Default)]\npub struct OutletService {\n    /// Instance ID of the Outlet service.\n    id: u64,\n    /// [`HapType`](HapType) of the Outlet service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Power State characteristic (required).\n\tpub power_state: PowerStateCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Outlet In Use characteristic (optional).\n\tpub outlet_in_use: Option<OutletInUseCharacteristic>,\n}\n\nimpl OutletService {\n    /// Creates a new Outlet service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Outlet,\n\t\t\tpower_state: PowerStateCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\toutlet_in_use: Some(OutletInUseCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for OutletService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.power_state,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.outlet_in_use {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.power_state,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.outlet_in_use {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for OutletService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/pairing.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tlist_pairings::ListPairingsCharacteristic,\n\t\tpair_setup::PairSetupCharacteristic,\n\t\tpair_verify::PairVerifyCharacteristic,\n\t\tpairing_features::PairingFeaturesCharacteristic,\n\t},\n    HapType,\n};\n\n/// Pairing service.\n#[derive(Debug, Default)]\npub struct PairingService {\n    /// Instance ID of the Pairing service.\n    id: u64,\n    /// [`HapType`](HapType) of the Pairing service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// List Pairings characteristic (required).\n\tpub list_pairings: ListPairingsCharacteristic,\n\t/// Pair Setup characteristic (required).\n\tpub pair_setup: PairSetupCharacteristic,\n\t/// Pair Verify characteristic (required).\n\tpub pair_verify: PairVerifyCharacteristic,\n\t/// Pairing Features characteristic (required).\n\tpub pairing_features: PairingFeaturesCharacteristic,\n\n}\n\nimpl PairingService {\n    /// Creates a new Pairing service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Pairing,\n\t\t\tlist_pairings: ListPairingsCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tpair_setup: PairSetupCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tpair_verify: PairVerifyCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\tpairing_features: PairingFeaturesCharacteristic::new(id + 1 + 3, accessory_id),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for PairingService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.list_pairings,\n\t\t\t&self.pair_setup,\n\t\t\t&self.pair_verify,\n\t\t\t&self.pairing_features,\n\t\t];\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.list_pairings,\n\t\t\t&mut self.pair_setup,\n\t\t\t&mut self.pair_verify,\n\t\t\t&mut self.pairing_features,\n\t\t];\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for PairingService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/power_management.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\twake_configuration::WakeConfigurationCharacteristic,\n\t},\n    HapType,\n};\n\n/// Power Management service.\n#[derive(Debug, Default)]\npub struct PowerManagementService {\n    /// Instance ID of the Power Management service.\n    id: u64,\n    /// [`HapType`](HapType) of the Power Management service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Wake Configuration characteristic (required).\n\tpub wake_configuration: WakeConfigurationCharacteristic,\n\n}\n\nimpl PowerManagementService {\n    /// Creates a new Power Management service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::PowerManagement,\n\t\t\twake_configuration: WakeConfigurationCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for PowerManagementService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.wake_configuration,\n\t\t];\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.wake_configuration,\n\t\t];\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for PowerManagementService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/protocol_information.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tversion::VersionCharacteristic,\n\t},\n    HapType,\n};\n\n/// Protocol Information service.\n#[derive(Debug, Default)]\npub struct ProtocolInformationService {\n    /// Instance ID of the Protocol Information service.\n    id: u64,\n    /// [`HapType`](HapType) of the Protocol Information service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Version characteristic (required).\n\tpub version: VersionCharacteristic,\n\n}\n\nimpl ProtocolInformationService {\n    /// Creates a new Protocol Information service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::ProtocolInformation,\n\t\t\tversion: VersionCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for ProtocolInformationService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.version,\n\t\t];\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.version,\n\t\t];\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for ProtocolInformationService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/security_system.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tsecurity_system_current_state::SecuritySystemCurrentStateCharacteristic,\n\t\tsecurity_system_target_state::SecuritySystemTargetStateCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tsecurity_system_alarm_type::SecuritySystemAlarmTypeCharacteristic,\n\t\tstatus_fault::StatusFaultCharacteristic,\n\t\tstatus_tampered::StatusTamperedCharacteristic,\n\t},\n    HapType,\n};\n\n/// Security System service.\n#[derive(Debug, Default)]\npub struct SecuritySystemService {\n    /// Instance ID of the Security System service.\n    id: u64,\n    /// [`HapType`](HapType) of the Security System service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Security System Current State characteristic (required).\n\tpub security_system_current_state: SecuritySystemCurrentStateCharacteristic,\n\t/// Security System Target State characteristic (required).\n\tpub security_system_target_state: SecuritySystemTargetStateCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Security System Alarm Type characteristic (optional).\n\tpub security_system_alarm_type: Option<SecuritySystemAlarmTypeCharacteristic>,\n\t/// Status Fault characteristic (optional).\n\tpub status_fault: Option<StatusFaultCharacteristic>,\n\t/// Status Tampered characteristic (optional).\n\tpub status_tampered: Option<StatusTamperedCharacteristic>,\n}\n\nimpl SecuritySystemService {\n    /// Creates a new Security System service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::SecuritySystem,\n\t\t\tsecurity_system_current_state: SecuritySystemCurrentStateCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tsecurity_system_target_state: SecuritySystemTargetStateCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 2, accessory_id)),\n\t\t\tsecurity_system_alarm_type: Some(SecuritySystemAlarmTypeCharacteristic::new(id + 1 + 1 + 2, accessory_id)),\n\t\t\tstatus_fault: Some(StatusFaultCharacteristic::new(id + 1 + 2 + 2, accessory_id)),\n\t\t\tstatus_tampered: Some(StatusTamperedCharacteristic::new(id + 1 + 3 + 2, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for SecuritySystemService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.security_system_current_state,\n\t\t\t&self.security_system_target_state,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.security_system_alarm_type {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.security_system_current_state,\n\t\t\t&mut self.security_system_target_state,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.security_system_alarm_type {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for SecuritySystemService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/siri.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tsiri_input_type::SiriInputTypeCharacteristic,\n\t\tmultifunction_button::MultifunctionButtonCharacteristic,\n\t\tsiri_enable::SiriEnableCharacteristic,\n\t\tsiri_engine_version::SiriEngineVersionCharacteristic,\n\t\tsiri_light_on_use::SiriLightOnUseCharacteristic,\n\t\tsiri_listening::SiriListeningCharacteristic,\n\t\tsiri_touch_to_use::SiriTouchToUseCharacteristic,\n\t},\n    HapType,\n};\n\n/// Siri service.\n#[derive(Debug, Default)]\npub struct SiriService {\n    /// Instance ID of the Siri service.\n    id: u64,\n    /// [`HapType`](HapType) of the Siri service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Siri Input Type characteristic (required).\n\tpub siri_input_type: SiriInputTypeCharacteristic,\n\n\t/// Multifunction Button characteristic (optional).\n\tpub multifunction_button: Option<MultifunctionButtonCharacteristic>,\n\t/// Siri Enable characteristic (optional).\n\tpub siri_enable: Option<SiriEnableCharacteristic>,\n\t/// Siri Engine Version characteristic (optional).\n\tpub siri_engine_version: Option<SiriEngineVersionCharacteristic>,\n\t/// Siri Light On Use characteristic (optional).\n\tpub siri_light_on_use: Option<SiriLightOnUseCharacteristic>,\n\t/// Siri Listening characteristic (optional).\n\tpub siri_listening: Option<SiriListeningCharacteristic>,\n\t/// Siri Touch To Use characteristic (optional).\n\tpub siri_touch_to_use: Option<SiriTouchToUseCharacteristic>,\n}\n\nimpl SiriService {\n    /// Creates a new Siri service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Siri,\n\t\t\tsiri_input_type: SiriInputTypeCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tmultifunction_button: Some(MultifunctionButtonCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tsiri_enable: Some(SiriEnableCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\tsiri_engine_version: Some(SiriEngineVersionCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\tsiri_light_on_use: Some(SiriLightOnUseCharacteristic::new(id + 1 + 3 + 1, accessory_id)),\n\t\t\tsiri_listening: Some(SiriListeningCharacteristic::new(id + 1 + 4 + 1, accessory_id)),\n\t\t\tsiri_touch_to_use: Some(SiriTouchToUseCharacteristic::new(id + 1 + 5 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for SiriService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.siri_input_type,\n\t\t];\n\t\tif let Some(c) = &self.multifunction_button {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.siri_enable {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.siri_engine_version {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.siri_light_on_use {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.siri_listening {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.siri_touch_to_use {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.siri_input_type,\n\t\t];\n\t\tif let Some(c) = &mut self.multifunction_button {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.siri_enable {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.siri_engine_version {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.siri_light_on_use {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.siri_listening {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.siri_touch_to_use {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for SiriService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/siri_endpoint.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tsiri_endpoint_session_status::SiriEndpointSessionStatusCharacteristic,\n\t\tversion::VersionCharacteristic,\n\t\tactive_identifier::ActiveIdentifierCharacteristic,\n\t\tmanually_disabled::ManuallyDisabledCharacteristic,\n\t},\n    HapType,\n};\n\n/// Siri Endpoint service.\n#[derive(Debug, Default)]\npub struct SiriEndpointService {\n    /// Instance ID of the Siri Endpoint service.\n    id: u64,\n    /// [`HapType`](HapType) of the Siri Endpoint service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Siri Endpoint Session Status characteristic (required).\n\tpub siri_endpoint_session_status: SiriEndpointSessionStatusCharacteristic,\n\t/// Version characteristic (required).\n\tpub version: VersionCharacteristic,\n\n\t/// Active Identifier characteristic (optional).\n\tpub active_identifier: Option<ActiveIdentifierCharacteristic>,\n\t/// Manually disabled characteristic (optional).\n\tpub manually_disabled: Option<ManuallyDisabledCharacteristic>,\n}\n\nimpl SiriEndpointService {\n    /// Creates a new Siri Endpoint service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::SiriEndpoint,\n\t\t\tsiri_endpoint_session_status: SiriEndpointSessionStatusCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tversion: VersionCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tactive_identifier: Some(ActiveIdentifierCharacteristic::new(id + 1 + 0 + 2, accessory_id)),\n\t\t\tmanually_disabled: Some(ManuallyDisabledCharacteristic::new(id + 1 + 1 + 2, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for SiriEndpointService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.siri_endpoint_session_status,\n\t\t\t&self.version,\n\t\t];\n\t\tif let Some(c) = &self.active_identifier {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.manually_disabled {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.siri_endpoint_session_status,\n\t\t\t&mut self.version,\n\t\t];\n\t\tif let Some(c) = &mut self.active_identifier {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.manually_disabled {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for SiriEndpointService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/slats.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tcurrent_slat_state::CurrentSlatStateCharacteristic,\n\t\tslat_type::SlatTypeCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tswing_mode::SwingModeCharacteristic,\n\t\tcurrent_tilt_angle::CurrentTiltAngleCharacteristic,\n\t\ttarget_tilt_angle::TargetTiltAngleCharacteristic,\n\t},\n    HapType,\n};\n\n/// Slats service.\n#[derive(Debug, Default)]\npub struct SlatsService {\n    /// Instance ID of the Slats service.\n    id: u64,\n    /// [`HapType`](HapType) of the Slats service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Current Slat State characteristic (required).\n\tpub current_slat_state: CurrentSlatStateCharacteristic,\n\t/// Slat Type characteristic (required).\n\tpub slat_type: SlatTypeCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Swing Mode characteristic (optional).\n\tpub swing_mode: Option<SwingModeCharacteristic>,\n\t/// Current Tilt Angle characteristic (optional).\n\tpub current_tilt_angle: Option<CurrentTiltAngleCharacteristic>,\n\t/// Target Tilt Angle characteristic (optional).\n\tpub target_tilt_angle: Option<TargetTiltAngleCharacteristic>,\n}\n\nimpl SlatsService {\n    /// Creates a new Slats service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Slats,\n\t\t\tcurrent_slat_state: CurrentSlatStateCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tslat_type: SlatTypeCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 2, accessory_id)),\n\t\t\tswing_mode: Some(SwingModeCharacteristic::new(id + 1 + 1 + 2, accessory_id)),\n\t\t\tcurrent_tilt_angle: Some(CurrentTiltAngleCharacteristic::new(id + 1 + 2 + 2, accessory_id)),\n\t\t\ttarget_tilt_angle: Some(TargetTiltAngleCharacteristic::new(id + 1 + 3 + 2, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for SlatsService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.current_slat_state,\n\t\t\t&self.slat_type,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.swing_mode {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.current_tilt_angle {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.target_tilt_angle {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.current_slat_state,\n\t\t\t&mut self.slat_type,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.swing_mode {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.current_tilt_angle {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.target_tilt_angle {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for SlatsService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/smart_speaker.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tcurrent_media_state::CurrentMediaStateCharacteristic,\n\t\ttarget_media_state::TargetMediaStateCharacteristic,\n\t\tairplay_enable::AirplayEnableCharacteristic,\n\t\tconfigured_name::ConfiguredNameCharacteristic,\n\t\tmute::MuteCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tvolume::VolumeCharacteristic,\n\t},\n    HapType,\n};\n\n/// Smart Speaker service.\n#[derive(Debug, Default)]\npub struct SmartSpeakerService {\n    /// Instance ID of the Smart Speaker service.\n    id: u64,\n    /// [`HapType`](HapType) of the Smart Speaker service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Current Media State characteristic (required).\n\tpub current_media_state: CurrentMediaStateCharacteristic,\n\t/// Target Media State characteristic (required).\n\tpub target_media_state: TargetMediaStateCharacteristic,\n\n\t/// AirPlay Enable characteristic (optional).\n\tpub airplay_enable: Option<AirplayEnableCharacteristic>,\n\t/// Configured Name characteristic (optional).\n\tpub configured_name: Option<ConfiguredNameCharacteristic>,\n\t/// Mute characteristic (optional).\n\tpub mute: Option<MuteCharacteristic>,\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Volume characteristic (optional).\n\tpub volume: Option<VolumeCharacteristic>,\n}\n\nimpl SmartSpeakerService {\n    /// Creates a new Smart Speaker service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::SmartSpeaker,\n\t\t\tcurrent_media_state: CurrentMediaStateCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\ttarget_media_state: TargetMediaStateCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tairplay_enable: Some(AirplayEnableCharacteristic::new(id + 1 + 0 + 2, accessory_id)),\n\t\t\tconfigured_name: Some(ConfiguredNameCharacteristic::new(id + 1 + 1 + 2, accessory_id)),\n\t\t\tmute: Some(MuteCharacteristic::new(id + 1 + 2 + 2, accessory_id)),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 3 + 2, accessory_id)),\n\t\t\tvolume: Some(VolumeCharacteristic::new(id + 1 + 4 + 2, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for SmartSpeakerService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.current_media_state,\n\t\t\t&self.target_media_state,\n\t\t];\n\t\tif let Some(c) = &self.airplay_enable {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.configured_name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.mute {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.volume {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.current_media_state,\n\t\t\t&mut self.target_media_state,\n\t\t];\n\t\tif let Some(c) = &mut self.airplay_enable {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.configured_name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.mute {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.volume {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for SmartSpeakerService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/smoke_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tsmoke_detected::SmokeDetectedCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tstatus_active::StatusActiveCharacteristic,\n\t\tstatus_fault::StatusFaultCharacteristic,\n\t\tstatus_low_battery::StatusLowBatteryCharacteristic,\n\t\tstatus_tampered::StatusTamperedCharacteristic,\n\t},\n    HapType,\n};\n\n/// Smoke Sensor service.\n#[derive(Debug, Default)]\npub struct SmokeSensorService {\n    /// Instance ID of the Smoke Sensor service.\n    id: u64,\n    /// [`HapType`](HapType) of the Smoke Sensor service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Smoke Detected characteristic (required).\n\tpub smoke_detected: SmokeDetectedCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Status Active characteristic (optional).\n\tpub status_active: Option<StatusActiveCharacteristic>,\n\t/// Status Fault characteristic (optional).\n\tpub status_fault: Option<StatusFaultCharacteristic>,\n\t/// Status Low Battery characteristic (optional).\n\tpub status_low_battery: Option<StatusLowBatteryCharacteristic>,\n\t/// Status Tampered characteristic (optional).\n\tpub status_tampered: Option<StatusTamperedCharacteristic>,\n}\n\nimpl SmokeSensorService {\n    /// Creates a new Smoke Sensor service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::SmokeSensor,\n\t\t\tsmoke_detected: SmokeDetectedCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tstatus_active: Some(StatusActiveCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\tstatus_fault: Some(StatusFaultCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\tstatus_low_battery: Some(StatusLowBatteryCharacteristic::new(id + 1 + 3 + 1, accessory_id)),\n\t\t\tstatus_tampered: Some(StatusTamperedCharacteristic::new(id + 1 + 4 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for SmokeSensorService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.smoke_detected,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.smoke_detected,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for SmokeSensorService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/speaker.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tmute::MuteCharacteristic,\n\t\tactive::ActiveCharacteristic,\n\t\tvolume::VolumeCharacteristic,\n\t\tvolume_control_type::VolumeControlTypeCharacteristic,\n\t\tvolume_selector::VolumeSelectorCharacteristic,\n\t},\n    HapType,\n};\n\n/// Speaker service.\n#[derive(Debug, Default)]\npub struct SpeakerService {\n    /// Instance ID of the Speaker service.\n    id: u64,\n    /// [`HapType`](HapType) of the Speaker service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Mute characteristic (required).\n\tpub mute: MuteCharacteristic,\n\n\t/// Active characteristic (optional).\n\tpub active: Option<ActiveCharacteristic>,\n\t/// Volume characteristic (optional).\n\tpub volume: Option<VolumeCharacteristic>,\n\t/// Volume Control Type characteristic (optional).\n\tpub volume_control_type: Option<VolumeControlTypeCharacteristic>,\n\t/// Volume Selector characteristic (optional).\n\tpub volume_selector: Option<VolumeSelectorCharacteristic>,\n}\n\nimpl SpeakerService {\n    /// Creates a new Speaker service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Speaker,\n\t\t\tmute: MuteCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tactive: Some(ActiveCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tvolume: Some(VolumeCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\tvolume_control_type: Some(VolumeControlTypeCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\tvolume_selector: Some(VolumeSelectorCharacteristic::new(id + 1 + 3 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for SpeakerService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.mute,\n\t\t];\n\t\tif let Some(c) = &self.active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.volume {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.volume_control_type {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.volume_selector {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.mute,\n\t\t];\n\t\tif let Some(c) = &mut self.active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.volume {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.volume_control_type {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.volume_selector {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for SpeakerService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/stateful_programmable_switch.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tprogrammable_switch_event::ProgrammableSwitchEventCharacteristic,\n\t\tprogrammable_switch_output_state::ProgrammableSwitchOutputStateCharacteristic,\n\t\tname::NameCharacteristic,\n\t},\n    HapType,\n};\n\n/// Stateful Programmable Switch service.\n#[derive(Debug, Default)]\npub struct StatefulProgrammableSwitchService {\n    /// Instance ID of the Stateful Programmable Switch service.\n    id: u64,\n    /// [`HapType`](HapType) of the Stateful Programmable Switch service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Programmable Switch Event characteristic (required).\n\tpub programmable_switch_event: ProgrammableSwitchEventCharacteristic,\n\t/// Programmable Switch Output State characteristic (required).\n\tpub programmable_switch_output_state: ProgrammableSwitchOutputStateCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n}\n\nimpl StatefulProgrammableSwitchService {\n    /// Creates a new Stateful Programmable Switch service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::StatefulProgrammableSwitch,\n\t\t\tprogrammable_switch_event: ProgrammableSwitchEventCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tprogrammable_switch_output_state: ProgrammableSwitchOutputStateCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 2, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for StatefulProgrammableSwitchService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.programmable_switch_event,\n\t\t\t&self.programmable_switch_output_state,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.programmable_switch_event,\n\t\t\t&mut self.programmable_switch_output_state,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for StatefulProgrammableSwitchService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/stateless_programmable_switch.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tprogrammable_switch_event::ProgrammableSwitchEventCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tlabel_index::LabelIndexCharacteristic,\n\t},\n    HapType,\n};\n\n/// Stateless Programmable Switch service.\n#[derive(Debug, Default)]\npub struct StatelessProgrammableSwitchService {\n    /// Instance ID of the Stateless Programmable Switch service.\n    id: u64,\n    /// [`HapType`](HapType) of the Stateless Programmable Switch service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Programmable Switch Event characteristic (required).\n\tpub programmable_switch_event: ProgrammableSwitchEventCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Label Index characteristic (optional).\n\tpub label_index: Option<LabelIndexCharacteristic>,\n}\n\nimpl StatelessProgrammableSwitchService {\n    /// Creates a new Stateless Programmable Switch service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::StatelessProgrammableSwitch,\n\t\t\tprogrammable_switch_event: ProgrammableSwitchEventCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tlabel_index: Some(LabelIndexCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for StatelessProgrammableSwitchService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.programmable_switch_event,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.label_index {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.programmable_switch_event,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.label_index {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for StatelessProgrammableSwitchService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/switch.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tpower_state::PowerStateCharacteristic,\n\t\tname::NameCharacteristic,\n\t},\n    HapType,\n};\n\n/// Switch service.\n#[derive(Debug, Default)]\npub struct SwitchService {\n    /// Instance ID of the Switch service.\n    id: u64,\n    /// [`HapType`](HapType) of the Switch service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Power State characteristic (required).\n\tpub power_state: PowerStateCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n}\n\nimpl SwitchService {\n    /// Creates a new Switch service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Switch,\n\t\t\tpower_state: PowerStateCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for SwitchService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.power_state,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.power_state,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for SwitchService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/target_control.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tactive::ActiveCharacteristic,\n\t\tactive_identifier::ActiveIdentifierCharacteristic,\n\t\tbutton_event::ButtonEventCharacteristic,\n\t\tname::NameCharacteristic,\n\t},\n    HapType,\n};\n\n/// Target Control service.\n#[derive(Debug, Default)]\npub struct TargetControlService {\n    /// Instance ID of the Target Control service.\n    id: u64,\n    /// [`HapType`](HapType) of the Target Control service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Active characteristic (required).\n\tpub active: ActiveCharacteristic,\n\t/// Active Identifier characteristic (required).\n\tpub active_identifier: ActiveIdentifierCharacteristic,\n\t/// Button Event characteristic (required).\n\tpub button_event: ButtonEventCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n}\n\nimpl TargetControlService {\n    /// Creates a new Target Control service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::TargetControl,\n\t\t\tactive: ActiveCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tactive_identifier: ActiveIdentifierCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tbutton_event: ButtonEventCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 3, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for TargetControlService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.active,\n\t\t\t&self.active_identifier,\n\t\t\t&self.button_event,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.active,\n\t\t\t&mut self.active_identifier,\n\t\t\t&mut self.button_event,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for TargetControlService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/target_control_management.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tsupported_target_configuration::SupportedTargetConfigurationCharacteristic,\n\t\ttarget_list_configuration::TargetListConfigurationCharacteristic,\n\t},\n    HapType,\n};\n\n/// Target Control Management service.\n#[derive(Debug, Default)]\npub struct TargetControlManagementService {\n    /// Instance ID of the Target Control Management service.\n    id: u64,\n    /// [`HapType`](HapType) of the Target Control Management service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Supported Target Configuration characteristic (required).\n\tpub supported_target_configuration: SupportedTargetConfigurationCharacteristic,\n\t/// Target List Configuration characteristic (required).\n\tpub target_list_configuration: TargetListConfigurationCharacteristic,\n\n}\n\nimpl TargetControlManagementService {\n    /// Creates a new Target Control Management service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::TargetControlManagement,\n\t\t\tsupported_target_configuration: SupportedTargetConfigurationCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\ttarget_list_configuration: TargetListConfigurationCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for TargetControlManagementService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.supported_target_configuration,\n\t\t\t&self.target_list_configuration,\n\t\t];\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.supported_target_configuration,\n\t\t\t&mut self.target_list_configuration,\n\t\t];\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for TargetControlManagementService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/television.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tactive::ActiveCharacteristic,\n\t\tactive_identifier::ActiveIdentifierCharacteristic,\n\t\tconfigured_name::ConfiguredNameCharacteristic,\n\t\tremote_key::RemoteKeyCharacteristic,\n\t\tsleep_discovery_mode::SleepDiscoveryModeCharacteristic,\n\t\tbrightness::BrightnessCharacteristic,\n\t\tclosed_captions::ClosedCaptionsCharacteristic,\n\t\tdisplay_order::DisplayOrderCharacteristic,\n\t\tcurrent_media_state::CurrentMediaStateCharacteristic,\n\t\ttarget_media_state::TargetMediaStateCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tpicture_mode::PictureModeCharacteristic,\n\t\tpower_mode_selection::PowerModeSelectionCharacteristic,\n\t},\n    HapType,\n};\n\n/// Television service.\n#[derive(Debug, Default)]\npub struct TelevisionService {\n    /// Instance ID of the Television service.\n    id: u64,\n    /// [`HapType`](HapType) of the Television service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Active characteristic (required).\n\tpub active: ActiveCharacteristic,\n\t/// Active Identifier characteristic (required).\n\tpub active_identifier: ActiveIdentifierCharacteristic,\n\t/// Configured Name characteristic (required).\n\tpub configured_name: ConfiguredNameCharacteristic,\n\t/// Remote Key characteristic (required).\n\tpub remote_key: RemoteKeyCharacteristic,\n\t/// Sleep Discovery Mode characteristic (required).\n\tpub sleep_discovery_mode: SleepDiscoveryModeCharacteristic,\n\n\t/// Brightness characteristic (optional).\n\tpub brightness: Option<BrightnessCharacteristic>,\n\t/// Closed Captions characteristic (optional).\n\tpub closed_captions: Option<ClosedCaptionsCharacteristic>,\n\t/// Display Order characteristic (optional).\n\tpub display_order: Option<DisplayOrderCharacteristic>,\n\t/// Current Media State characteristic (optional).\n\tpub current_media_state: Option<CurrentMediaStateCharacteristic>,\n\t/// Target Media State characteristic (optional).\n\tpub target_media_state: Option<TargetMediaStateCharacteristic>,\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Picture Mode characteristic (optional).\n\tpub picture_mode: Option<PictureModeCharacteristic>,\n\t/// Power Mode Selection characteristic (optional).\n\tpub power_mode_selection: Option<PowerModeSelectionCharacteristic>,\n}\n\nimpl TelevisionService {\n    /// Creates a new Television service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Television,\n\t\t\tactive: ActiveCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tactive_identifier: ActiveIdentifierCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tconfigured_name: ConfiguredNameCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\tremote_key: RemoteKeyCharacteristic::new(id + 1 + 3, accessory_id),\n\t\t\tsleep_discovery_mode: SleepDiscoveryModeCharacteristic::new(id + 1 + 4, accessory_id),\n\t\t\tbrightness: Some(BrightnessCharacteristic::new(id + 1 + 0 + 5, accessory_id)),\n\t\t\tclosed_captions: Some(ClosedCaptionsCharacteristic::new(id + 1 + 1 + 5, accessory_id)),\n\t\t\tdisplay_order: Some(DisplayOrderCharacteristic::new(id + 1 + 2 + 5, accessory_id)),\n\t\t\tcurrent_media_state: Some(CurrentMediaStateCharacteristic::new(id + 1 + 3 + 5, accessory_id)),\n\t\t\ttarget_media_state: Some(TargetMediaStateCharacteristic::new(id + 1 + 4 + 5, accessory_id)),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 5 + 5, accessory_id)),\n\t\t\tpicture_mode: Some(PictureModeCharacteristic::new(id + 1 + 6 + 5, accessory_id)),\n\t\t\tpower_mode_selection: Some(PowerModeSelectionCharacteristic::new(id + 1 + 7 + 5, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for TelevisionService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.active,\n\t\t\t&self.active_identifier,\n\t\t\t&self.configured_name,\n\t\t\t&self.remote_key,\n\t\t\t&self.sleep_discovery_mode,\n\t\t];\n\t\tif let Some(c) = &self.brightness {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.closed_captions {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.display_order {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.current_media_state {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.target_media_state {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.picture_mode {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.power_mode_selection {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.active,\n\t\t\t&mut self.active_identifier,\n\t\t\t&mut self.configured_name,\n\t\t\t&mut self.remote_key,\n\t\t\t&mut self.sleep_discovery_mode,\n\t\t];\n\t\tif let Some(c) = &mut self.brightness {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.closed_captions {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.display_order {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.current_media_state {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.target_media_state {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.picture_mode {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.power_mode_selection {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for TelevisionService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/temperature_sensor.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tcurrent_temperature::CurrentTemperatureCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tstatus_active::StatusActiveCharacteristic,\n\t\tstatus_fault::StatusFaultCharacteristic,\n\t\tstatus_low_battery::StatusLowBatteryCharacteristic,\n\t\tstatus_tampered::StatusTamperedCharacteristic,\n\t},\n    HapType,\n};\n\n/// Temperature Sensor service.\n#[derive(Debug, Default)]\npub struct TemperatureSensorService {\n    /// Instance ID of the Temperature Sensor service.\n    id: u64,\n    /// [`HapType`](HapType) of the Temperature Sensor service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Current Temperature characteristic (required).\n\tpub current_temperature: CurrentTemperatureCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Status Active characteristic (optional).\n\tpub status_active: Option<StatusActiveCharacteristic>,\n\t/// Status Fault characteristic (optional).\n\tpub status_fault: Option<StatusFaultCharacteristic>,\n\t/// Status Low Battery characteristic (optional).\n\tpub status_low_battery: Option<StatusLowBatteryCharacteristic>,\n\t/// Status Tampered characteristic (optional).\n\tpub status_tampered: Option<StatusTamperedCharacteristic>,\n}\n\nimpl TemperatureSensorService {\n    /// Creates a new Temperature Sensor service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::TemperatureSensor,\n\t\t\tcurrent_temperature: CurrentTemperatureCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 1, accessory_id)),\n\t\t\tstatus_active: Some(StatusActiveCharacteristic::new(id + 1 + 1 + 1, accessory_id)),\n\t\t\tstatus_fault: Some(StatusFaultCharacteristic::new(id + 1 + 2 + 1, accessory_id)),\n\t\t\tstatus_low_battery: Some(StatusLowBatteryCharacteristic::new(id + 1 + 3 + 1, accessory_id)),\n\t\t\tstatus_tampered: Some(StatusTamperedCharacteristic::new(id + 1 + 4 + 1, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for TemperatureSensorService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.current_temperature,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.current_temperature,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_active {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_low_battery {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_tampered {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for TemperatureSensorService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/thermostat.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tcurrent_heating_cooling_state::CurrentHeatingCoolingStateCharacteristic,\n\t\ttarget_heating_cooling_state::TargetHeatingCoolingStateCharacteristic,\n\t\tcurrent_temperature::CurrentTemperatureCharacteristic,\n\t\ttarget_temperature::TargetTemperatureCharacteristic,\n\t\ttemperature_display_units::TemperatureDisplayUnitsCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tcurrent_relative_humidity::CurrentRelativeHumidityCharacteristic,\n\t\ttarget_relative_humidity::TargetRelativeHumidityCharacteristic,\n\t\tcooling_threshold_temperature::CoolingThresholdTemperatureCharacteristic,\n\t\theating_threshold_temperature::HeatingThresholdTemperatureCharacteristic,\n\t},\n    HapType,\n};\n\n/// Thermostat service.\n#[derive(Debug, Default)]\npub struct ThermostatService {\n    /// Instance ID of the Thermostat service.\n    id: u64,\n    /// [`HapType`](HapType) of the Thermostat service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Current Heating Cooling State characteristic (required).\n\tpub current_heating_cooling_state: CurrentHeatingCoolingStateCharacteristic,\n\t/// Target Heating Cooling State characteristic (required).\n\tpub target_heating_cooling_state: TargetHeatingCoolingStateCharacteristic,\n\t/// Current Temperature characteristic (required).\n\tpub current_temperature: CurrentTemperatureCharacteristic,\n\t/// Target Temperature characteristic (required).\n\tpub target_temperature: TargetTemperatureCharacteristic,\n\t/// Temperature Display Units characteristic (required).\n\tpub temperature_display_units: TemperatureDisplayUnitsCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Current Relative Humidity characteristic (optional).\n\tpub current_relative_humidity: Option<CurrentRelativeHumidityCharacteristic>,\n\t/// Target Relative Humidity characteristic (optional).\n\tpub target_relative_humidity: Option<TargetRelativeHumidityCharacteristic>,\n\t/// Cooling Threshold Temperature characteristic (optional).\n\tpub cooling_threshold_temperature: Option<CoolingThresholdTemperatureCharacteristic>,\n\t/// Heating Threshold Temperature characteristic (optional).\n\tpub heating_threshold_temperature: Option<HeatingThresholdTemperatureCharacteristic>,\n}\n\nimpl ThermostatService {\n    /// Creates a new Thermostat service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Thermostat,\n\t\t\tcurrent_heating_cooling_state: CurrentHeatingCoolingStateCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\ttarget_heating_cooling_state: TargetHeatingCoolingStateCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tcurrent_temperature: CurrentTemperatureCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\ttarget_temperature: TargetTemperatureCharacteristic::new(id + 1 + 3, accessory_id),\n\t\t\ttemperature_display_units: TemperatureDisplayUnitsCharacteristic::new(id + 1 + 4, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 5, accessory_id)),\n\t\t\tcurrent_relative_humidity: Some(CurrentRelativeHumidityCharacteristic::new(id + 1 + 1 + 5, accessory_id)),\n\t\t\ttarget_relative_humidity: Some(TargetRelativeHumidityCharacteristic::new(id + 1 + 2 + 5, accessory_id)),\n\t\t\tcooling_threshold_temperature: Some(CoolingThresholdTemperatureCharacteristic::new(id + 1 + 3 + 5, accessory_id)),\n\t\t\theating_threshold_temperature: Some(HeatingThresholdTemperatureCharacteristic::new(id + 1 + 4 + 5, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for ThermostatService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.current_heating_cooling_state,\n\t\t\t&self.target_heating_cooling_state,\n\t\t\t&self.current_temperature,\n\t\t\t&self.target_temperature,\n\t\t\t&self.temperature_display_units,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.current_relative_humidity {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.target_relative_humidity {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.cooling_threshold_temperature {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.heating_threshold_temperature {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.current_heating_cooling_state,\n\t\t\t&mut self.target_heating_cooling_state,\n\t\t\t&mut self.current_temperature,\n\t\t\t&mut self.target_temperature,\n\t\t\t&mut self.temperature_display_units,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.current_relative_humidity {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.target_relative_humidity {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.cooling_threshold_temperature {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.heating_threshold_temperature {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for ThermostatService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/thread_transport.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tcurrent_transport::CurrentTransportCharacteristic,\n\t\tthread_control_point::ThreadControlPointCharacteristic,\n\t\tthread_node_capabilities::ThreadNodeCapabilitiesCharacteristic,\n\t\tthread_status::ThreadStatusCharacteristic,\n\t\tcca_energy_detect_threshold::CcaEnergyDetectThresholdCharacteristic,\n\t\tcca_signal_detect_threshold::CcaSignalDetectThresholdCharacteristic,\n\t\tevent_retransmission_maximum::EventRetransmissionMaximumCharacteristic,\n\t\tevent_transmission_counters::EventTransmissionCountersCharacteristic,\n\t\tmac_retransmission_maximum::MacRetransmissionMaximumCharacteristic,\n\t\tmac_transmission_counters::MacTransmissionCountersCharacteristic,\n\t\treceiver_sensitivity::ReceiverSensitivityCharacteristic,\n\t\treceived_signal_strength_indication::ReceivedSignalStrengthIndicationCharacteristic,\n\t\tsignal_to_noise_ratio::SignalToNoiseRatioCharacteristic,\n\t\tthread_openthread_version::ThreadOpenthreadVersionCharacteristic,\n\t\ttransmit_power::TransmitPowerCharacteristic,\n\t\tmaximum_transmit_power::MaximumTransmitPowerCharacteristic,\n\t},\n    HapType,\n};\n\n/// Thread Transport service.\n#[derive(Debug, Default)]\npub struct ThreadTransportService {\n    /// Instance ID of the Thread Transport service.\n    id: u64,\n    /// [`HapType`](HapType) of the Thread Transport service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Current Transport characteristic (required).\n\tpub current_transport: CurrentTransportCharacteristic,\n\t/// Thread Control Point characteristic (required).\n\tpub thread_control_point: ThreadControlPointCharacteristic,\n\t/// Thread Node Capabilities characteristic (required).\n\tpub thread_node_capabilities: ThreadNodeCapabilitiesCharacteristic,\n\t/// Thread Status characteristic (required).\n\tpub thread_status: ThreadStatusCharacteristic,\n\n\t/// CCA Energy Detect Threshold characteristic (optional).\n\tpub cca_energy_detect_threshold: Option<CcaEnergyDetectThresholdCharacteristic>,\n\t/// CCA Signal Detect Threshold characteristic (optional).\n\tpub cca_signal_detect_threshold: Option<CcaSignalDetectThresholdCharacteristic>,\n\t/// Event Retransmission Maximum characteristic (optional).\n\tpub event_retransmission_maximum: Option<EventRetransmissionMaximumCharacteristic>,\n\t/// Event Transmission Counters characteristic (optional).\n\tpub event_transmission_counters: Option<EventTransmissionCountersCharacteristic>,\n\t/// MAC Retransmission Maximum characteristic (optional).\n\tpub mac_retransmission_maximum: Option<MacRetransmissionMaximumCharacteristic>,\n\t/// MAC Transmission Counters characteristic (optional).\n\tpub mac_transmission_counters: Option<MacTransmissionCountersCharacteristic>,\n\t/// Receiver Sensitivity characteristic (optional).\n\tpub receiver_sensitivity: Option<ReceiverSensitivityCharacteristic>,\n\t/// Received Signal Strength Indication characteristic (optional).\n\tpub received_signal_strength_indication: Option<ReceivedSignalStrengthIndicationCharacteristic>,\n\t/// Signal-to-noise Ratio characteristic (optional).\n\tpub signal_to_noise_ratio: Option<SignalToNoiseRatioCharacteristic>,\n\t/// Thread OpenThread Version characteristic (optional).\n\tpub thread_openthread_version: Option<ThreadOpenthreadVersionCharacteristic>,\n\t/// Transmit Power characteristic (optional).\n\tpub transmit_power: Option<TransmitPowerCharacteristic>,\n\t/// Maximum Transmit Power characteristic (optional).\n\tpub maximum_transmit_power: Option<MaximumTransmitPowerCharacteristic>,\n}\n\nimpl ThreadTransportService {\n    /// Creates a new Thread Transport service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::ThreadTransport,\n\t\t\tcurrent_transport: CurrentTransportCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tthread_control_point: ThreadControlPointCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tthread_node_capabilities: ThreadNodeCapabilitiesCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\tthread_status: ThreadStatusCharacteristic::new(id + 1 + 3, accessory_id),\n\t\t\tcca_energy_detect_threshold: Some(CcaEnergyDetectThresholdCharacteristic::new(id + 1 + 0 + 4, accessory_id)),\n\t\t\tcca_signal_detect_threshold: Some(CcaSignalDetectThresholdCharacteristic::new(id + 1 + 1 + 4, accessory_id)),\n\t\t\tevent_retransmission_maximum: Some(EventRetransmissionMaximumCharacteristic::new(id + 1 + 2 + 4, accessory_id)),\n\t\t\tevent_transmission_counters: Some(EventTransmissionCountersCharacteristic::new(id + 1 + 3 + 4, accessory_id)),\n\t\t\tmac_retransmission_maximum: Some(MacRetransmissionMaximumCharacteristic::new(id + 1 + 4 + 4, accessory_id)),\n\t\t\tmac_transmission_counters: Some(MacTransmissionCountersCharacteristic::new(id + 1 + 5 + 4, accessory_id)),\n\t\t\treceiver_sensitivity: Some(ReceiverSensitivityCharacteristic::new(id + 1 + 6 + 4, accessory_id)),\n\t\t\treceived_signal_strength_indication: Some(ReceivedSignalStrengthIndicationCharacteristic::new(id + 1 + 7 + 4, accessory_id)),\n\t\t\tsignal_to_noise_ratio: Some(SignalToNoiseRatioCharacteristic::new(id + 1 + 8 + 4, accessory_id)),\n\t\t\tthread_openthread_version: Some(ThreadOpenthreadVersionCharacteristic::new(id + 1 + 9 + 4, accessory_id)),\n\t\t\ttransmit_power: Some(TransmitPowerCharacteristic::new(id + 1 + 10 + 4, accessory_id)),\n\t\t\tmaximum_transmit_power: Some(MaximumTransmitPowerCharacteristic::new(id + 1 + 11 + 4, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for ThreadTransportService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.current_transport,\n\t\t\t&self.thread_control_point,\n\t\t\t&self.thread_node_capabilities,\n\t\t\t&self.thread_status,\n\t\t];\n\t\tif let Some(c) = &self.cca_energy_detect_threshold {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.cca_signal_detect_threshold {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.event_retransmission_maximum {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.event_transmission_counters {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.mac_retransmission_maximum {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.mac_transmission_counters {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.receiver_sensitivity {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.received_signal_strength_indication {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.signal_to_noise_ratio {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.thread_openthread_version {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.transmit_power {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.maximum_transmit_power {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.current_transport,\n\t\t\t&mut self.thread_control_point,\n\t\t\t&mut self.thread_node_capabilities,\n\t\t\t&mut self.thread_status,\n\t\t];\n\t\tif let Some(c) = &mut self.cca_energy_detect_threshold {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.cca_signal_detect_threshold {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.event_retransmission_maximum {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.event_transmission_counters {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.mac_retransmission_maximum {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.mac_transmission_counters {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.receiver_sensitivity {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.received_signal_strength_indication {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.signal_to_noise_ratio {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.thread_openthread_version {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.transmit_power {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.maximum_transmit_power {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for ThreadTransportService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/transfer_transport_management.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tsupported_transfer_transport_configuration::SupportedTransferTransportConfigurationCharacteristic,\n\t\tsetup_transfer_transport::SetupTransferTransportCharacteristic,\n\t},\n    HapType,\n};\n\n/// Transfer Transport Management service.\n#[derive(Debug, Default)]\npub struct TransferTransportManagementService {\n    /// Instance ID of the Transfer Transport Management service.\n    id: u64,\n    /// [`HapType`](HapType) of the Transfer Transport Management service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Supported Transfer Transport Configuration characteristic (required).\n\tpub supported_transfer_transport_configuration: SupportedTransferTransportConfigurationCharacteristic,\n\t/// Setup Transfer Transport characteristic (required).\n\tpub setup_transfer_transport: SetupTransferTransportCharacteristic,\n\n}\n\nimpl TransferTransportManagementService {\n    /// Creates a new Transfer Transport Management service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::TransferTransportManagement,\n\t\t\tsupported_transfer_transport_configuration: SupportedTransferTransportConfigurationCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tsetup_transfer_transport: SetupTransferTransportCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for TransferTransportManagementService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.supported_transfer_transport_configuration,\n\t\t\t&self.setup_transfer_transport,\n\t\t];\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.supported_transfer_transport_configuration,\n\t\t\t&mut self.setup_transfer_transport,\n\t\t];\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for TransferTransportManagementService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/valve.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tactive::ActiveCharacteristic,\n\t\tin_use::InUseCharacteristic,\n\t\tvalve_type::ValveTypeCharacteristic,\n\t\tis_configured::IsConfiguredCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tremaining_duration::RemainingDurationCharacteristic,\n\t\tlabel_index::LabelIndexCharacteristic,\n\t\tset_duration::SetDurationCharacteristic,\n\t\tstatus_fault::StatusFaultCharacteristic,\n\t},\n    HapType,\n};\n\n/// Valve service.\n#[derive(Debug, Default)]\npub struct ValveService {\n    /// Instance ID of the Valve service.\n    id: u64,\n    /// [`HapType`](HapType) of the Valve service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Active characteristic (required).\n\tpub active: ActiveCharacteristic,\n\t/// In Use characteristic (required).\n\tpub in_use: InUseCharacteristic,\n\t/// Valve Type characteristic (required).\n\tpub valve_type: ValveTypeCharacteristic,\n\n\t/// Is Configured characteristic (optional).\n\tpub is_configured: Option<IsConfiguredCharacteristic>,\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Remaining Duration characteristic (optional).\n\tpub remaining_duration: Option<RemainingDurationCharacteristic>,\n\t/// Label Index characteristic (optional).\n\tpub label_index: Option<LabelIndexCharacteristic>,\n\t/// Set Duration characteristic (optional).\n\tpub set_duration: Option<SetDurationCharacteristic>,\n\t/// Status Fault characteristic (optional).\n\tpub status_fault: Option<StatusFaultCharacteristic>,\n}\n\nimpl ValveService {\n    /// Creates a new Valve service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Valve,\n\t\t\tactive: ActiveCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tin_use: InUseCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tvalve_type: ValveTypeCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\tis_configured: Some(IsConfiguredCharacteristic::new(id + 1 + 0 + 3, accessory_id)),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 1 + 3, accessory_id)),\n\t\t\tremaining_duration: Some(RemainingDurationCharacteristic::new(id + 1 + 2 + 3, accessory_id)),\n\t\t\tlabel_index: Some(LabelIndexCharacteristic::new(id + 1 + 3 + 3, accessory_id)),\n\t\t\tset_duration: Some(SetDurationCharacteristic::new(id + 1 + 4 + 3, accessory_id)),\n\t\t\tstatus_fault: Some(StatusFaultCharacteristic::new(id + 1 + 5 + 3, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for ValveService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.active,\n\t\t\t&self.in_use,\n\t\t\t&self.valve_type,\n\t\t];\n\t\tif let Some(c) = &self.is_configured {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.remaining_duration {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.label_index {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.set_duration {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.active,\n\t\t\t&mut self.in_use,\n\t\t\t&mut self.valve_type,\n\t\t];\n\t\tif let Some(c) = &mut self.is_configured {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.remaining_duration {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.label_index {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.set_duration {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.status_fault {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for ValveService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/wi_fi_router.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tconfigured_name::ConfiguredNameCharacteristic,\n\t\tmanaged_network_enable::ManagedNetworkEnableCharacteristic,\n\t\tnetwork_access_violation_control::NetworkAccessViolationControlCharacteristic,\n\t\tnetwork_client_control::NetworkClientControlCharacteristic,\n\t\tnetwork_client_status_control::NetworkClientStatusControlCharacteristic,\n\t\trouter_status::RouterStatusCharacteristic,\n\t\tsupported_router_configuration::SupportedRouterConfigurationCharacteristic,\n\t\twan_configuration_list::WanConfigurationListCharacteristic,\n\t\twan_status_list::WanStatusListCharacteristic,\n\t},\n    HapType,\n};\n\n/// Wi-Fi Router service.\n#[derive(Debug, Default)]\npub struct WiFiRouterService {\n    /// Instance ID of the Wi-Fi Router service.\n    id: u64,\n    /// [`HapType`](HapType) of the Wi-Fi Router service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Configured Name characteristic (required).\n\tpub configured_name: ConfiguredNameCharacteristic,\n\t/// Managed Network Enable characteristic (required).\n\tpub managed_network_enable: ManagedNetworkEnableCharacteristic,\n\t/// Network Access Violation Control characteristic (required).\n\tpub network_access_violation_control: NetworkAccessViolationControlCharacteristic,\n\t/// Network Client Control characteristic (required).\n\tpub network_client_control: NetworkClientControlCharacteristic,\n\t/// Network Client Status Control characteristic (required).\n\tpub network_client_status_control: NetworkClientStatusControlCharacteristic,\n\t/// Router Status characteristic (required).\n\tpub router_status: RouterStatusCharacteristic,\n\t/// Supported Router Configuration characteristic (required).\n\tpub supported_router_configuration: SupportedRouterConfigurationCharacteristic,\n\t/// WAN Configuration List characteristic (required).\n\tpub wan_configuration_list: WanConfigurationListCharacteristic,\n\t/// WAN Status List characteristic (required).\n\tpub wan_status_list: WanStatusListCharacteristic,\n\n}\n\nimpl WiFiRouterService {\n    /// Creates a new Wi-Fi Router service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::WiFiRouter,\n\t\t\tconfigured_name: ConfiguredNameCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tmanaged_network_enable: ManagedNetworkEnableCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\tnetwork_access_violation_control: NetworkAccessViolationControlCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\tnetwork_client_control: NetworkClientControlCharacteristic::new(id + 1 + 3, accessory_id),\n\t\t\tnetwork_client_status_control: NetworkClientStatusControlCharacteristic::new(id + 1 + 4, accessory_id),\n\t\t\trouter_status: RouterStatusCharacteristic::new(id + 1 + 5, accessory_id),\n\t\t\tsupported_router_configuration: SupportedRouterConfigurationCharacteristic::new(id + 1 + 6, accessory_id),\n\t\t\twan_configuration_list: WanConfigurationListCharacteristic::new(id + 1 + 7, accessory_id),\n\t\t\twan_status_list: WanStatusListCharacteristic::new(id + 1 + 8, accessory_id),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for WiFiRouterService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.configured_name,\n\t\t\t&self.managed_network_enable,\n\t\t\t&self.network_access_violation_control,\n\t\t\t&self.network_client_control,\n\t\t\t&self.network_client_status_control,\n\t\t\t&self.router_status,\n\t\t\t&self.supported_router_configuration,\n\t\t\t&self.wan_configuration_list,\n\t\t\t&self.wan_status_list,\n\t\t];\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.configured_name,\n\t\t\t&mut self.managed_network_enable,\n\t\t\t&mut self.network_access_violation_control,\n\t\t\t&mut self.network_client_control,\n\t\t\t&mut self.network_client_status_control,\n\t\t\t&mut self.router_status,\n\t\t\t&mut self.supported_router_configuration,\n\t\t\t&mut self.wan_configuration_list,\n\t\t\t&mut self.wan_status_list,\n\t\t];\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for WiFiRouterService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/wi_fi_satellite.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\twi_fi_satellite_status::WiFiSatelliteStatusCharacteristic,\n\t},\n    HapType,\n};\n\n/// Wi-Fi Satellite service.\n#[derive(Debug, Default)]\npub struct WiFiSatelliteService {\n    /// Instance ID of the Wi-Fi Satellite service.\n    id: u64,\n    /// [`HapType`](HapType) of the Wi-Fi Satellite service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Wi-Fi Satellite Status characteristic (required).\n\tpub wi_fi_satellite_status: WiFiSatelliteStatusCharacteristic,\n\n}\n\nimpl WiFiSatelliteService {\n    /// Creates a new Wi-Fi Satellite service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::WiFiSatellite,\n\t\t\twi_fi_satellite_status: WiFiSatelliteStatusCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for WiFiSatelliteService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.wi_fi_satellite_status,\n\t\t];\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.wi_fi_satellite_status,\n\t\t];\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for WiFiSatelliteService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/wi_fi_transport.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tcurrent_transport::CurrentTransportCharacteristic,\n\t\twi_fi_capabilities::WiFiCapabilitiesCharacteristic,\n\t\twi_fi_configuration_control::WiFiConfigurationControlCharacteristic,\n\t},\n    HapType,\n};\n\n/// Wi-Fi Transport service.\n#[derive(Debug, Default)]\npub struct WiFiTransportService {\n    /// Instance ID of the Wi-Fi Transport service.\n    id: u64,\n    /// [`HapType`](HapType) of the Wi-Fi Transport service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Current Transport characteristic (required).\n\tpub current_transport: CurrentTransportCharacteristic,\n\t/// Wi-Fi Capabilities characteristic (required).\n\tpub wi_fi_capabilities: WiFiCapabilitiesCharacteristic,\n\n\t/// Wi-Fi Configuration Control characteristic (optional).\n\tpub wi_fi_configuration_control: Option<WiFiConfigurationControlCharacteristic>,\n}\n\nimpl WiFiTransportService {\n    /// Creates a new Wi-Fi Transport service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::WiFiTransport,\n\t\t\tcurrent_transport: CurrentTransportCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\twi_fi_capabilities: WiFiCapabilitiesCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\twi_fi_configuration_control: Some(WiFiConfigurationControlCharacteristic::new(id + 1 + 0 + 2, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for WiFiTransportService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.current_transport,\n\t\t\t&self.wi_fi_capabilities,\n\t\t];\n\t\tif let Some(c) = &self.wi_fi_configuration_control {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.current_transport,\n\t\t\t&mut self.wi_fi_capabilities,\n\t\t];\n\t\tif let Some(c) = &mut self.wi_fi_configuration_control {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for WiFiTransportService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/window.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tcurrent_position::CurrentPositionCharacteristic,\n\t\tposition_state::PositionStateCharacteristic,\n\t\ttarget_position::TargetPositionCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tobstruction_detected::ObstructionDetectedCharacteristic,\n\t\thold_position::HoldPositionCharacteristic,\n\t},\n    HapType,\n};\n\n/// Window service.\n#[derive(Debug, Default)]\npub struct WindowService {\n    /// Instance ID of the Window service.\n    id: u64,\n    /// [`HapType`](HapType) of the Window service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Current Position characteristic (required).\n\tpub current_position: CurrentPositionCharacteristic,\n\t/// Position State characteristic (required).\n\tpub position_state: PositionStateCharacteristic,\n\t/// Target Position characteristic (required).\n\tpub target_position: TargetPositionCharacteristic,\n\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Obstruction Detected characteristic (optional).\n\tpub obstruction_detected: Option<ObstructionDetectedCharacteristic>,\n\t/// Hold Position characteristic (optional).\n\tpub hold_position: Option<HoldPositionCharacteristic>,\n}\n\nimpl WindowService {\n    /// Creates a new Window service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::Window,\n\t\t\tcurrent_position: CurrentPositionCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tposition_state: PositionStateCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\ttarget_position: TargetPositionCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 0 + 3, accessory_id)),\n\t\t\tobstruction_detected: Some(ObstructionDetectedCharacteristic::new(id + 1 + 1 + 3, accessory_id)),\n\t\t\thold_position: Some(HoldPositionCharacteristic::new(id + 1 + 2 + 3, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for WindowService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.current_position,\n\t\t\t&self.position_state,\n\t\t\t&self.target_position,\n\t\t];\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.obstruction_detected {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.hold_position {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.current_position,\n\t\t\t&mut self.position_state,\n\t\t\t&mut self.target_position,\n\t\t];\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.obstruction_detected {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.hold_position {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for WindowService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/generated/window_covering.rs",
    "content": "// this file is auto-generated by hap-codegen\n\nuse serde::ser::{Serialize, SerializeStruct, Serializer};\n\nuse crate::{\n    service::HapService,\n    characteristic::{\n        HapCharacteristic,\n\t\tcurrent_position::CurrentPositionCharacteristic,\n\t\tposition_state::PositionStateCharacteristic,\n\t\ttarget_position::TargetPositionCharacteristic,\n\t\tcurrent_horizontal_tilt_angle::CurrentHorizontalTiltAngleCharacteristic,\n\t\ttarget_horizontal_tilt_angle::TargetHorizontalTiltAngleCharacteristic,\n\t\tname::NameCharacteristic,\n\t\tobstruction_detected::ObstructionDetectedCharacteristic,\n\t\thold_position::HoldPositionCharacteristic,\n\t\tcurrent_vertical_tilt_angle::CurrentVerticalTiltAngleCharacteristic,\n\t\ttarget_vertical_tilt_angle::TargetVerticalTiltAngleCharacteristic,\n\t},\n    HapType,\n};\n\n/// Window Covering service.\n#[derive(Debug, Default)]\npub struct WindowCoveringService {\n    /// Instance ID of the Window Covering service.\n    id: u64,\n    /// [`HapType`](HapType) of the Window Covering service.\n    hap_type: HapType,\n    /// When set to true, this service is not visible to user.\n    hidden: bool,\n    /// When set to true, this is the primary service on the accessory.\n    primary: bool,\n    /// An array of numbers containing the instance IDs of the services that this service links to.\n    linked_services: Vec<u64>,\n\n\t/// Current Position characteristic (required).\n\tpub current_position: CurrentPositionCharacteristic,\n\t/// Position State characteristic (required).\n\tpub position_state: PositionStateCharacteristic,\n\t/// Target Position characteristic (required).\n\tpub target_position: TargetPositionCharacteristic,\n\n\t/// Current Horizontal Tilt Angle characteristic (optional).\n\tpub current_horizontal_tilt_angle: Option<CurrentHorizontalTiltAngleCharacteristic>,\n\t/// Target Horizontal Tilt Angle characteristic (optional).\n\tpub target_horizontal_tilt_angle: Option<TargetHorizontalTiltAngleCharacteristic>,\n\t/// Name characteristic (optional).\n\tpub name: Option<NameCharacteristic>,\n\t/// Obstruction Detected characteristic (optional).\n\tpub obstruction_detected: Option<ObstructionDetectedCharacteristic>,\n\t/// Hold Position characteristic (optional).\n\tpub hold_position: Option<HoldPositionCharacteristic>,\n\t/// Current Vertical Tilt Angle characteristic (optional).\n\tpub current_vertical_tilt_angle: Option<CurrentVerticalTiltAngleCharacteristic>,\n\t/// Target Vertical Tilt Angle characteristic (optional).\n\tpub target_vertical_tilt_angle: Option<TargetVerticalTiltAngleCharacteristic>,\n}\n\nimpl WindowCoveringService {\n    /// Creates a new Window Covering service.\n    pub fn new(id: u64, accessory_id: u64) -> Self {\n        Self {\n            id,\n            hap_type: HapType::WindowCovering,\n\t\t\tcurrent_position: CurrentPositionCharacteristic::new(id + 1 + 0, accessory_id),\n\t\t\tposition_state: PositionStateCharacteristic::new(id + 1 + 1, accessory_id),\n\t\t\ttarget_position: TargetPositionCharacteristic::new(id + 1 + 2, accessory_id),\n\t\t\tcurrent_horizontal_tilt_angle: Some(CurrentHorizontalTiltAngleCharacteristic::new(id + 1 + 0 + 3, accessory_id)),\n\t\t\ttarget_horizontal_tilt_angle: Some(TargetHorizontalTiltAngleCharacteristic::new(id + 1 + 1 + 3, accessory_id)),\n\t\t\tname: Some(NameCharacteristic::new(id + 1 + 2 + 3, accessory_id)),\n\t\t\tobstruction_detected: Some(ObstructionDetectedCharacteristic::new(id + 1 + 3 + 3, accessory_id)),\n\t\t\thold_position: Some(HoldPositionCharacteristic::new(id + 1 + 4 + 3, accessory_id)),\n\t\t\tcurrent_vertical_tilt_angle: Some(CurrentVerticalTiltAngleCharacteristic::new(id + 1 + 5 + 3, accessory_id)),\n\t\t\ttarget_vertical_tilt_angle: Some(TargetVerticalTiltAngleCharacteristic::new(id + 1 + 6 + 3, accessory_id)),\n\t\t\t..Default::default()\n        }\n    }\n}\n\nimpl HapService for WindowCoveringService {\n    fn get_id(&self) -> u64 {\n        self.id\n    }\n\n    fn set_id(&mut self, id: u64) {\n        self.id = id;\n    }\n\n    fn get_type(&self) -> HapType {\n        self.hap_type\n    }\n\n    fn set_type(&mut self, hap_type: HapType) {\n        self.hap_type = hap_type;\n    }\n\n    fn get_hidden(&self) -> bool {\n        self.hidden\n    }\n\n    fn set_hidden(&mut self, hidden: bool) {\n        self.hidden = hidden;\n    }\n\n    fn get_primary(&self) -> bool {\n        self.primary\n    }\n\n    fn set_primary(&mut self, primary: bool) {\n        self.primary = primary;\n    }\n\n    fn get_linked_services(&self) -> Vec<u64> {\n        self.linked_services.clone()\n    }\n\n    fn set_linked_services(&mut self, linked_services: Vec<u64>) {\n        self.linked_services = linked_services;\n    }\n\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic> {\n        for characteristic in self.get_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic> {\n        for characteristic in self.get_mut_characteristics() {\n            if characteristic.get_type() == hap_type {\n                return Some(characteristic);\n            }\n        }\n        None\n    }\n\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&dyn HapCharacteristic> = vec![\n\t\t\t&self.current_position,\n\t\t\t&self.position_state,\n\t\t\t&self.target_position,\n\t\t];\n\t\tif let Some(c) = &self.current_horizontal_tilt_angle {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.target_horizontal_tilt_angle {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.obstruction_detected {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.hold_position {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.current_vertical_tilt_angle {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &self.target_vertical_tilt_angle {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic> {\n        #[allow(unused_mut)]\n        let mut characteristics: Vec<&mut dyn HapCharacteristic> = vec![\n\t\t\t&mut self.current_position,\n\t\t\t&mut self.position_state,\n\t\t\t&mut self.target_position,\n\t\t];\n\t\tif let Some(c) = &mut self.current_horizontal_tilt_angle {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.target_horizontal_tilt_angle {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.name {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.obstruction_detected {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.hold_position {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.current_vertical_tilt_angle {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tif let Some(c) = &mut self.target_vertical_tilt_angle {\n\t\t    characteristics.push(c);\n\t\t}\n\t\tcharacteristics\n    }\n}\n\nimpl Serialize for WindowCoveringService {\n    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {\n        let mut state = serializer.serialize_struct(\"HapService\", 5)?;\n        state.serialize_field(\"iid\", &self.get_id())?;\n        state.serialize_field(\"type\", &self.get_type())?;\n        state.serialize_field(\"hidden\", &self.get_hidden())?;\n        state.serialize_field(\"primary\", &self.get_primary())?;\n        state.serialize_field(\"characteristics\", &self.get_characteristics())?;\n        // linked services left out for now\n        state.end()\n    }\n}\n"
  },
  {
    "path": "src/service/mod.rs",
    "content": "use erased_serde::serialize_trait_object;\n\nuse crate::{characteristic::HapCharacteristic, HapType};\n\nmod generated;\n\npub use crate::service::generated::*;\n\n/// [`HapService`](HapService) is implemented by every HAP service.\npub trait HapService: erased_serde::Serialize + Send + Sync {\n    /// Returns the ID of the service.\n    fn get_id(&self) -> u64;\n    /// Sets the ID of the service.\n    fn set_id(&mut self, id: u64);\n    /// Returns the [`HapType`](HapType) of the service.\n    fn get_type(&self) -> HapType;\n    /// Sets the [`HapType`](HapType) of the service.\n    fn set_type(&mut self, hap_type: HapType);\n    /// Returns the `hidden` value of the service.\n    fn get_hidden(&self) -> bool;\n    /// Sets the `hidden` value of the service.\n    fn set_hidden(&mut self, hidden: bool);\n    /// Returns the `primary` value of the service.\n    fn get_primary(&self) -> bool;\n    /// Sets the `primary` value of the service.\n    fn set_primary(&mut self, primary: bool);\n    /// Returns the `linked_services` value of the service.\n    fn get_linked_services(&self) -> Vec<u64>;\n    /// Sets the `linked_services` value of the service.\n    fn set_linked_services(&mut self, linked_services: Vec<u64>);\n    /// Returns a reference to a specific characteristic of the service if it's present on it.\n    fn get_characteristic(&self, hap_type: HapType) -> Option<&dyn HapCharacteristic>;\n    /// Returns a mutable reference to a specific characteristic of the service if it's present on it.\n    fn get_mut_characteristic(&mut self, hap_type: HapType) -> Option<&mut dyn HapCharacteristic>;\n    /// Returns references to all characteristics of the service.\n    fn get_characteristics(&self) -> Vec<&dyn HapCharacteristic>;\n    /// Returns mutable references to all characteristics of the service.\n    fn get_mut_characteristics(&mut self) -> Vec<&mut dyn HapCharacteristic>;\n}\n\nserialize_trait_object!(HapService);\n"
  },
  {
    "path": "src/storage/accessory_database.rs",
    "content": "use std::sync::Arc;\n\nuse futures::lock::Mutex;\nuse log::debug;\nuse serde_json::json;\n\nuse crate::{\n    accessory::HapAccessory,\n    characteristic::Perm,\n    pointer,\n    transport::http::{ReadResponseObject, Status, WriteObject, WriteResponseObject},\n    Error,\n    Result,\n};\n\n/// `AccessoryDatabase` is a wrapper type holding a list of accessories.\npub struct AccessoryDatabase {\n    pub accessories: Vec<pointer::Accessory>,\n    event_emitter: pointer::EventEmitter,\n}\n\nimpl AccessoryDatabase {\n    /// Creates a new `AccessoryDatabase`.\n    pub fn new(event_emitter: pointer::EventEmitter) -> AccessoryDatabase {\n        AccessoryDatabase {\n            accessories: Vec::new(),\n            event_emitter,\n        }\n    }\n\n    /// Adds an accessory to the `AccessoryDatabase` and returns a pointer to the added accessory.\n    pub fn add_accessory(&mut self, accessory: Box<dyn HapAccessory>) -> Result<pointer::Accessory> {\n        let mut accessory = accessory;\n        accessory.set_event_emitter_on_characteristics(Some(self.event_emitter.clone()));\n\n        let accessory = Arc::new(Mutex::new(accessory));\n        self.accessories.push(accessory.clone());\n        // TODO: some error handling here?\n\n        Ok(accessory)\n    }\n\n    /// Takes a pointer to an accessory and removes the accessory from the `AccessoryDatabase`.\n    pub async fn remove_accessory(&mut self, accessory: &pointer::Accessory) -> Result<()> {\n        let accessory = accessory.lock().await;\n        let mut remove = None;\n\n        for (i, a) in self.accessories.iter_mut().enumerate() {\n            if a.lock().await.get_id() == accessory.get_id() {\n                a.lock().await.set_event_emitter_on_characteristics(None);\n\n                remove = Some(i);\n                break;\n            }\n        }\n\n        if let Some(i) = remove {\n            self.accessories.remove(i);\n\n            return Ok(());\n        }\n\n        Err(Error::AccessoryNotFound)\n    }\n\n    /// Reads the value of a characteristic.\n    pub(crate) async fn read_characteristic(\n        &self,\n        aid: u64,\n        iid: u64,\n        meta: bool,\n        perms: bool,\n        hap_type: bool,\n        ev: bool,\n    ) -> Result<ReadResponseObject> {\n        let mut result_object = ReadResponseObject {\n            iid,\n            aid,\n            hap_type: None,\n            format: None,\n            perms: None,\n            ev: None,\n            value: None,\n            unit: None,\n            max_value: None,\n            min_value: None,\n            step_value: None,\n            max_len: None,\n            status: Some(0),\n        };\n\n        'l: for accessory in self.accessories.iter() {\n            let mut a = accessory.lock().await;\n            if a.get_id() == aid {\n                for service in a.get_mut_services() {\n                    for characteristic in service.get_mut_characteristics() {\n                        if characteristic.get_id() == iid {\n                            let characteristic_perms = characteristic.get_perms();\n                            if characteristic_perms.contains(&Perm::PairedRead) {\n                                result_object.value = Some(characteristic.get_value().await?);\n                                if meta {\n                                    result_object.format = Some(characteristic.get_format());\n                                    result_object.unit = characteristic.get_unit();\n                                    result_object.max_value = characteristic.get_max_value();\n                                    result_object.min_value = characteristic.get_min_value();\n                                    result_object.step_value = characteristic.get_step_value();\n                                    result_object.max_len = characteristic.get_max_len();\n                                }\n                                if perms {\n                                    result_object.perms = Some(characteristic_perms);\n                                }\n                                if hap_type {\n                                    result_object.hap_type = Some(characteristic.get_type());\n                                }\n                                if ev {\n                                    result_object.ev = characteristic.get_event_notifications();\n                                }\n                            } else {\n                                result_object.status = Some(Status::WriteOnlyCharacteristic as i32);\n                            }\n                            break 'l;\n                        }\n                    }\n                }\n            }\n        }\n\n        Ok(result_object)\n    }\n\n    /// Writes the value of a characteristic.\n    pub(crate) async fn write_characteristic(\n        &mut self,\n        write_object: WriteObject,\n        event_subscriptions: &pointer::EventSubscriptions,\n    ) -> Result<WriteResponseObject> {\n        let mut result_object = WriteResponseObject {\n            aid: write_object.aid,\n            iid: write_object.iid,\n            status: 0,\n        };\n\n        'l: for accessory in self.accessories.iter_mut() {\n            let mut a = accessory.lock().await;\n            if a.get_id() == write_object.aid {\n                for service in a.get_mut_services() {\n                    for characteristic in service.get_mut_characteristics() {\n                        if characteristic.get_id() == write_object.iid {\n                            let characteristic_perms = characteristic.get_perms();\n                            if let Some(ev) = write_object.ev {\n                                if characteristic_perms.contains(&Perm::Events) {\n                                    characteristic.set_event_notifications(Some(ev));\n                                    let subscription = (write_object.aid, write_object.iid);\n                                    let mut es = event_subscriptions.lock().await;\n                                    let pos = es.iter().position(|&s| s == subscription);\n                                    match (ev, pos) {\n                                        (true, None) => {\n                                            es.push(subscription);\n                                        },\n                                        (false, Some(p)) => {\n                                            es.remove(p);\n                                        },\n                                        _ => {},\n                                    }\n                                } else {\n                                    result_object.status = Status::NotificationNotSupported as i32;\n                                }\n                            }\n                            if let Some(value) = write_object.value {\n                                if characteristic_perms.contains(&Perm::PairedWrite) {\n                                    characteristic.set_value(value).await?;\n                                } else {\n                                    result_object.status = Status::ReadOnlyCharacteristic as i32;\n                                }\n                            }\n                            break 'l;\n                        }\n                    }\n                }\n            }\n        }\n\n        Ok(result_object)\n    }\n\n    pub(crate) async fn as_serialized_json(&self) -> Result<Vec<u8>> {\n        let mut accessory_values = Vec::new();\n        for accessory in &self.accessories {\n            let a = accessory.lock().await;\n            accessory_values.push(serde_json::to_value(&*a)?);\n        }\n\n        let json = json!({ \"accessories\": accessory_values });\n\n        debug!(\"accessory list JSON: {}\", &json);\n\n        Ok(serde_json::to_vec(&json)?)\n    }\n}\n\n// #[cfg(test)]\n// mod tests {\n//     use super::*;\n\n//     #[test]\n//     fn test_json_serialization() {} // TODO: test it\n// }\n"
  },
  {
    "path": "src/storage/file_storage.rs",
    "content": "use async_trait::async_trait;\nuse log::debug;\nuse std::{\n    env,\n    ffi::OsStr,\n    fs,\n    io::{BufReader, BufWriter, Read, Write},\n    path::{Path, PathBuf},\n    str,\n};\nuse tokio::task::spawn_blocking;\nuse uuid::Uuid;\n\nuse crate::{pairing::Pairing, storage::Storage, Config, Error, Result};\n\n/// [`FileStorage`](FileStorage) is an implementor of the [`Storage`](Storage) trait that stores data to the file\n/// system.\n#[derive(Debug)]\npub struct FileStorage {\n    dir_path: PathBuf,\n}\n\nimpl FileStorage {\n    /// Creates a new [`FileStorage`](FileStorage).\n    pub async fn new<D: AsRef<OsStr> + ?Sized>(dir: &D) -> Result<Self> {\n        let dir_path = Path::new(dir).to_path_buf();\n        let dir_path = spawn_blocking(move || -> Result<PathBuf> {\n            fs::create_dir_all(&dir_path)?;\n\n            let dir_path_str = dir_path.to_str().expect(\"couldn't stringify current_dir\");\n            // create subdirectory for pairings\n            fs::create_dir_all(&format!(\"{}/pairings\", dir_path_str))?;\n            // create subdirectory for custom byte storage\n            fs::create_dir_all(&format!(\"{}/misc\", dir_path_str))?;\n\n            Ok(dir_path)\n        })\n        .await??;\n\n        Ok(FileStorage { dir_path })\n    }\n\n    /// Creates a new [`FileStorage`](FileStorage) with the current directory as storage path.\n    pub async fn current_dir() -> Result<Self> {\n        let current_dir =\n            spawn_blocking(move || -> Result<PathBuf> { env::current_dir().map_err(Error::from) }).await??;\n        let current_dir = current_dir.to_str().expect(\"couldn't stringify current_dir\");\n        let data_path = format!(\"{}/data\", current_dir);\n\n        Self::new(&data_path).await\n    }\n\n    fn storage_path(&self, fd: &str) -> PathBuf {\n        let mut fd_path = self.dir_path.clone();\n        fd_path.push(fd);\n        fd_path\n    }\n\n    async fn get_reader(&self, file: &str) -> Result<BufReader<fs::File>> {\n        let file_path = self.storage_path(file);\n        let reader = spawn_blocking(move || -> Result<BufReader<fs::File>> {\n            let file = fs::OpenOptions::new().read(true).open(file_path)?;\n            let reader = BufReader::new(file);\n\n            Ok(reader)\n        })\n        .await??;\n\n        Ok(reader)\n    }\n\n    async fn get_writer(&self, file: &str) -> Result<BufWriter<fs::File>> {\n        let file_path = self.storage_path(file);\n        let writer = spawn_blocking(move || -> Result<BufWriter<fs::File>> {\n            let file = fs::OpenOptions::new()\n                .write(true)\n                .create(true)\n                .truncate(true)\n                .open(file_path)?;\n            let writer = BufWriter::new(file);\n\n            Ok(writer)\n        })\n        .await??;\n\n        Ok(writer)\n    }\n\n    async fn read_bytes(&self, key: &str) -> Result<Vec<u8>> {\n        let mut reader = self.get_reader(key).await?;\n        let value = spawn_blocking(move || -> Result<Vec<u8>> {\n            let mut value = Vec::new();\n            reader.read_to_end(&mut value)?;\n\n            Ok(value)\n        })\n        .await??;\n\n        Ok(value)\n    }\n\n    async fn write_bytes(&self, key: &str, value: Vec<u8>) -> Result<()> {\n        let mut writer = self.get_writer(key).await?;\n        spawn_blocking(move || -> Result<()> {\n            writer.write_all(&value)?;\n\n            Ok(())\n        })\n        .await??;\n\n        Ok(())\n    }\n\n    async fn remove_file(&self, key: &str) -> Result<()> {\n        let file_path = self.storage_path(key);\n        spawn_blocking(move || -> Result<()> {\n            fs::remove_file(file_path)?;\n\n            Ok(())\n        })\n        .await??;\n\n        Ok(())\n    }\n\n    async fn list_files(&self, dir: PathBuf) -> Result<Vec<String>> {\n        let file_names = spawn_blocking(move || -> Result<Vec<String>> {\n            let mut file_names = Vec::new();\n            for entry in fs::read_dir(dir)? {\n                let entry = entry?;\n                let path = entry.path();\n                let file_name = path.into_os_string().into_string().or(Err(Error::Storage))?;\n                file_names.push(file_name);\n            }\n\n            Ok(file_names)\n        })\n        .await??;\n\n        Ok(file_names)\n    }\n}\n\n#[async_trait]\nimpl Storage for FileStorage {\n    async fn load_config(&self) -> Result<Config> {\n        let config_bytes = self.read_bytes(\"config.json\").await?;\n        let config = serde_json::from_slice(&config_bytes)?;\n\n        debug!(\"loaded Config: {:?}\", &config);\n\n        Ok(config)\n    }\n\n    async fn save_config(&mut self, config: &Config) -> Result<()> {\n        let config_bytes = serde_json::to_vec(config)?;\n        self.write_bytes(\"config.json\", config_bytes).await\n    }\n\n    async fn delete_config(&mut self) -> Result<()> { self.remove_file(\"config.json\").await }\n\n    async fn load_aid_cache(&self) -> Result<Vec<u64>> {\n        let aid_cache_bytes = self.read_bytes(\"aid_cache.json\").await?;\n        let aid_cache = serde_json::from_slice(&aid_cache_bytes)?;\n\n        debug!(\"loaded AID cache: {:?}\", &aid_cache);\n\n        Ok(aid_cache)\n    }\n\n    async fn save_aid_cache(&mut self, aid_cache: &[u64]) -> Result<()> {\n        let aid_cache_bytes = serde_json::to_vec(aid_cache)?;\n        self.write_bytes(\"aid_cache.json\", aid_cache_bytes).await\n    }\n\n    async fn delete_aid_cache(&mut self) -> Result<()> { self.remove_file(\"aid_cache.json\").await }\n\n    async fn load_pairing(&self, id: &Uuid) -> Result<Pairing> {\n        let key = format!(\"pairings/{}.json\", id.to_string());\n        let pairing_bytes = self.read_bytes(&key).await?;\n\n        let pairing = Pairing::from_bytes(&pairing_bytes)?;\n\n        debug!(\"loaded Pairing: {:?}\", &pairing);\n\n        Ok(pairing)\n    }\n\n    async fn save_pairing(&mut self, pairing: &Pairing) -> Result<()> {\n        let key = format!(\"pairings/{}.json\", pairing.id.to_string());\n        let pairing_bytes = pairing.as_bytes()?;\n        self.write_bytes(&key, pairing_bytes).await\n    }\n\n    async fn delete_pairing(&mut self, id: &Uuid) -> Result<()> {\n        let key = format!(\"pairings/{}.json\", id.to_string());\n        self.remove_file(&key).await\n    }\n\n    async fn list_pairings(&self) -> Result<Vec<Pairing>> {\n        let pairing_dir = self.storage_path(\"pairings\");\n\n        let mut pairings = Vec::new();\n        for key in self.list_files(pairing_dir).await? {\n            let pairing_bytes = self.read_bytes(&key).await?;\n            let pairing = Pairing::from_bytes(&pairing_bytes)?;\n            pairings.push(pairing);\n        }\n\n        Ok(pairings)\n    }\n\n    async fn count_pairings(&self) -> Result<usize> {\n        let pairing_dir = self.storage_path(\"pairings\");\n\n        let count = self.list_files(pairing_dir).await?.len();\n\n        Ok(count)\n    }\n\n    async fn load_bytes(&self, key: &str) -> Result<Vec<u8>> {\n        let bytes = self.read_bytes(&format!(\"misc/{}\", key)).await?;\n\n        Ok(bytes)\n    }\n\n    async fn save_bytes(&mut self, key: &str, value: &[u8]) -> Result<()> {\n        self.write_bytes(&format!(\"misc/{}\", key), value.to_vec()).await\n    }\n\n    async fn delete_bytes(&mut self, key: &str) -> Result<()> { self.remove_file(&format!(\"misc/{}\", key)).await }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    use crate::{pairing::Permissions, BonjourStatusFlag};\n\n    /// Ensure we can write a [`Config`](Config), then a shorter one, without corrupting data.\n    #[tokio::test]\n    async fn test_config_storage() {\n        let mut config = Default::default();\n\n        let mut temp_dir = std::env::temp_dir();\n        temp_dir.push(\"hap\");\n\n        let mut storage = FileStorage::new(&temp_dir).await.unwrap();\n\n        // Config can't derive PartialEq\n        let config_eq = |a: &Config, b: &Config| {\n            assert_eq!(a.host, b.host);\n            assert_eq!(a.port, b.port);\n            assert_eq!(a.pin, b.pin);\n            assert_eq!(a.name, b.name);\n            assert_eq!(a.device_id, b.device_id);\n            assert_eq!(a.configuration_number, b.configuration_number);\n            assert_eq!(a.state_number, b.state_number);\n            assert_eq!(a.category, b.category);\n            assert_eq!(a.protocol_version, b.protocol_version);\n            assert_eq!(a.status_flag, b.status_flag);\n            assert_eq!(a.feature_flag, b.feature_flag);\n            assert_eq!(a.max_peers, b.max_peers);\n        };\n\n        storage.save_config(&config).await.unwrap();\n\n        // config should be correctly saved\n        let saved_config = storage.load_config().await.unwrap();\n        config_eq(&saved_config, &config);\n\n        config.status_flag = BonjourStatusFlag::Zero;\n        storage.save_config(&config).await.unwrap();\n\n        // config should be correctly updated (Config can't derive PartialEq)\n        let saved_config = storage.load_config().await.unwrap();\n        config_eq(&saved_config, &config);\n\n        storage.delete_config().await.unwrap();\n\n        // config should be deleted\n        let saved_config = storage.load_config().await;\n        assert!(saved_config.is_err());\n    }\n\n    #[tokio::test]\n    async fn test_aid_cache_storage() {\n        let mut aid_cache = vec![1, 2, 3, 4];\n\n        let mut temp_dir = std::env::temp_dir();\n        temp_dir.push(\"hap\");\n\n        let mut storage = FileStorage::new(&temp_dir).await.unwrap();\n\n        storage.save_aid_cache(&aid_cache).await.unwrap();\n\n        // aid_cache should be correctly saved\n        let saved_aid_cache = storage.load_aid_cache().await.unwrap();\n        assert_eq!(saved_aid_cache, aid_cache);\n\n        aid_cache.push(5);\n        storage.save_aid_cache(&aid_cache).await.unwrap();\n\n        // aid_cache should be correctly updated\n        let saved_aid_cache = storage.load_aid_cache().await.unwrap();\n        assert_eq!(saved_aid_cache, aid_cache);\n\n        storage.delete_aid_cache().await.unwrap();\n\n        // aid_cache should be deleted\n        let saved_aid_cache = storage.load_aid_cache().await;\n        assert!(saved_aid_cache.is_err());\n    }\n\n    /// Ensure we can correctly create, read, list and delete [`Pairing`](Pairing)s.\n    #[tokio::test]\n    async fn test_pairing_storage() {\n        let pairing = Pairing {\n            id: Uuid::parse_str(\"bc158b86-cabf-432d-aee4-422ef0e3f1d5\").unwrap(),\n            permissions: Permissions::Admin,\n            public_key: [\n                215, 90, 152, 1, 130, 177, 10, 183, 213, 75, 254, 211, 201, 100, 7, 58, 14, 225, 114, 243, 218, 166,\n                35, 37, 175, 2, 26, 104, 247, 7, 81, 26,\n            ],\n        };\n\n        let mut temp_dir = std::env::temp_dir();\n        temp_dir.push(\"hap\");\n\n        let mut storage = FileStorage::new(&temp_dir).await.unwrap();\n\n        // a fresh file storage should count 0 pairings, list an empty Vec, and error on a non-existent ID\n        let pairing_count = storage.count_pairings().await.unwrap();\n        assert_eq!(pairing_count, 0);\n\n        let pairings = storage.list_pairings().await.unwrap();\n        assert_eq!(pairings, vec![]);\n\n        let saved_pairing = storage.load_pairing(&pairing.id).await;\n        assert!(saved_pairing.is_err());\n\n        // save a pairing\n        storage.save_pairing(&pairing).await.unwrap();\n\n        // after saving the first pairing, we should be able to count, load and list it\n        let pairing_count = storage.count_pairings().await.unwrap();\n        assert_eq!(pairing_count, 1);\n\n        let pairings = storage.list_pairings().await.unwrap();\n        assert_eq!(pairings.len(), 1);\n        assert_eq!(&pairings[0], &pairing);\n\n        let saved_pairing = storage.load_pairing(&pairing.id).await.unwrap();\n        assert_eq!(&saved_pairing, &pairing);\n\n        // delete the pairing\n        storage.delete_pairing(&pairing.id).await.unwrap();\n\n        // after deleting the previously saved pairing, it should count 0 again, list an empty\n        // Vec and error on the now non-existent ID of the deleted pairing\n        let pairing_count = storage.count_pairings().await.unwrap();\n        assert_eq!(pairing_count, 0);\n\n        let pairings = storage.list_pairings().await.unwrap();\n        assert_eq!(pairings, vec![]);\n\n        let saved_pairing = storage.load_pairing(&pairing.id).await;\n        assert!(saved_pairing.is_err());\n    }\n\n    #[tokio::test]\n    async fn test_byte_storage() {\n        let mut bytes = vec![1, 2, 3, 4];\n\n        let mut temp_dir = std::env::temp_dir();\n        temp_dir.push(\"hap\");\n\n        let mut storage = FileStorage::new(&temp_dir).await.unwrap();\n\n        storage.save_bytes(\"my_custom_bytes\", &bytes).await.unwrap();\n\n        // bytes should be correctly saved\n        let saved_bytes = storage.load_bytes(\"my_custom_bytes\").await.unwrap();\n        assert_eq!(saved_bytes, bytes);\n\n        bytes.push(5);\n        storage.save_bytes(\"my_custom_bytes\", &bytes).await.unwrap();\n\n        // bytes should be correctly updated\n        let saved_bytes = storage.load_bytes(\"my_custom_bytes\").await.unwrap();\n        assert_eq!(saved_bytes, bytes);\n\n        storage.delete_bytes(\"my_custom_bytes\").await.unwrap();\n\n        // bytes should be deleted\n        let saved_bytes = storage.load_bytes(\"my_custom_bytes\").await;\n        assert!(saved_bytes.is_err());\n    }\n}\n"
  },
  {
    "path": "src/storage/mod.rs",
    "content": "mod file_storage;\nmod storage;\n\npub(crate) mod accessory_database;\n\npub use self::{file_storage::FileStorage, storage::Storage};\n"
  },
  {
    "path": "src/storage/storage.rs",
    "content": "use async_trait::async_trait;\nuse uuid::Uuid;\n\nuse crate::{pairing::Pairing, Config, Result};\n\n/// [`Storage`](Storage) is implemented by the persistent data storage methods HAP supports. Currently, that's just\n/// [`FileStorage`](crate::storage::FileStorage).\n#[async_trait]\npub trait Storage: Send + Sync {\n    /// Loads the [`Config`](Config) from the [`Storage`](Storage).\n    async fn load_config(&self) -> Result<Config>;\n    /// Saves the [`Config`](Config) to the [`Storage`](Storage).\n    async fn save_config(&mut self, config: &Config) -> Result<()>;\n    /// Deletes the [`Config`](Config) from the [`Storage`](Storage).\n    async fn delete_config(&mut self) -> Result<()>;\n    /// Loads the AID cache from the [`Storage`](Storage).\n    async fn load_aid_cache(&self) -> Result<Vec<u64>>;\n    /// Saves the AID cache to the [`Storage`](Storage).\n    async fn save_aid_cache(&mut self, aid_cache: &[u64]) -> Result<()>;\n    /// Deletes the AID cache from the [`Storage`](Storage).\n    async fn delete_aid_cache(&mut self) -> Result<()>;\n    /// Loads a [`Pairing`](Pairing) from the [`Storage`](Storage).\n    async fn load_pairing(&self, id: &Uuid) -> Result<Pairing>;\n    /// Saves a [`Pairing`](Pairing) to the [`Storage`](Storage).\n    async fn save_pairing(&mut self, pairing: &Pairing) -> Result<()>;\n    /// Deletes the [`Pairing`](Pairing) from the [`Storage`](Storage).\n    async fn delete_pairing(&mut self, id: &Uuid) -> Result<()>;\n    /// Loads all [`Pairing`](Pairing)s from the [`Storage`](Storage).\n    async fn list_pairings(&self) -> Result<Vec<Pairing>>;\n    /// Returns the count of [`Pairing`](Pairing)s stored on the [`Storage`](Storage).\n    async fn count_pairings(&self) -> Result<usize>;\n    /// Loads arbitrary bytes from the [`Storage`](Storage).\n    async fn load_bytes(&self, key: &str) -> Result<Vec<u8>>;\n    /// Saves arbitrary bytes to the [`Storage`](Storage).\n    async fn save_bytes(&mut self, key: &str, value: &[u8]) -> Result<()>;\n    /// Deletes a set of arbitrary bytes from the [`Storage`](Storage).\n    async fn delete_bytes(&mut self, key: &str) -> Result<()>;\n}\n"
  },
  {
    "path": "src/tlv.rs",
    "content": "use std::{cell, collections::HashMap, io, str};\n\nuse byteorder::{LittleEndian, WriteBytesExt};\nuse log::error;\nuse srp::types::SrpAuthError;\nuse thiserror::Error;\n\nuse crate::{error, pairing::Permissions};\n\n/// Encodes a `Vec<(u8, Vec<u8>)>` in the format `(<Type>, <Value>)` to a `Vec<u8>` of concatenated TLVs.\npub fn encode(tlvs: Vec<(u8, Vec<u8>)>) -> Vec<u8> {\n    let mut vec: Vec<u8> = Vec::new();\n    for (t, v) in tlvs {\n        let length = v.len();\n        if length <= 255 {\n            vec.push(t);\n            vec.push(length as u8);\n            for byte in v {\n                vec.push(byte);\n            }\n        } else {\n            let mut l = length;\n            let mut p = 0;\n            while l > 255 {\n                vec.push(t);\n                vec.push(255);\n                for byte in &v[p..(p + 255)] {\n                    vec.push(*byte);\n                }\n                l -= 255;\n                p += 255;\n            }\n            if l > 0 {\n                vec.push(t);\n                vec.push(l as u8);\n                for byte in &v[p..(p + l)] {\n                    vec.push(*byte);\n                }\n            }\n        }\n    }\n    vec\n}\n\n/// Decodes a slice of concatenated TLVs to a `HashMap<u8, Vec<u8>>` in the format `<Type, Value>`.\npub fn decode(tlv: &[u8]) -> HashMap<u8, Vec<u8>> {\n    let mut hm = HashMap::new();\n    let mut buf: Vec<u8> = Vec::new();\n    let mut p = 0;\n    let mut pt = 0;\n    while p < tlv.len() {\n        let t = tlv[p];\n        let l = tlv[p + 1];\n        if l < 255 {\n            if t != pt && !buf.is_empty() {\n                hm.insert(t, buf.clone());\n                buf.clear();\n            }\n            buf.extend_from_slice(&tlv[p + 2..p + 2 + l as usize]);\n            hm.insert(t, buf.clone());\n            buf.clear();\n        } else {\n            buf.extend_from_slice(&tlv[p + 2..p + 2 + l as usize]);\n        }\n        pt = t;\n        p = p + 2 + l as usize;\n    }\n    if !buf.is_empty() {\n        hm.insert(pt, buf.clone());\n        buf.clear();\n    }\n    hm\n}\n\n/// `Encodable` is implemented by types that can be encoded to a to a `Vec<u8>` of concatenated\n/// TLVs.\npub trait Encodable {\n    fn encode(self) -> Vec<u8>;\n}\n\n/// `Type` represents the TLV types defined by the protocol.\n#[derive(Debug, Copy, Clone)]\npub enum Type {\n    Method = 0x00,\n    Identifier = 0x01,\n    Salt = 0x02,\n    PublicKey = 0x03,\n    Proof = 0x04,\n    EncryptedData = 0x05,\n    State = 0x06,\n    Error = 0x07,\n    RetryDelay = 0x08,\n    Certificate = 0x09,\n    Signature = 0x0A,\n    Permissions = 0x0B,\n    FragmentData = 0x0C,\n    FragmentLast = 0x0D,\n    /// Pairing Type Flags (32 bit unsigned integer).\n    Flags = 0x13,\n    Separator = 0xFF,\n}\n\n/// The variants of `Value` can hold the corresponding values to the types provided by `Type`.\n#[allow(dead_code)]\n#[derive(Debug, Clone)]\npub enum Value {\n    Method(Method),\n    Identifier(String),\n    Salt([u8; 16]),\n    PublicKey(Vec<u8>),\n    Proof(Vec<u8>),\n    EncryptedData(Vec<u8>),\n    State(u8),\n    Error(Error),\n    RetryDelay(usize),\n    Certificate(Vec<u8>),\n    Signature(Vec<u8>),\n    Permissions(Permissions),\n    FragmentData(Vec<u8>),\n    FragmentLast(Vec<u8>),\n    Flags(u32),\n    Separator,\n}\n\nimpl Value {\n    /// Converts a variant of `Value` to a `(u8, Vec<u8>)` tuple in the format `(Type, Value)`.\n    pub fn as_tlv(self) -> (u8, Vec<u8>) {\n        match self {\n            Value::Method(method) => (Type::Method as u8, vec![method as u8]),\n            Value::Identifier(identifier) => (Type::Identifier as u8, identifier.into_bytes()),\n            Value::Salt(salt) => (Type::Salt as u8, salt.to_vec()),\n            Value::PublicKey(public_key) => (Type::PublicKey as u8, public_key),\n            Value::Proof(proof) => (Type::Proof as u8, proof),\n            Value::EncryptedData(data) => (Type::EncryptedData as u8, data),\n            Value::State(state) => (Type::State as u8, vec![state]),\n            Value::Error(error) => (Type::Error as u8, vec![error as u8]),\n            Value::RetryDelay(delay) => {\n                let val = delay as u16;\n                let mut vec: Vec<u8> = Vec::new();\n                vec.write_u16::<LittleEndian>(val).unwrap();\n                (Type::RetryDelay as u8, vec)\n            },\n            Value::Certificate(certificate) => (Type::Certificate as u8, certificate),\n            Value::Signature(signature) => (Type::Signature as u8, signature),\n            Value::Permissions(permissions) => (Type::Permissions as u8, vec![permissions.as_byte()]),\n            Value::FragmentData(fragment_data) => (Type::FragmentData as u8, fragment_data),\n            Value::FragmentLast(fragment_last) => (Type::FragmentLast as u8, fragment_last),\n            Value::Flags(flags) => {\n                let mut vec: Vec<u8> = Vec::new();\n                vec.write_u32::<LittleEndian>(flags).unwrap();\n                (Type::Flags as u8, vec)\n            },\n            Value::Separator => (Type::Separator as u8, vec![0x00]),\n        }\n    }\n}\n\n#[allow(dead_code)]\n#[derive(Debug, Copy, Clone)]\npub enum Method {\n    PairSetup = 1,\n    PairVerify = 2,\n    AddPairing = 3,\n    RemovePairing = 4,\n    ListPairings = 5,\n}\n\n#[allow(dead_code)]\n#[derive(Debug, Copy, Clone, Error)]\npub enum Error {\n    #[error(\"Generic error to handle unexpected errors.\")]\n    Unknown = 0x01,\n    #[error(\"Setup code or signature verification failed.\")]\n    Authentication = 0x02,\n    #[error(\"Client must look at the retry delay TLV item and wait that many seconds before retrying.\")]\n    Backoff = 0x03,\n    #[error(\"Server cannot accept any more pairings.\")]\n    MaxPeers = 0x04,\n    #[error(\"Server reached its maximum number of authentication attempts.\")]\n    MaxTries = 0x05,\n    #[error(\"Server pairing method is unavailable.\")]\n    Unavailable = 0x06,\n    #[error(\"Server is busy and cannot accept a pairing request at this time.\")]\n    Busy = 0x07,\n}\n\nimpl From<error::Error> for Error {\n    fn from(err: error::Error) -> Self {\n        error!(\"{:?}\", err);\n        Error::Unknown\n    }\n}\n\nimpl From<io::Error> for Error {\n    fn from(err: io::Error) -> Self {\n        error!(\"{:?}\", err);\n        Error::Unknown\n    }\n}\n\nimpl From<cell::BorrowError> for Error {\n    fn from(err: cell::BorrowError) -> Error {\n        error!(\"{:?}\", err);\n        Error::Unknown\n    }\n}\n\nimpl From<cell::BorrowMutError> for Error {\n    fn from(err: cell::BorrowMutError) -> Error {\n        error!(\"{:?}\", err);\n        Error::Unknown\n    }\n}\n\nimpl From<tokio::task::JoinError> for Error {\n    fn from(err: tokio::task::JoinError) -> Self {\n        error!(\"{:?}\", err);\n        Error::Unknown\n    }\n}\n\nimpl From<str::Utf8Error> for Error {\n    fn from(err: str::Utf8Error) -> Self {\n        error!(\"{:?}\", err);\n        Error::Unknown\n    }\n}\n\nimpl From<uuid::Error> for Error {\n    fn from(err: uuid::Error) -> Self {\n        error!(\"{:?}\", err);\n        Error::Unknown\n    }\n}\n\nimpl From<SrpAuthError> for Error {\n    fn from(err: SrpAuthError) -> Self {\n        error!(\"{:?}\", err);\n        Error::Authentication\n    }\n}\n\nimpl From<aead::Error> for Error {\n    fn from(err: aead::Error) -> Self {\n        error!(\"{:?}\", err);\n        Error::Authentication\n    }\n}\n\nimpl From<ed25519_dalek::SignatureError> for Error {\n    fn from(err: ed25519_dalek::SignatureError) -> Self {\n        error!(\"{:?}\", err);\n        Error::Authentication\n    }\n}\n\npub type Container = Vec<Value>;\n\nimpl Encodable for Container {\n    fn encode(self) -> Vec<u8> { encode(self.into_iter().map(|v| v.as_tlv()).collect::<Vec<_>>()) }\n}\n\npub struct ErrorContainer {\n    step: u8,\n    error: Error,\n}\n\nimpl ErrorContainer {\n    pub fn new(step: u8, error: Error) -> ErrorContainer { ErrorContainer { step, error } }\n}\n\nimpl Encodable for ErrorContainer {\n    fn encode(self) -> Vec<u8> { vec![Value::State(self.step), Value::Error(self.error)].encode() }\n}\n"
  },
  {
    "path": "src/transport/bonjour.rs",
    "content": "use serde::{Deserialize, Serialize};\n\n/// Bonjour Feature Flag.\n#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)]\npub enum BonjourFeatureFlag {\n    Zero = 0,\n    SupportsHardwareAuthentication = 0x01,\n    SupportsSoftwareAuthentication = 0x02,\n}\n\n/// Bonjour Status Flag.\n#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)]\npub enum BonjourStatusFlag {\n    Zero = 0,\n    /// Accessory has not been paired with any controllers.\n    NotPaired = 0x01,\n    /// Accessory has not been configured to join a Wi-Fi network.\n    WifiNotConfigured = 0x02,\n    /// A problem has been detected on the accessory.\n    ProblemDetected = 0x04,\n}\n"
  },
  {
    "path": "src/transport/http/handler/accessories.rs",
    "content": "use futures::future::{BoxFuture, FutureExt};\nuse hyper::{Body, Response, StatusCode, Uri};\nuse log::info;\n\nuse crate::{\n    pointer,\n    transport::http::{handler::JsonHandlerExt, json_response},\n    Result,\n};\n\npub struct Accessories;\n\nimpl Accessories {\n    pub fn new() -> Accessories { Accessories }\n}\n\nimpl JsonHandlerExt for Accessories {\n    fn handle(\n        &mut self,\n        _: Uri,\n        _: Body,\n        _: pointer::ControllerId,\n        _: pointer::EventSubscriptions,\n        _: pointer::Config,\n        _: pointer::Storage,\n        accessory_database: pointer::AccessoryDatabase,\n        _: pointer::EventEmitter,\n    ) -> BoxFuture<Result<Response<Body>>> {\n        info!(\"received list accessories request\");\n        async move {\n            let resp_body = accessory_database.lock().await.as_serialized_json().await?;\n            // let resp_body = serde_json::to_vec(&accessory_database)?;\n            json_response(resp_body, StatusCode::OK)\n        }\n        .boxed()\n    }\n}\n"
  },
  {
    "path": "src/transport/http/handler/characteristics.rs",
    "content": "use futures::future::{BoxFuture, FutureExt};\nuse hyper::{body::Buf, Body, Response, StatusCode, Uri};\nuse log::error;\nuse std::collections::HashMap;\nuse url::form_urlencoded;\n\nuse crate::{\n    pointer,\n    transport::http::{\n        handler::JsonHandlerExt,\n        json_response,\n        status_response,\n        CharacteristicResponseBody,\n        ReadResponseObject,\n        Status,\n        WriteObject,\n        WriteResponseObject,\n    },\n    Error,\n    Result,\n};\n\npub struct GetCharacteristics;\n\nimpl GetCharacteristics {\n    pub fn new() -> Self { GetCharacteristics }\n}\n\nimpl JsonHandlerExt for GetCharacteristics {\n    fn handle(\n        &mut self,\n        uri: Uri,\n        _: Body,\n        _: pointer::ControllerId,\n        _: pointer::EventSubscriptions,\n        _: pointer::Config,\n        _: pointer::Storage,\n        accessory_database: pointer::AccessoryDatabase,\n        _: pointer::EventEmitter,\n    ) -> BoxFuture<Result<Response<Body>>> {\n        async move {\n            if let Some(query) = uri.query() {\n                let mut resp_body = CharacteristicResponseBody::<ReadResponseObject> {\n                    characteristics: Vec::new(),\n                };\n                let mut some_err = false;\n\n                let mut queries: HashMap<String, String> = HashMap::new();\n                for (key, val) in form_urlencoded::parse(query.as_bytes()) {\n                    queries.insert(key.into(), val.into());\n                }\n                let (f_meta, f_perms, f_type, f_ev) = check_flags(&queries);\n                let q_id = queries.get(\"id\").ok_or(Error::HttpStatus(StatusCode::BAD_REQUEST))?;\n                let ids = q_id.split(',').collect::<Vec<&str>>();\n                for id in ids {\n                    let id_pair = id.split('.').collect::<Vec<&str>>();\n                    if id_pair.len() != 2 {\n                        return Err(Error::HttpStatus(StatusCode::BAD_REQUEST));\n                    }\n                    let aid = id_pair[0].parse::<u64>()?;\n                    let iid = id_pair[1].parse::<u64>()?;\n\n                    let res_object = match accessory_database\n                        .lock()\n                        .await\n                        .read_characteristic(aid, iid, f_meta, f_perms, f_type, f_ev)\n                        .await\n                    {\n                        Ok(mut res_object) => {\n                            if res_object.status != Some(0) {\n                                some_err = true;\n                                res_object.value = None;\n                            }\n                            res_object\n                        },\n                        Err(e) => {\n                            error!(\"error reading characteristic: {:?}\", e);\n                            some_err = true;\n                            ReadResponseObject {\n                                iid,\n                                aid,\n                                status: Some(Status::ServiceCommunicationFailure as i32),\n                                ..Default::default()\n                            }\n                        },\n                    };\n\n                    resp_body.characteristics.push(res_object);\n                }\n\n                if some_err {\n                    let res = serde_json::to_vec(&resp_body)?;\n                    return json_response(res, StatusCode::MULTI_STATUS);\n                }\n                for ref mut r in &mut resp_body.characteristics {\n                    r.status = None;\n                }\n                let res = serde_json::to_vec(&resp_body)?;\n\n                json_response(res, StatusCode::OK)\n            } else {\n                status_response(StatusCode::BAD_REQUEST)\n            }\n        }\n        .boxed()\n    }\n}\n\nfn check_flags(flags: &HashMap<String, String>) -> (bool, bool, bool, bool) {\n    let true_val = \"1\".to_string();\n    (\n        flags.get(\"meta\") == Some(&true_val),\n        flags.get(\"perms\") == Some(&true_val),\n        flags.get(\"type\") == Some(&true_val),\n        flags.get(\"ev\") == Some(&true_val),\n    )\n}\n\npub struct UpdateCharacteristics;\n\nimpl UpdateCharacteristics {\n    pub fn new() -> Self { UpdateCharacteristics {} }\n}\n\nimpl JsonHandlerExt for UpdateCharacteristics {\n    fn handle(\n        &mut self,\n        _: Uri,\n        body: Body,\n        _: pointer::ControllerId,\n        event_subscriptions: pointer::EventSubscriptions,\n        _: pointer::Config,\n        _: pointer::Storage,\n        accessories: pointer::AccessoryDatabase,\n        _: pointer::EventEmitter,\n    ) -> BoxFuture<Result<Response<Body>>> {\n        async move {\n            let aggregated_body = hyper::body::aggregate(body).await?;\n\n            let write_body: CharacteristicResponseBody<WriteObject> = serde_json::from_slice(aggregated_body.chunk())?;\n            let mut resp_body = CharacteristicResponseBody::<WriteResponseObject> {\n                characteristics: Vec::new(),\n            };\n            let mut some_err = false;\n            let mut all_err = true;\n\n            for c in write_body.characteristics {\n                let iid = c.iid;\n                let aid = c.aid;\n                let res_object = match accessories\n                    .lock()\n                    .await\n                    .write_characteristic(c, &event_subscriptions)\n                    .await\n                {\n                    Ok(res_object) => {\n                        if res_object.status != 0 {\n                            some_err = true;\n                        } else {\n                            all_err = false;\n                        }\n                        res_object\n                    },\n                    Err(e) => {\n                        error!(\"error updating characteristic: {:?}\", e);\n                        some_err = true;\n                        WriteResponseObject {\n                            iid,\n                            aid,\n                            status: Status::ServiceCommunicationFailure as i32,\n                        }\n                    },\n                };\n\n                resp_body.characteristics.push(res_object);\n            }\n\n            if all_err {\n                let res = serde_json::to_vec(&resp_body)?;\n                json_response(res, StatusCode::BAD_REQUEST)\n            } else if some_err {\n                let res = serde_json::to_vec(&resp_body)?;\n                json_response(res, StatusCode::MULTI_STATUS)\n            } else {\n                status_response(StatusCode::NO_CONTENT)\n            }\n        }\n        .boxed()\n    }\n}\n"
  },
  {
    "path": "src/transport/http/handler/identify.rs",
    "content": "use futures::future::{BoxFuture, FutureExt};\nuse hyper::{Body, Response, StatusCode, Uri};\nuse serde_json::json;\n\nuse crate::{\n    pointer,\n    transport::http::{handler::JsonHandlerExt, json_response, status_response, Status},\n    HapType,\n    Result,\n};\n\npub struct Identify;\n\nimpl Identify {\n    pub fn new() -> Identify { Identify }\n}\n\nimpl JsonHandlerExt for Identify {\n    fn handle(\n        &mut self,\n        _: Uri,\n        _: Body,\n        _: pointer::ControllerId,\n        _: pointer::EventSubscriptions,\n        _: pointer::Config,\n        storage: pointer::Storage,\n        accessory_database: pointer::AccessoryDatabase,\n        _: pointer::EventEmitter,\n    ) -> BoxFuture<Result<Response<Body>>> {\n        let storage = storage.clone();\n        let accessory_database = accessory_database.clone();\n\n        async move {\n            if storage.lock().await.count_pairings().await? > 0 {\n                let body = serde_json::to_vec(&json!({ \"status\": Status::InsufficientPrivileges as i32 }))?;\n                return json_response(body, StatusCode::BAD_REQUEST);\n            }\n\n            for accessory in accessory_database.lock().await.accessories.iter_mut() {\n                accessory\n                    .lock()\n                    .await\n                    .get_mut_service(HapType::AccessoryInformation)\n                    .expect(\"missing Accessory Information Service\") // every accessory needs to have it, so this should never panic\n                    .get_mut_characteristic(HapType::Identify)\n                    .expect(\"missing Identify Characteristic on Accessory Information Service\")\n                    .set_value(serde_json::Value::Bool(true))\n                    .await?;\n            }\n\n            // TODO: defer setting them all back to false after a few secs\n\n            status_response(StatusCode::NO_CONTENT)\n        }\n        .boxed()\n    }\n}\n"
  },
  {
    "path": "src/transport/http/handler/mod.rs",
    "content": "use futures::future::{BoxFuture, FutureExt};\nuse hyper::{self, Body, Response, StatusCode, Uri};\n\nuse crate::{\n    pointer,\n    tlv::{self, Encodable},\n    transport::http::{status_response, tlv_response},\n    Error,\n    Result,\n};\n\npub mod accessories;\npub mod characteristics;\npub mod identify;\npub mod pair_setup;\npub mod pair_verify;\npub mod pairings;\n\npub trait HandlerExt {\n    fn handle(\n        &mut self,\n        uri: Uri,\n        body: Body,\n        controller_id: pointer::ControllerId,\n        event_subscriptions: pointer::EventSubscriptions,\n        config: pointer::Config,\n        storage: pointer::Storage,\n        accessory_database: pointer::AccessoryDatabase,\n        event_emitter: pointer::EventEmitter,\n    ) -> BoxFuture<Result<Response<Body>>>;\n}\n\npub trait TlvHandlerExt {\n    type ParseResult: Send;\n    type Result: Encodable;\n\n    fn parse(&self, body: Body) -> BoxFuture<std::result::Result<Self::ParseResult, tlv::ErrorContainer>>;\n    fn handle(\n        &mut self,\n        step: Self::ParseResult,\n        controller_id: pointer::ControllerId,\n        config: pointer::Config,\n        storage: pointer::Storage,\n        event_emitter: pointer::EventEmitter,\n    ) -> BoxFuture<std::result::Result<Self::Result, tlv::ErrorContainer>>;\n}\n\n#[derive(Debug)]\npub struct TlvHandler<T: TlvHandlerExt + Send + Sync>(T);\n\nimpl<T: TlvHandlerExt + Send + Sync> From<T> for TlvHandler<T> {\n    fn from(inst: T) -> TlvHandler<T> { TlvHandler(inst) }\n}\n\nimpl<T: TlvHandlerExt + Send + Sync> HandlerExt for TlvHandler<T> {\n    fn handle(\n        &mut self,\n        _: Uri,\n        body: Body,\n        controller_id: pointer::ControllerId,\n        _: pointer::EventSubscriptions,\n        config: pointer::Config,\n        storage: pointer::Storage,\n        _: pointer::AccessoryDatabase,\n        event_emitter: pointer::EventEmitter,\n    ) -> BoxFuture<Result<Response<Body>>> {\n        async move {\n            let response = match self.0.parse(body).await {\n                Err(e) => e.encode(),\n                Ok(step) => match self.0.handle(step, controller_id, config, storage, event_emitter).await {\n                    Err(e) => e.encode(),\n                    Ok(res) => res.encode(),\n                },\n            };\n            tlv_response(response, StatusCode::OK)\n        }\n        .boxed()\n    }\n}\n\npub trait JsonHandlerExt {\n    fn handle(\n        &mut self,\n        uri: Uri,\n        body: Body,\n        controller_id: pointer::ControllerId,\n        event_subscriptions: pointer::EventSubscriptions,\n        config: pointer::Config,\n        storage: pointer::Storage,\n        accessory_database: pointer::AccessoryDatabase,\n        event_emitter: pointer::EventEmitter,\n    ) -> BoxFuture<Result<Response<Body>>>;\n}\n\n#[derive(Debug)]\npub struct JsonHandler<T: JsonHandlerExt + Send + Sync>(T);\n\nimpl<T: JsonHandlerExt + Send + Sync> From<T> for JsonHandler<T> {\n    fn from(inst: T) -> JsonHandler<T> { JsonHandler(inst) }\n}\n\nimpl<T: JsonHandlerExt + Send + Sync> HandlerExt for JsonHandler<T> {\n    fn handle(\n        &mut self,\n        uri: Uri,\n        body: Body,\n        controller_id: pointer::ControllerId,\n        event_subscriptions: pointer::EventSubscriptions,\n        config: pointer::Config,\n        storage: pointer::Storage,\n        accessory_database: pointer::AccessoryDatabase,\n        event_emitter: pointer::EventEmitter,\n    ) -> BoxFuture<Result<Response<Body>>> {\n        async move {\n            match self\n                .0\n                .handle(\n                    uri,\n                    body,\n                    controller_id,\n                    event_subscriptions,\n                    config,\n                    storage,\n                    accessory_database,\n                    event_emitter,\n                )\n                .await\n            {\n                Ok(res) => Ok(res),\n                Err(e) => match e {\n                    Error::HttpStatus(status) => status_response(status),\n                    _ => status_response(StatusCode::INTERNAL_SERVER_ERROR),\n                },\n            }\n        }\n        .boxed()\n    }\n}\n"
  },
  {
    "path": "src/transport/http/handler/pair_setup.rs",
    "content": "use aead::{generic_array::GenericArray, AeadInPlace, NewAead};\nuse chacha20poly1305::ChaCha20Poly1305;\nuse futures::future::{BoxFuture, FutureExt};\nuse hyper::{body::Buf, Body};\nuse log::{debug, info};\nuse num::BigUint;\nuse rand::{rngs::OsRng, RngCore};\nuse sha2::{digest::Digest, Sha512};\nuse signature::{Signer, Verifier};\nuse srp::{\n    client::{srp_private_key, SrpClient},\n    groups::G_3072,\n    server::{SrpServer, UserRecord},\n    types::SrpGroup,\n};\nuse std::{ops::BitXor, str};\nuse uuid::Uuid;\n\nuse crate::{\n    event::Event,\n    pairing::{Pairing, Permissions},\n    pointer,\n    tlv::{self, Encodable, Type, Value},\n    transport::{hkdf_extract_and_expand, http::handler::TlvHandlerExt},\n};\n\nstruct Session {\n    salt: [u8; 16],\n    verifier: Vec<u8>,\n    b: [u8; 64],\n    b_pub: Vec<u8>,\n    shared_secret: Option<Vec<u8>>,\n}\n\npub struct PairSetup {\n    session: Option<Session>,\n    unsuccessful_tries: u8,\n}\n\nimpl PairSetup {\n    pub fn new() -> PairSetup {\n        PairSetup {\n            session: None,\n            unsuccessful_tries: 0,\n        }\n    }\n}\n\n#[derive(Debug, Clone)]\nenum StepNumber {\n    Unknown = 0,\n    SrpStartRequest = 1,\n    SrpStartResponse = 2,\n    SrpVerifyRequest = 3,\n    SrpVerifyResponse = 4,\n    ExchangeRequest = 5,\n    ExchangeResponse = 6,\n}\n\n#[derive(Debug, Clone)]\npub enum Step {\n    Start,\n    Verify { a_pub: Vec<u8>, a_proof: Vec<u8> },\n    Exchange { data: Vec<u8> },\n}\n\nimpl TlvHandlerExt for PairSetup {\n    type ParseResult = Step;\n    type Result = tlv::Container;\n\n    fn parse(&self, body: Body) -> BoxFuture<Result<Step, tlv::ErrorContainer>> {\n        async {\n            let aggregated_body = hyper::body::aggregate(body)\n                .await\n                .map_err(|_| tlv::ErrorContainer::new(StepNumber::Unknown as u8, tlv::Error::Unknown))?;\n\n            debug!(\"received body: {:?}\", aggregated_body.chunk());\n\n            let mut decoded = tlv::decode(aggregated_body.chunk());\n            match decoded.get(&(Type::State as u8)) {\n                Some(method) => match method[0] {\n                    x if x == StepNumber::SrpStartRequest as u8 => Ok(Step::Start),\n                    x if x == StepNumber::SrpVerifyRequest as u8 => {\n                        let a_pub = decoded\n                            .remove(&(Type::PublicKey as u8))\n                            .ok_or(tlv::ErrorContainer::new(\n                                StepNumber::SrpVerifyResponse as u8,\n                                tlv::Error::Unknown,\n                            ))?;\n                        let a_proof = decoded.remove(&(Type::Proof as u8)).ok_or(tlv::ErrorContainer::new(\n                            StepNumber::SrpVerifyResponse as u8,\n                            tlv::Error::Unknown,\n                        ))?;\n                        Ok(Step::Verify { a_pub, a_proof })\n                    },\n                    x if x == StepNumber::ExchangeRequest as u8 => {\n                        let data = decoded\n                            .remove(&(Type::EncryptedData as u8))\n                            .ok_or(tlv::ErrorContainer::new(\n                                StepNumber::ExchangeResponse as u8,\n                                tlv::Error::Unknown,\n                            ))?;\n                        Ok(Step::Exchange { data })\n                    },\n                    _ => Err(tlv::ErrorContainer::new(StepNumber::Unknown as u8, tlv::Error::Unknown)),\n                },\n                None => Err(tlv::ErrorContainer::new(StepNumber::Unknown as u8, tlv::Error::Unknown)),\n            }\n        }\n        .boxed()\n    }\n\n    fn handle(\n        &mut self,\n        step: Step,\n        _: pointer::ControllerId,\n        config: pointer::Config,\n        storage: pointer::Storage,\n        event_emitter: pointer::EventEmitter,\n    ) -> BoxFuture<Result<tlv::Container, tlv::ErrorContainer>> {\n        async move {\n            match step {\n                Step::Start => match handle_start(self, config).await {\n                    Ok(res) => {\n                        self.unsuccessful_tries = 0;\n                        Ok(res)\n                    },\n                    Err(err) => {\n                        self.unsuccessful_tries += 1;\n                        Err(tlv::ErrorContainer::new(StepNumber::SrpStartResponse as u8, err))\n                    },\n                },\n                Step::Verify { a_pub, a_proof } => match handle_verify(self, &a_pub, &a_proof).await {\n                    Ok(res) => {\n                        self.unsuccessful_tries = 0;\n                        Ok(res)\n                    },\n                    Err(err) => {\n                        self.unsuccessful_tries += 1;\n                        Err(tlv::ErrorContainer::new(StepNumber::SrpVerifyResponse as u8, err))\n                    },\n                },\n                Step::Exchange { data } => match handle_exchange(self, config, storage, event_emitter, &data).await {\n                    Ok(res) => {\n                        self.unsuccessful_tries = 0;\n                        Ok(res)\n                    },\n                    Err(err) => {\n                        self.unsuccessful_tries += 1;\n                        Err(tlv::ErrorContainer::new(StepNumber::ExchangeResponse as u8, err))\n                    },\n                },\n            }\n        }\n        .boxed()\n    }\n}\n\nasync fn handle_start(handler: &mut PairSetup, config: pointer::Config) -> Result<tlv::Container, tlv::Error> {\n    info!(\"pair setup M1: received SRP start request\");\n\n    // TODO\n    // If the accessory is already paired, it must respond with the following TLV items:\n    // kTLVType_State <M2>\n    // kTLVType_Error <kTLVError_Unavailable>\n\n    if handler.unsuccessful_tries > 100 {\n        return Err(tlv::Error::MaxTries);\n    }\n\n    // TODO\n    // If the accessory is currently performing a PairSetup procedure with a different controller, it must respond with\n    // the following TLV items:\n    // kTLVType_State <M2>\n    // kTLVType_Error <kTLVError_Busy>\n\n    let mut csprng = OsRng {};\n    let mut salt = [0; 16]; // s\n    let mut b = [0; 64];\n    csprng.fill_bytes(&mut salt);\n    csprng.fill_bytes(&mut b);\n\n    // TODO - respect pairing flags (specification p. 35 - 7.) for split pair setup\n\n    let private_key = srp_private_key::<Sha512>(b\"Pair-Setup\", &config.lock().await.pin.to_string().as_bytes(), &salt); // x = H(s | H(I | \":\" | P))\n    let srp_client = SrpClient::<Sha512>::new(&private_key, &G_3072);\n    let verifier = srp_client.get_password_verifier(&private_key); // v = g^x\n\n    let user = UserRecord {\n        username: b\"Pair-Setup\",\n        salt: &salt,\n        verifier: &verifier,\n    };\n    let srp_server = SrpServer::<Sha512>::new(&user, b\"foo\", &b, &G_3072)?;\n    let b_pub = srp_server.get_b_pub();\n\n    handler.session = Some(Session {\n        salt,\n        verifier,\n        b,\n        b_pub: b_pub.clone(),\n        shared_secret: None,\n    });\n\n    info!(\"pair setup M2: sending SRP start response\");\n\n    Ok(vec![\n        Value::State(StepNumber::SrpStartResponse as u8),\n        Value::PublicKey(b_pub),\n        Value::Salt(salt),\n    ])\n}\n\nasync fn handle_verify(handler: &mut PairSetup, a_pub: &[u8], a_proof: &[u8]) -> Result<tlv::Container, tlv::Error> {\n    info!(\"pair setup M3: received SRP verify request\");\n\n    match handler.session {\n        None => Err(tlv::Error::Unknown),\n        Some(ref mut session) => {\n            let user = UserRecord {\n                username: b\"Pair-Setup\",\n                salt: &session.salt,\n                verifier: &session.verifier,\n            };\n            let srp_server = SrpServer::<Sha512>::new(&user, a_pub, &session.b, &G_3072)?;\n            let shared_secret = srp_server.get_key();\n\n            session.shared_secret = Some(shared_secret.to_vec());\n\n            let b_proof =\n                verify_client_proof::<Sha512>(&session.b_pub, a_pub, a_proof, &session.salt, &shared_secret, &G_3072)?;\n\n            info!(\"pair setup M4: sending SRP verify response\");\n\n            Ok(vec![\n                Value::State(StepNumber::SrpVerifyResponse as u8),\n                Value::Proof(b_proof),\n            ])\n        },\n    }\n}\n\nasync fn handle_exchange(\n    handler: &mut PairSetup,\n    config: pointer::Config,\n    storage: pointer::Storage,\n    event_emitter: pointer::EventEmitter,\n    data: &[u8],\n) -> Result<tlv::Container, tlv::Error> {\n    info!(\"pair setup M5: received exchange request\");\n\n    match handler.session {\n        None => Err(tlv::Error::Unknown),\n        Some(ref mut session) => match session.shared_secret {\n            None => Err(tlv::Error::Unknown),\n            Some(ref shared_secret) => {\n                let encrypted_data = Vec::from(&data[..data.len() - 16]);\n                let auth_tag = Vec::from(&data[data.len() - 16..]);\n\n                let encryption_key =\n                    hkdf_extract_and_expand(b\"Pair-Setup-Encrypt-Salt\", shared_secret, b\"Pair-Setup-Encrypt-Info\")?;\n\n                let mut nonce = vec![0; 4];\n                nonce.extend(b\"PS-Msg05\");\n\n                let aead = ChaCha20Poly1305::new(GenericArray::from_slice(&encryption_key));\n\n                let mut decrypted_data = Vec::new();\n                decrypted_data.extend_from_slice(&encrypted_data);\n                aead.decrypt_in_place_detached(\n                    GenericArray::from_slice(&nonce),\n                    &[],\n                    &mut decrypted_data,\n                    GenericArray::from_slice(&auth_tag),\n                )?;\n\n                let sub_tlv = tlv::decode(&decrypted_data);\n                let device_pairing_id = sub_tlv.get(&(Type::Identifier as u8)).ok_or(tlv::Error::Unknown)?;\n                let device_ltpk = ed25519_dalek::PublicKey::from_bytes(\n                    sub_tlv.get(&(Type::PublicKey as u8)).ok_or(tlv::Error::Unknown)?,\n                )?;\n                let device_signature = ed25519_dalek::Signature::from_bytes(\n                    sub_tlv.get(&(Type::Signature as u8)).ok_or(tlv::Error::Unknown)?,\n                )?;\n\n                let device_x = hkdf_extract_and_expand(\n                    b\"Pair-Setup-Controller-Sign-Salt\",\n                    shared_secret,\n                    b\"Pair-Setup-Controller-Sign-Info\",\n                )?;\n\n                let mut device_info: Vec<u8> = Vec::new();\n                device_info.extend(&device_x);\n                device_info.extend(device_pairing_id);\n                device_info.extend(device_ltpk.as_bytes());\n\n                if device_ltpk.verify(&device_info, &device_signature).is_err() {\n                    return Err(tlv::Error::Authentication);\n                }\n\n                let uuid_str = str::from_utf8(device_pairing_id)?;\n                let pairing_uuid = Uuid::parse_str(uuid_str)?;\n                let mut pairing_ltpk = [0; 32];\n                pairing_ltpk[..32].copy_from_slice(&device_ltpk.as_bytes()[..32]);\n\n                if let Some(max_peers) = config.lock().await.max_peers {\n                    if storage.lock().await.count_pairings().await? + 1 > max_peers {\n                        return Err(tlv::Error::MaxPeers);\n                    }\n                }\n\n                let pairing = Pairing::new(pairing_uuid, Permissions::Admin, device_ltpk.to_bytes());\n                storage.lock().await.save_pairing(&pairing).await?;\n\n                debug!(\"pairing: {:?}\", &pairing);\n\n                let accessory_x = hkdf_extract_and_expand(\n                    b\"Pair-Setup-Accessory-Sign-Salt\",\n                    shared_secret,\n                    b\"Pair-Setup-Accessory-Sign-Info\",\n                )?;\n\n                let config = config.lock().await;\n                let device_id = config.device_id.to_string();\n\n                let mut accessory_info: Vec<u8> = Vec::new();\n                accessory_info.extend(&accessory_x);\n                accessory_info.extend(device_id.as_bytes());\n                accessory_info.extend(config.device_ed25519_keypair.public.as_bytes());\n                let accessory_signature = config.device_ed25519_keypair.sign(&accessory_info);\n\n                let encoded_sub_tlv = vec![\n                    Value::Identifier(device_id),\n                    Value::PublicKey(config.device_ed25519_keypair.public.as_bytes().to_vec()),\n                    Value::Signature(accessory_signature.to_bytes().to_vec()),\n                ]\n                .encode();\n\n                drop(config);\n\n                let mut nonce = vec![0; 4];\n                nonce.extend(b\"PS-Msg06\");\n\n                let mut encrypted_data = Vec::new();\n                encrypted_data.extend_from_slice(&encoded_sub_tlv);\n                let auth_tag =\n                    aead.encrypt_in_place_detached(GenericArray::from_slice(&nonce), &[], &mut encrypted_data)?;\n                encrypted_data.extend(&auth_tag);\n\n                event_emitter\n                    .lock()\n                    .await\n                    .emit(&Event::ControllerPaired { id: pairing.id })\n                    .await;\n\n                info!(\"pair setup M6: sending exchange response\");\n\n                Ok(vec![\n                    Value::State(StepNumber::ExchangeResponse as u8),\n                    Value::EncryptedData(encrypted_data),\n                ])\n            },\n        },\n    }\n}\n\nfn verify_client_proof<D: Digest>(\n    b_pub: &[u8],\n    a_pub: &[u8],\n    a_proof: &[u8],\n    salt: &[u8],\n    key: &[u8],\n    group: &SrpGroup,\n) -> Result<Vec<u8>, tlv::Error> {\n    let mut dhn = D::new();\n    dhn.update(&group.n.to_bytes_be());\n    let hn = BigUint::from_bytes_be(&dhn.finalize());\n\n    let mut dhg = D::new();\n    dhg.update(&group.g.to_bytes_be());\n    let hg = BigUint::from_bytes_be(&dhg.finalize());\n\n    let hng = hn.bitxor(hg);\n\n    let mut dhi = D::new();\n    dhi.update(b\"Pair-Setup\");\n    let hi = dhi.finalize();\n\n    let mut d = D::new();\n    // M = H(H(N) xor H(g), H(I), s, A, B, K)\n    d.update(&hng.to_bytes_be());\n    d.update(&hi);\n    d.update(salt);\n    d.update(a_pub);\n    d.update(b_pub);\n    d.update(key);\n\n    if a_proof == d.finalize().as_slice() {\n        // H(A, M, K)\n        let mut d = D::new();\n        d.update(a_pub);\n        d.update(a_proof);\n        d.update(key);\n        Ok(d.finalize().as_slice().to_vec())\n    } else {\n        Err(tlv::Error::Authentication)\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn test_verify_client_proof() {\n        let b_pub = [\n            66, 254, 195, 54, 248, 36, 231, 56, 186, 118, 54, 42, 5, 66, 113, 73, 150, 54, 54, 156, 16, 76, 252, 50,\n            206, 135, 204, 173, 159, 174, 68, 125, 23, 251, 75, 215, 136, 102, 165, 73, 107, 249, 205, 158, 32, 192,\n            157, 134, 17, 70, 51, 225, 74, 3, 195, 74, 124, 137, 26, 48, 245, 253, 212, 197, 29, 141, 12, 5, 36, 191,\n            77, 203, 137, 72, 27, 38, 231, 136, 43, 60, 134, 137, 192, 134, 218, 13, 90, 232, 166, 245, 168, 29, 34,\n            91, 121, 185, 82, 144, 146, 215, 6, 120, 204, 126, 217, 146, 135, 243, 55, 1, 99, 159, 192, 53, 80, 103,\n            19, 87, 253, 193, 104, 98, 228, 167, 138, 214, 84, 135, 232, 225, 185, 158, 114, 48, 228, 110, 137, 109,\n            32, 21, 227, 177, 18, 241, 240, 240, 125, 115, 135, 46, 249, 172, 206, 170, 41, 76, 169, 163, 62, 77, 94,\n            51, 116, 69, 188, 218, 171, 90, 171, 128, 163, 84, 233, 52, 134, 77, 70, 130, 207, 84, 55, 218, 155, 199,\n            67, 214, 10, 25, 142, 134, 34, 65, 43, 52, 113, 92, 234, 213, 101, 32, 12, 34, 87, 31, 82, 132, 175, 144,\n            116, 36, 47, 119, 221, 46, 103, 44, 80, 74, 201, 196, 249, 230, 127, 123, 80, 118, 216, 163, 249, 186, 218,\n            184, 181, 144, 72, 187, 101, 164, 150, 209, 45, 247, 70, 184, 92, 155, 146, 175, 162, 54, 95, 155, 174,\n            116, 38, 190, 166, 137, 133, 51, 253, 21, 169, 129, 167, 61, 102, 49, 115, 24, 245, 130, 171, 6, 196, 177,\n            44, 49, 149, 39, 239, 142, 253, 49, 123, 226, 140, 40, 43, 193, 131, 20, 30, 17, 57, 252, 1, 68, 55, 1,\n            227, 226, 24, 73, 204, 237, 230, 2, 81, 203, 54, 204, 157, 174, 22, 134, 126, 132, 106, 66, 115, 27, 189,\n            157, 131, 173, 205, 36, 140, 160, 183, 171, 62, 97, 7, 73, 93, 114, 199, 50, 192, 22, 56, 132, 172, 61,\n            208, 84, 102, 85, 60, 216, 170, 249, 29, 66, 158, 48, 221, 78, 166, 50, 20, 203, 99, 206, 6, 112, 163, 194,\n            43, 165, 176, 193, 62, 157, 184, 57, 235, 221, 175, 46, 7, 152,\n        ];\n        let a_pub = [\n            21, 187, 129, 247, 180, 115, 7, 3, 46, 219, 190, 0, 89, 8, 126, 225, 37, 159, 98, 137, 226, 202, 13, 228,\n            31, 55, 17, 244, 180, 120, 159, 97, 141, 126, 131, 219, 227, 64, 81, 24, 99, 206, 12, 218, 27, 95, 43, 216,\n            151, 228, 46, 89, 133, 153, 100, 55, 134, 206, 65, 165, 244, 228, 121, 88, 78, 54, 19, 220, 48, 86, 150,\n            92, 21, 168, 219, 226, 214, 254, 33, 26, 135, 134, 247, 49, 58, 114, 245, 76, 67, 182, 223, 191, 93, 1,\n            131, 58, 76, 62, 49, 123, 11, 10, 164, 221, 249, 114, 77, 154, 179, 95, 207, 127, 9, 154, 30, 91, 99, 67,\n            160, 94, 33, 239, 178, 32, 173, 245, 25, 91, 153, 189, 34, 216, 16, 100, 160, 145, 150, 208, 85, 135, 237,\n            13, 225, 234, 144, 137, 224, 217, 187, 77, 10, 51, 240, 45, 72, 9, 184, 164, 195, 153, 55, 66, 98, 110,\n            208, 204, 45, 204, 14, 46, 195, 119, 25, 83, 120, 223, 17, 167, 79, 75, 68, 182, 105, 97, 176, 15, 153, 95,\n            170, 16, 33, 172, 134, 114, 73, 69, 5, 49, 78, 133, 250, 44, 136, 75, 179, 33, 213, 48, 77, 236, 16, 148,\n            221, 74, 185, 209, 83, 94, 167, 180, 101, 170, 91, 129, 143, 228, 180, 251, 185, 210, 16, 74, 26, 248, 65,\n            208, 73, 182, 161, 120, 59, 223, 98, 166, 58, 94, 69, 250, 93, 75, 29, 36, 41, 211, 242, 115, 253, 65, 28,\n            204, 117, 167, 194, 113, 98, 180, 54, 96, 170, 81, 125, 134, 19, 213, 2, 213, 178, 163, 108, 74, 215, 177,\n            52, 217, 75, 225, 144, 220, 3, 164, 87, 156, 233, 1, 99, 218, 251, 89, 45, 165, 227, 98, 232, 143, 165,\n            141, 246, 196, 230, 209, 136, 35, 75, 218, 63, 15, 94, 150, 79, 113, 245, 247, 28, 139, 115, 136, 232, 175,\n            49, 228, 11, 70, 234, 131, 126, 167, 31, 234, 202, 34, 27, 240, 195, 201, 1, 29, 98, 229, 254, 146, 87,\n            223, 113, 5, 218, 217, 250, 58, 115, 53, 9, 162, 175, 42, 176, 10, 195, 48, 155, 56, 58, 246, 219, 98, 166,\n            41, 34, 216, 225, 29, 28, 1, 18, 89,\n        ];\n        let a_proof = [\n            33, 202, 204, 21, 29, 11, 142, 163, 254, 113, 245, 137, 104, 89, 101, 247, 182, 215, 41, 42, 213, 171, 173,\n            142, 172, 183, 214, 187, 204, 48, 253, 153, 224, 246, 18, 246, 72, 5, 95, 165, 27, 245, 255, 22, 229, 250,\n            129, 33, 8, 40, 1, 194, 131, 19, 51, 75, 37, 179, 34, 60, 222, 13, 182, 81,\n        ];\n        let salt = [67, 81, 86, 223, 10, 171, 140, 180, 0, 188, 111, 77, 228, 110, 173, 185];\n        let shared_secret = [\n            39, 162, 132, 15, 245, 98, 72, 107, 190, 101, 117, 162, 228, 189, 241, 14, 132, 216, 104, 7, 65, 72, 90,\n            154, 86, 129, 171, 235, 197, 55, 174, 216, 183, 170, 12, 101, 219, 128, 62, 155, 113, 212, 250, 40, 137,\n            178, 199, 215, 68, 139, 218, 112, 205, 68, 52, 66, 95, 11, 116, 251, 143, 93, 206, 89,\n        ];\n\n        let b_proof = verify_client_proof::<Sha512>(&b_pub, &a_pub, &a_proof, &salt, &shared_secret, &G_3072).unwrap();\n\n        assert_eq!(b_proof, vec![\n            53, 222, 231, 209, 7, 123, 202, 208, 135, 119, 183, 90, 79, 154, 55, 155, 63, 56, 215, 210, 4, 20, 229,\n            119, 234, 168, 107, 137, 48, 172, 180, 244, 184, 142, 170, 120, 188, 106, 94, 135, 122, 4, 211, 21, 190,\n            26, 121, 180, 13, 192, 173, 246, 172, 223, 161, 192, 52, 251, 187, 66, 52, 170, 18, 85\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/transport/http/handler/pair_verify.rs",
    "content": "use aead::{generic_array::GenericArray, AeadInPlace, NewAead};\nuse chacha20poly1305::ChaCha20Poly1305;\nuse futures::{\n    channel::oneshot,\n    future::{BoxFuture, FutureExt},\n};\nuse hyper::{body::Buf, Body};\nuse log::{debug, info};\nuse rand::rngs::OsRng;\nuse signature::{Signer, Verifier};\nuse std::str;\nuse uuid::Uuid;\nuse x25519_dalek::{EphemeralSecret, PublicKey};\n\nuse crate::{\n    pointer,\n    tlv::{self, Encodable, Type, Value},\n    transport::{hkdf_extract_and_expand, http::handler::TlvHandlerExt, tcp},\n};\n\nstruct Session {\n    b_pub: PublicKey,\n    a_pub: PublicKey,\n    shared_secret: [u8; 32],\n    session_key: [u8; 32],\n}\n\npub struct PairVerify {\n    session: Option<Session>,\n    session_sender: Option<oneshot::Sender<tcp::Session>>,\n}\n\nimpl PairVerify {\n    pub fn new(session_sender: oneshot::Sender<tcp::Session>) -> PairVerify {\n        PairVerify {\n            session: None,\n            session_sender: Some(session_sender),\n        }\n    }\n}\n\n#[derive(Debug, Clone)]\nenum StepNumber {\n    Unknown = 0,\n    StartReq = 1,\n    StartRes = 2,\n    FinishReq = 3,\n    FinishRes = 4,\n}\n\n#[derive(Debug, Clone)]\npub enum Step {\n    Start { a_pub: Vec<u8> },\n    Finish { data: Vec<u8> },\n}\n\nimpl TlvHandlerExt for PairVerify {\n    type ParseResult = Step;\n    type Result = tlv::Container;\n\n    fn parse(&self, body: Body) -> BoxFuture<Result<Step, tlv::ErrorContainer>> {\n        async {\n            let aggregated_body = hyper::body::aggregate(body)\n                .await\n                .map_err(|_| tlv::ErrorContainer::new(StepNumber::Unknown as u8, tlv::Error::Unknown))?;\n\n            debug!(\"received body: {:?}\", aggregated_body.chunk());\n\n            let mut decoded = tlv::decode(aggregated_body.chunk());\n            match decoded.get(&(Type::State as u8)) {\n                Some(method) => match method[0] {\n                    x if x == StepNumber::StartReq as u8 => {\n                        let a_pub = decoded\n                            .remove(&(Type::PublicKey as u8))\n                            .ok_or(tlv::ErrorContainer::new(\n                                StepNumber::StartRes as u8,\n                                tlv::Error::Unknown,\n                            ))?;\n                        Ok(Step::Start { a_pub })\n                    },\n                    x if x == StepNumber::FinishReq as u8 => {\n                        let data = decoded\n                            .remove(&(Type::EncryptedData as u8))\n                            .ok_or(tlv::ErrorContainer::new(\n                                StepNumber::FinishRes as u8,\n                                tlv::Error::Unknown,\n                            ))?;\n                        Ok(Step::Finish { data })\n                    },\n                    _ => Err(tlv::ErrorContainer::new(StepNumber::Unknown as u8, tlv::Error::Unknown)),\n                },\n                None => Err(tlv::ErrorContainer::new(StepNumber::Unknown as u8, tlv::Error::Unknown)),\n            }\n        }\n        .boxed()\n    }\n\n    fn handle(\n        &mut self,\n        step: Step,\n        _: pointer::ControllerId,\n        config: pointer::Config,\n        storage: pointer::Storage,\n        _: pointer::EventEmitter,\n    ) -> BoxFuture<Result<tlv::Container, tlv::ErrorContainer>> {\n        async move {\n            match step {\n                Step::Start { a_pub } => match handle_start(self, config, a_pub).await {\n                    Ok(res) => Ok(res),\n                    Err(err) => Err(tlv::ErrorContainer::new(StepNumber::StartRes as u8, err)),\n                },\n                Step::Finish { data } => match handle_finish(self, storage, &data).await {\n                    Ok(res) => Ok(res),\n                    Err(err) => Err(tlv::ErrorContainer::new(StepNumber::FinishRes as u8, err)),\n                },\n            }\n        }\n        .boxed()\n    }\n}\n\nasync fn handle_start(\n    handler: &mut PairVerify,\n    config: pointer::Config,\n    a_pub_bytes: Vec<u8>,\n) -> Result<tlv::Container, tlv::Error> {\n    info!(\"pair verify M1: received verify start request\");\n\n    let mut a_pub = [0; 32];\n    let bytes = &a_pub_bytes[..a_pub.len()]; // panics if not enough data\n    a_pub.copy_from_slice(bytes);\n    let a_pub = PublicKey::from(a_pub);\n\n    let mut csprng = OsRng {};\n    let b = EphemeralSecret::new(&mut csprng);\n    let b_pub = PublicKey::from(&b);\n    let shared_secret = b.diffie_hellman(&a_pub);\n\n    let config = config.lock().await;\n    let device_id = config.device_id.to_string();\n\n    let mut accessory_info: Vec<u8> = Vec::new();\n    accessory_info.extend(b_pub.as_bytes());\n    accessory_info.extend(device_id.as_bytes());\n    accessory_info.extend(a_pub.as_bytes());\n    let accessory_signature = config.device_ed25519_keypair.sign(&accessory_info);\n\n    drop(config);\n\n    let encoded_sub_tlv = vec![\n        Value::Identifier(device_id),\n        Value::Signature(accessory_signature.to_bytes().to_vec()),\n    ]\n    .encode();\n\n    let session_key = hkdf_extract_and_expand(\n        b\"Pair-Verify-Encrypt-Salt\",\n        shared_secret.as_bytes(),\n        b\"Pair-Verify-Encrypt-Info\",\n    )?;\n\n    handler.session = Some(Session {\n        b_pub,\n        a_pub,\n        shared_secret: *shared_secret.as_bytes(),\n        session_key,\n    });\n\n    let mut nonce = vec![0; 4];\n    nonce.extend(b\"PV-Msg02\");\n\n    let aead = ChaCha20Poly1305::new(GenericArray::from_slice(&session_key));\n\n    let mut encrypted_data = Vec::new();\n    encrypted_data.extend_from_slice(&encoded_sub_tlv);\n    let auth_tag = aead.encrypt_in_place_detached(GenericArray::from_slice(&nonce), &[], &mut encrypted_data)?;\n    encrypted_data.extend(&auth_tag);\n\n    info!(\"pair verify M2: sending verify start response\");\n\n    Ok(vec![\n        Value::State(StepNumber::StartRes as u8),\n        Value::PublicKey(b_pub.as_bytes().to_vec()),\n        Value::EncryptedData(encrypted_data),\n    ])\n}\n\nasync fn handle_finish(\n    handler: &mut PairVerify,\n    storage: pointer::Storage,\n    data: &[u8],\n) -> Result<tlv::Container, tlv::Error> {\n    info!(\"pair verify M3: received verify finish request\");\n\n    match handler.session {\n        None => Err(tlv::Error::Unknown),\n        Some(ref mut session) => {\n            let encrypted_data = Vec::from(&data[..data.len() - 16]);\n            let auth_tag = Vec::from(&data[data.len() - 16..]);\n\n            let mut nonce = vec![0; 4];\n            nonce.extend(b\"PV-Msg03\");\n\n            let aead = ChaCha20Poly1305::new(GenericArray::from_slice(&session.session_key));\n\n            let mut decrypted_data = Vec::new();\n            decrypted_data.extend_from_slice(&encrypted_data);\n            aead.decrypt_in_place_detached(\n                GenericArray::from_slice(&nonce),\n                &[],\n                &mut decrypted_data,\n                GenericArray::from_slice(&auth_tag),\n            )?;\n\n            let sub_tlv = tlv::decode(&decrypted_data);\n            debug!(\"received sub-TLV: {:?}\", &sub_tlv);\n            let device_pairing_id = sub_tlv.get(&(Type::Identifier as u8)).ok_or(tlv::Error::Unknown)?;\n            debug!(\"raw device pairing ID: {:?}\", &device_pairing_id);\n            let device_signature = ed25519_dalek::Signature::from_bytes(\n                sub_tlv.get(&(Type::Signature as u8)).ok_or(tlv::Error::Unknown)?,\n            )?;\n            debug!(\"device signature: {:?}\", &device_signature);\n\n            let uuid_str = str::from_utf8(device_pairing_id)?;\n            let pairing_uuid = Uuid::parse_str(uuid_str)?;\n            debug!(\"device pairing UUID: {:?}\", &pairing_uuid);\n            let pairing = storage.lock().await.load_pairing(&pairing_uuid).await?;\n            debug!(\"loaded pairing: {:?}\", &pairing);\n\n            let mut device_info: Vec<u8> = Vec::new();\n            device_info.extend(session.a_pub.as_bytes());\n            device_info.extend(device_pairing_id);\n            device_info.extend(session.b_pub.as_bytes());\n\n            if ed25519_dalek::PublicKey::from_bytes(&pairing.public_key)?\n                .verify(&device_info, &device_signature)\n                .is_err()\n            {\n                return Err(tlv::Error::Authentication);\n            }\n\n            if let Some(sender) = handler.session_sender.take() {\n                let encrypted_session = tcp::Session {\n                    controller_id: pairing_uuid,\n                    shared_secret: session.shared_secret,\n                };\n                let _session = sender.send(encrypted_session);\n            } else {\n                return Err(tlv::Error::Unknown);\n            }\n\n            info!(\"pair verify M4: sending verify finish response\");\n\n            Ok(vec![Value::State(StepNumber::FinishRes as u8)])\n        },\n    }\n}\n"
  },
  {
    "path": "src/transport/http/handler/pairings.rs",
    "content": "use futures::future::{BoxFuture, FutureExt};\nuse hyper::{body::Buf, Body};\nuse log::{debug, info};\nuse std::{ops::Deref, str};\nuse uuid::Uuid;\n\nuse crate::{\n    event::Event,\n    pairing::{Pairing, Permissions},\n    pointer,\n    tlv::{self, Type, Value},\n    transport::http::handler::TlvHandlerExt,\n};\n\npub struct Pairings;\n\nimpl Pairings {\n    pub fn new() -> Pairings { Pairings }\n}\n\n#[derive(Debug, Clone)]\nenum StepNumber {\n    Unknown = 0,\n    Res = 2,\n}\n\n#[derive(Debug, Clone)]\nenum HandlerNumber {\n    Add = 3,\n    Remove = 4,\n    List = 5,\n}\n\npub enum HandlerType {\n    Add {\n        pairing_id: Vec<u8>,\n        ltpk: Vec<u8>,\n        permissions: Permissions,\n    },\n    Remove {\n        pairing_id: Vec<u8>,\n    },\n    List,\n}\n\nimpl TlvHandlerExt for Pairings {\n    type ParseResult = HandlerType;\n    type Result = tlv::Container;\n\n    fn parse(&self, body: Body) -> BoxFuture<Result<HandlerType, tlv::ErrorContainer>> {\n        async {\n            let aggregated_body = hyper::body::aggregate(body)\n                .await\n                .map_err(|_| tlv::ErrorContainer::new(StepNumber::Unknown as u8, tlv::Error::Unknown))?;\n\n            debug!(\"received body: {:?}\", aggregated_body.chunk());\n\n            let mut decoded = tlv::decode(aggregated_body.chunk());\n            if decoded.get(&(Type::State as u8)) != Some(&vec![1]) {\n                return Err(tlv::ErrorContainer::new(0, tlv::Error::Unknown));\n            }\n            match decoded.get(&(Type::Method as u8)) {\n                Some(handler) => match handler[0] {\n                    x if x == HandlerNumber::Add as u8 => {\n                        let pairing_id = decoded\n                            .remove(&(Type::Identifier as u8))\n                            .ok_or(tlv::ErrorContainer::new(StepNumber::Res as u8, tlv::Error::Unknown))?;\n                        let ltpk = decoded\n                            .remove(&(Type::PublicKey as u8))\n                            .ok_or(tlv::ErrorContainer::new(StepNumber::Res as u8, tlv::Error::Unknown))?;\n                        let perms = decoded\n                            .remove(&(Type::Permissions as u8))\n                            .ok_or(tlv::ErrorContainer::new(StepNumber::Res as u8, tlv::Error::Unknown))?;\n                        let permissions = Permissions::from_byte(perms[0])\n                            .map_err(|_| tlv::ErrorContainer::new(StepNumber::Res as u8, tlv::Error::Unknown))?;\n                        Ok(HandlerType::Add {\n                            pairing_id,\n                            ltpk,\n                            permissions,\n                        })\n                    },\n                    x if x == HandlerNumber::Remove as u8 => {\n                        let pairing_id = decoded\n                            .remove(&(Type::Identifier as u8))\n                            .ok_or(tlv::ErrorContainer::new(StepNumber::Res as u8, tlv::Error::Unknown))?;\n                        Ok(HandlerType::Remove { pairing_id })\n                    },\n                    x if x == HandlerNumber::List as u8 => Ok(HandlerType::List),\n                    _ => Err(tlv::ErrorContainer::new(StepNumber::Unknown as u8, tlv::Error::Unknown)),\n                },\n                None => Err(tlv::ErrorContainer::new(StepNumber::Unknown as u8, tlv::Error::Unknown)),\n            }\n        }\n        .boxed()\n    }\n\n    fn handle(\n        &mut self,\n        handler: HandlerType,\n        controller_id: pointer::ControllerId,\n        config: pointer::Config,\n        storage: pointer::Storage,\n        event_emitter: pointer::EventEmitter,\n    ) -> BoxFuture<Result<tlv::Container, tlv::ErrorContainer>> {\n        async move {\n            match handler {\n                HandlerType::Add {\n                    pairing_id,\n                    ltpk,\n                    permissions,\n                } => match handle_add(\n                    controller_id,\n                    config,\n                    storage,\n                    event_emitter,\n                    pairing_id,\n                    ltpk,\n                    permissions,\n                )\n                .await\n                {\n                    Ok(res) => Ok(res),\n                    Err(err) => Err(tlv::ErrorContainer::new(StepNumber::Res as u8, err)),\n                },\n                HandlerType::Remove { pairing_id } => {\n                    match handle_remove(controller_id, storage, event_emitter, pairing_id).await {\n                        Ok(res) => Ok(res),\n                        Err(err) => Err(tlv::ErrorContainer::new(StepNumber::Res as u8, err)),\n                    }\n                },\n                HandlerType::List => match handle_list(controller_id, storage).await {\n                    Ok(res) => Ok(res),\n                    Err(err) => Err(tlv::ErrorContainer::new(StepNumber::Res as u8, err)),\n                },\n            }\n        }\n        .boxed()\n    }\n}\n\nasync fn handle_add(\n    controller_id: pointer::ControllerId,\n    config: pointer::Config,\n    storage: pointer::Storage,\n    event_emitter: pointer::EventEmitter,\n    pairing_id: Vec<u8>,\n    ltpk: Vec<u8>,\n    permissions: Permissions,\n) -> Result<tlv::Container, tlv::Error> {\n    info!(\"pairings M1: received add pairing request\");\n\n    check_admin(&controller_id, &storage).await?;\n\n    let uuid_str = str::from_utf8(&pairing_id)?;\n    let pairing_uuid = Uuid::parse_str(uuid_str)?;\n\n    let mut s = storage.lock().await;\n    match s.load_pairing(&pairing_uuid).await {\n        Ok(mut pairing) => {\n            if ed25519_dalek::PublicKey::from_bytes(&pairing.public_key)?\n                != ed25519_dalek::PublicKey::from_bytes(&ltpk)?\n            {\n                return Err(tlv::Error::Unknown);\n            }\n            pairing.permissions = permissions;\n            s.save_pairing(&pairing).await?;\n\n            drop(s);\n\n            event_emitter\n                .lock()\n                .await\n                .emit(&Event::ControllerPaired { id: pairing.id })\n                .await;\n        },\n        Err(_) => {\n            if let Some(max_peers) = config.lock().await.max_peers {\n                if s.count_pairings().await? + 1 > max_peers {\n                    return Err(tlv::Error::MaxPeers);\n                }\n            }\n\n            let mut public_key = [0; 32];\n            public_key.clone_from_slice(&ltpk);\n            let pairing = Pairing {\n                id: pairing_uuid,\n                permissions,\n                public_key,\n            };\n            s.save_pairing(&pairing).await?;\n\n            drop(s);\n\n            event_emitter\n                .lock()\n                .await\n                .emit(&Event::ControllerPaired { id: pairing.id })\n                .await;\n        },\n    }\n\n    info!(\"pairings M2: sending add pairing response\");\n\n    Ok(vec![Value::State(StepNumber::Res as u8)])\n}\n\nasync fn handle_remove(\n    controller_id: pointer::ControllerId,\n    storage: pointer::Storage,\n    event_emitter: pointer::EventEmitter,\n    pairing_id: Vec<u8>,\n) -> Result<tlv::Container, tlv::Error> {\n    info!(\"pairings M1: received remove pairing request\");\n\n    check_admin(&controller_id, &storage).await?;\n\n    let uuid_str = str::from_utf8(&pairing_id)?;\n    let pairing_uuid = Uuid::parse_str(uuid_str)?;\n    storage.lock().await.delete_pairing(&pairing_uuid).await?;\n\n    event_emitter\n        .lock()\n        .await\n        .emit(&Event::ControllerUnpaired { id: pairing_uuid })\n        .await;\n\n    info!(\"pairings M2: sending remove pairing response\");\n\n    Ok(vec![Value::State(StepNumber::Res as u8)])\n}\n\nasync fn handle_list(\n    controller_id: pointer::ControllerId,\n    storage: pointer::Storage,\n) -> Result<tlv::Container, tlv::Error> {\n    info!(\"pairings M1: received list pairings request\");\n\n    check_admin(&controller_id, &storage).await?;\n\n    let pairings = storage.lock().await.list_pairings().await?;\n    let mut list = vec![Value::State(StepNumber::Res as u8)];\n    for (i, pairing) in pairings.iter().enumerate() {\n        list.push(Value::Identifier(pairing.id.to_hyphenated().to_string()));\n        list.push(Value::PublicKey(pairing.public_key.to_vec()));\n        list.push(Value::Permissions(pairing.permissions.clone()));\n        if i < pairings.len() {\n            list.push(Value::Separator);\n        }\n    }\n\n    info!(\"pairings M2: sending list pairings response\");\n\n    Ok(list)\n}\n\nasync fn check_admin(controller_id: &pointer::ControllerId, storage: &pointer::Storage) -> Result<(), tlv::Error> {\n    let controller_id: Uuid = controller_id\n        .read()\n        .unwrap()\n        .deref()\n        .ok_or(tlv::Error::Authentication)?;\n    match storage.lock().await.load_pairing(&controller_id).await {\n        Err(_) => Err(tlv::Error::Authentication),\n        Ok(controller) => match controller.permissions {\n            Permissions::Admin => Ok(()),\n            _ => Err(tlv::Error::Authentication),\n        },\n    }\n}\n"
  },
  {
    "path": "src/transport/http/mod.rs",
    "content": "use hyper::{\n    header::{CONTENT_LENGTH, CONTENT_TYPE},\n    Body,\n    Response,\n    StatusCode,\n};\nuse serde::{Deserialize, Serialize};\n\nuse crate::{\n    characteristic::{Format, Perm, Unit},\n    Error,\n    HapType,\n    Result,\n};\n\nmod handler;\n\npub(crate) mod server;\n\n#[allow(dead_code)]\n#[derive(Debug)]\npub enum Status {\n    Success = 0,\n    InsufficientPrivileges = -70401,\n    ServiceCommunicationFailure = -70402,\n    ResourceBusy = -70403,\n    ReadOnlyCharacteristic = -70404,\n    WriteOnlyCharacteristic = -70405,\n    NotificationNotSupported = -70406,\n    OutOfResource = -70407,\n    OperationTimedOut = -70408,\n    ResourceDoesNotExist = -70409,\n    InvalidValueInRequest = -70410,\n}\n\n#[derive(Debug)]\nenum ContentType {\n    PairingTLV8,\n    HapJson,\n}\n\nimpl ContentType {\n    pub fn to_string(self) -> String {\n        match self {\n            ContentType::PairingTLV8 => \"application/pairing+tlv8\".into(),\n            ContentType::HapJson => \"application/hap+json\".into(),\n        }\n    }\n}\n\n#[derive(Debug, Serialize, Deserialize)]\npub struct CharacteristicResponseBody<T> {\n    characteristics: Vec<T>,\n}\n\n#[derive(Debug, Default, Serialize)]\npub struct ReadResponseObject {\n    pub iid: u64,\n    pub aid: u64,\n    #[serde(rename = \"type\", skip_serializing_if = \"Option::is_none\")]\n    pub hap_type: Option<HapType>,\n    #[serde(skip_serializing_if = \"Option::is_none\")]\n    pub format: Option<Format>,\n    #[serde(skip_serializing_if = \"Option::is_none\")]\n    pub perms: Option<Vec<Perm>>,\n    #[serde(skip_serializing_if = \"Option::is_none\")]\n    pub ev: Option<bool>,\n    #[serde(skip_serializing_if = \"Option::is_none\")]\n    pub value: Option<serde_json::Value>,\n    #[serde(skip_serializing_if = \"Option::is_none\")]\n    pub unit: Option<Unit>,\n    #[serde(rename = \"maxValue\", skip_serializing_if = \"Option::is_none\")]\n    pub max_value: Option<serde_json::Value>,\n    #[serde(rename = \"minValue\", skip_serializing_if = \"Option::is_none\")]\n    pub min_value: Option<serde_json::Value>,\n    #[serde(rename = \"minStep\", skip_serializing_if = \"Option::is_none\")]\n    pub step_value: Option<serde_json::Value>,\n    #[serde(rename = \"maxLen\", skip_serializing_if = \"Option::is_none\")]\n    pub max_len: Option<u16>,\n    #[serde(skip_serializing_if = \"Option::is_none\")]\n    pub status: Option<i32>,\n}\n\n#[derive(Debug, Deserialize)]\npub struct WriteObject {\n    pub iid: u64,\n    pub aid: u64,\n    pub ev: Option<bool>,\n    pub value: Option<serde_json::Value>,\n    #[serde(rename = \"authData\")]\n    pub auth_data: Option<String>,\n    pub remote: Option<bool>,\n}\n\n#[derive(Debug, Serialize)]\npub struct WriteResponseObject {\n    pub iid: u64,\n    pub aid: u64,\n    pub status: i32,\n}\n\n#[derive(Debug, Serialize)]\npub struct EventObject {\n    pub iid: u64,\n    pub aid: u64,\n    pub value: serde_json::Value,\n}\n\npub fn tlv_response(body: Vec<u8>, status: StatusCode) -> Result<Response<Body>> {\n    response(body, status, ContentType::PairingTLV8)\n}\n\npub fn json_response(body: Vec<u8>, status: StatusCode) -> Result<Response<Body>> {\n    response(body, status, ContentType::HapJson)\n}\n\npub fn status_response(status: StatusCode) -> Result<Response<Body>> {\n    Response::builder()\n        .status(status)\n        .body(Body::empty())\n        .map_err(Error::from)\n}\n\npub fn event_response(event_objects: Vec<EventObject>) -> Result<Vec<u8>> {\n    let body = serde_json::to_string(&CharacteristicResponseBody {\n        characteristics: event_objects,\n    })?;\n    let response = format!(\n        \"EVENT/1.0 200 OK\\nContent-Type: {}\\nContent-Length: {}\\n\\n{}\",\n        ContentType::HapJson.to_string(),\n        body.len(),\n        body,\n    );\n    Ok(response.as_bytes().to_vec())\n}\n\nfn response(body: Vec<u8>, status: StatusCode, content_type: ContentType) -> Result<Response<Body>> {\n    Response::builder()\n        .status(status)\n        .header(CONTENT_TYPE, content_type.to_string())\n        .header(CONTENT_LENGTH, body.len() as u64)\n        .body(body.into())\n        .map_err(Error::from)\n}\n"
  },
  {
    "path": "src/transport/http/server.rs",
    "content": "use futures::{\n    channel::oneshot,\n    future::{self, BoxFuture, Future, FutureExt, TryFutureExt},\n    lock::Mutex,\n};\nuse hyper::{server::conn::Http, service::Service, Body, Method, Request, Response, StatusCode};\nuse log::{debug, error, info};\nuse std::{\n    net::SocketAddr,\n    pin::Pin,\n    sync::Arc,\n    task::{Context, Poll},\n};\nuse tokio::net::TcpListener;\n\nuse crate::{\n    event::Event,\n    pointer,\n    transport::{\n        http::{\n            event_response,\n            handler::{\n                accessories::Accessories,\n                characteristics::{GetCharacteristics, UpdateCharacteristics},\n                identify::Identify,\n                pair_setup::PairSetup,\n                pair_verify::PairVerify,\n                pairings::Pairings,\n                HandlerExt,\n                JsonHandler,\n                TlvHandler,\n            },\n            status_response,\n            EventObject,\n        },\n        tcp::{EncryptedStream, Session, StreamWrapper},\n    },\n    Error,\n    Result,\n};\n\nstruct Handlers {\n    pub pair_setup: Arc<Mutex<Box<dyn HandlerExt + Send + Sync>>>,\n    pub pair_verify: Arc<Mutex<Box<dyn HandlerExt + Send + Sync>>>,\n    pub accessories: Arc<Mutex<Box<dyn HandlerExt + Send + Sync>>>,\n    pub get_characteristics: Arc<Mutex<Box<dyn HandlerExt + Send + Sync>>>,\n    pub put_characteristics: Arc<Mutex<Box<dyn HandlerExt + Send + Sync>>>,\n    pub pairings: Arc<Mutex<Box<dyn HandlerExt + Send + Sync>>>,\n    pub identify: Arc<Mutex<Box<dyn HandlerExt + Send + Sync>>>,\n}\n\nstruct Api {\n    controller_id: pointer::ControllerId,\n    event_subscriptions: pointer::EventSubscriptions,\n    config: pointer::Config,\n    storage: pointer::Storage,\n    accessory_database: pointer::AccessoryDatabase,\n    event_emitter: pointer::EventEmitter,\n    handlers: Handlers,\n}\n\nimpl Api {\n    fn new(\n        controller_id: pointer::ControllerId,\n        event_subscriptions: pointer::EventSubscriptions,\n        config: pointer::Config,\n        storage: pointer::Storage,\n        accessory_database: pointer::AccessoryDatabase,\n        event_emitter: pointer::EventEmitter,\n        session_sender: oneshot::Sender<Session>,\n    ) -> Self {\n        Api {\n            controller_id,\n            event_subscriptions,\n            config,\n            storage,\n            accessory_database,\n            event_emitter,\n            handlers: Handlers {\n                pair_setup: Arc::new(Mutex::new(Box::new(TlvHandler::from(PairSetup::new())))),\n                pair_verify: Arc::new(Mutex::new(Box::new(TlvHandler::from(PairVerify::new(session_sender))))),\n                accessories: Arc::new(Mutex::new(Box::new(JsonHandler::from(Accessories::new())))),\n                get_characteristics: Arc::new(Mutex::new(Box::new(JsonHandler::from(GetCharacteristics::new())))),\n                put_characteristics: Arc::new(Mutex::new(Box::new(JsonHandler::from(UpdateCharacteristics::new())))),\n                pairings: Arc::new(Mutex::new(Box::new(TlvHandler::from(Pairings::new())))),\n                identify: Arc::new(Mutex::new(Box::new(JsonHandler::from(Identify::new())))),\n            },\n        }\n    }\n}\n\nimpl Service<Request<Body>> for Api {\n    type Error = Error;\n    type Future = Pin<Box<dyn Future<Output = std::result::Result<Self::Response, Self::Error>> + Send>>;\n    type Response = Response<Body>;\n\n    fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<std::result::Result<(), Self::Error>> {\n        Poll::Ready(Ok(()))\n    }\n\n    fn call(&mut self, req: Request<Body>) -> Self::Future {\n        let (parts, body) = req.into_parts();\n        let method = parts.method;\n        let uri = parts.uri;\n\n        let mut handler: Option<Arc<Mutex<Box<dyn HandlerExt + Send + Sync>>>> = match (method, uri.path()) {\n            (Method::POST, \"/pair-setup\") => Some(self.handlers.pair_setup.clone()),\n            (Method::POST, \"/pair-verify\") => Some(self.handlers.pair_verify.clone()),\n            (Method::GET, \"/accessories\") => Some(self.handlers.accessories.clone()),\n            (Method::GET, \"/characteristics\") => Some(self.handlers.get_characteristics.clone()),\n            (Method::PUT, \"/characteristics\") => Some(self.handlers.put_characteristics.clone()),\n            (Method::POST, \"/pairings\") => Some(self.handlers.pairings.clone()),\n            (Method::POST, \"/identify\") => Some(self.handlers.identify.clone()),\n            _ => None,\n        };\n\n        let controller_id = self.controller_id.clone();\n        let event_subscriptions = self.event_subscriptions.clone();\n        let config = self.config.clone();\n        let storage = self.storage.clone();\n        let accessory_database = self.accessory_database.clone();\n        let event_emitter = self.event_emitter.clone();\n\n        let fut = async move {\n            match handler.take() {\n                Some(handler) =>\n                    handler\n                        .lock()\n                        .await\n                        .handle(\n                            uri,\n                            body,\n                            controller_id,\n                            event_subscriptions,\n                            config,\n                            storage,\n                            accessory_database,\n                            event_emitter,\n                        )\n                        .await,\n                None => future::ready(status_response(StatusCode::NOT_FOUND)).await,\n            }\n        }\n        .boxed();\n\n        fut\n    }\n}\n\n#[derive(Clone)]\npub struct Server {\n    config: pointer::Config,\n    storage: pointer::Storage,\n    accessory_database: pointer::AccessoryDatabase,\n    event_emitter: pointer::EventEmitter,\n    mdns_responder: pointer::MdnsResponder,\n}\n\nimpl Server {\n    pub fn new(\n        config: pointer::Config,\n        storage: pointer::Storage,\n        accessory_database: pointer::AccessoryDatabase,\n        event_emitter: pointer::EventEmitter,\n        mdns_responder: pointer::MdnsResponder,\n    ) -> Self {\n        Server {\n            config,\n            storage,\n            accessory_database,\n            event_emitter,\n            mdns_responder,\n        }\n    }\n\n    pub fn run_handle(&self) -> BoxFuture<Result<()>> {\n        let config = self.config.clone();\n        let storage = self.storage.clone();\n        let accessory_database = self.accessory_database.clone();\n        let event_emitter = self.event_emitter.clone();\n        let mdns_responder = self.mdns_responder.clone();\n\n        async move {\n            let config_lock = config.lock().await;\n            let socket_addr = SocketAddr::new(config_lock.host, config_lock.port);\n            drop(config_lock);\n\n            info!(\"binding TCP listener on {}\", &socket_addr);\n            let listener = TcpListener::bind(socket_addr).await?;\n\n            mdns_responder.lock().await.update_records().await;\n\n            loop {\n                let (stream, _socket_addr) = listener.accept().await?;\n\n                debug!(\"incoming TCP stream from {}\", stream.peer_addr()?);\n\n                let (\n                    encrypted_stream,\n                    stream_incoming,\n                    stream_outgoing,\n                    session_sender,\n                    incoming_waker,\n                    outgoing_waker,\n                ) = EncryptedStream::new(stream);\n                let stream_wrapper =\n                    StreamWrapper::new(stream_incoming, stream_outgoing.clone(), incoming_waker, outgoing_waker);\n                let event_subscriptions = Arc::new(Mutex::new(vec![]));\n\n                let api = Api::new(\n                    encrypted_stream.controller_id.clone(),\n                    event_subscriptions.clone(),\n                    config.clone(),\n                    storage.clone(),\n                    accessory_database.clone(),\n                    event_emitter.clone(),\n                    session_sender,\n                );\n\n                event_emitter.lock().await.add_listener(Box::new(move |event| {\n                    let event_subscriptions_ = event_subscriptions.clone();\n                    let stream_outgoing_ = stream_outgoing.clone();\n                    async move {\n                        match *event {\n                            Event::CharacteristicValueChanged { aid, iid, ref value } => {\n                                let mut dropped_subscriptions = vec![];\n                                for (i, &(s_aid, s_iid)) in event_subscriptions_.lock().await.iter().enumerate() {\n                                    if s_aid == aid && s_iid == iid {\n                                        let event = EventObject {\n                                            aid,\n                                            iid,\n                                            value: value.clone(),\n                                        };\n                                        let event_res =\n                                            event_response(vec![event]).expect(\"couldn't create event response\");\n                                        if stream_outgoing_.unbounded_send(event_res).is_err() {\n                                            dropped_subscriptions.push(i);\n                                        }\n                                    }\n                                }\n                                let mut ev = event_subscriptions_.lock().await;\n                                for s in dropped_subscriptions {\n                                    ev.remove(s);\n                                }\n                            },\n                            _ => {},\n                        }\n                    }\n                    .boxed()\n                }));\n\n                let mut http = Http::new();\n                http.http1_only(true);\n                http.http1_half_close(true);\n                http.http1_keep_alive(true);\n                http.http1_preserve_header_case(true);\n\n                tokio::spawn(encrypted_stream.map_err(|e| error!(\"{:?}\", e)).map(|_| ()));\n                tokio::spawn(\n                    http.serve_connection(stream_wrapper, api)\n                        .map_err(|e| error!(\"{:?}\", e))\n                        .map(|_| ()),\n                );\n            }\n\n            #[allow(unreachable_code)]\n            Ok(())\n        }\n        .boxed()\n    }\n}\n"
  },
  {
    "path": "src/transport/mdns.rs",
    "content": "use libmdns::{Responder, Service};\nuse log::debug;\n\nuse crate::pointer;\n\n/// An mDNS Responder. Used to announce the Accessory's name and HAP TXT records to potential controllers.\npub struct MdnsResponder {\n    config: pointer::Config,\n    responder: Responder,\n    service: Option<Service>,\n    task: Option<Box<dyn futures::Future<Output = ()> + Unpin + std::marker::Send>>,\n}\n\nimpl MdnsResponder {\n    /// Creates a new mDNS Responder.\n    pub async fn new(config: pointer::Config) -> Self {\n        let (responder, task) = libmdns::Responder::with_default_handle().expect(\"creating mDNS responder\");\n\n        MdnsResponder {\n            config,\n            responder,\n            service: None,\n            task: Some(task),\n        }\n    }\n\n    /// Derives new mDNS TXT records from the server's `Config`.\n    pub async fn update_records(&mut self) {\n        debug!(\"attempting to set mDNS records\");\n\n        self.service = None;\n\n        let c = self.config.lock().await;\n\n        let name = c.name.clone();\n        let port = c.port;\n        let tr = c.txt_records();\n\n        drop(c);\n\n        self.service = Some(self.responder.register(\"_hap._tcp\".into(), name, port, &[\n            &tr[0], &tr[1], &tr[2], &tr[3], &tr[4], &tr[5], &tr[6], &tr[7],\n        ]));\n\n        debug!(\"setting mDNS records: {:?}\", &tr);\n    }\n\n    /// Returns the mDNS task to throw on a scheduler.\n    pub fn run_handle(&mut self) -> Box<dyn futures::Future<Output = ()> + Unpin + std::marker::Send> {\n        match self.task.take() {\n            Some(task) => task,\n            // if the task handle is gone, recreate the whole responder\n            None => {\n                let (responder, task) = libmdns::Responder::with_default_handle().expect(\"creating mDNS responder\");\n                self.responder = responder;\n\n                task\n            },\n        }\n    }\n}\n"
  },
  {
    "path": "src/transport/mod.rs",
    "content": "use hkdf::Hkdf;\nuse sha2::Sha512;\n\nuse crate::{Error, Result};\n\npub(crate) mod bonjour;\npub(crate) mod http;\npub(crate) mod mdns;\npub(crate) mod tcp;\n\npub(crate) fn hkdf_extract_and_expand(salt: &[u8], ikm: &[u8], info: &[u8]) -> Result<[u8; 32]> {\n    let mut okm = [0u8; 32];\n\n    Hkdf::<Sha512>::new(Some(salt), ikm)\n        .expand(info, &mut okm)\n        .or(Err(Error::HkdfInvalidLength))?;\n\n    Ok(okm)\n}\n"
  },
  {
    "path": "src/transport/tcp.rs",
    "content": "use aead::{generic_array::GenericArray, AeadInPlace, NewAead};\nuse byteorder::{ByteOrder, LittleEndian};\nuse bytes::{Buf, BytesMut};\nuse chacha20poly1305::{ChaCha20Poly1305, Nonce, Tag};\nuse futures::{\n    channel::{\n        mpsc::{self, UnboundedReceiver, UnboundedSender},\n        oneshot,\n    },\n    io::Error,\n    Stream,\n};\nuse log::{debug, error};\nuse std::{\n    cmp::min,\n    future::Future,\n    io::{self, ErrorKind},\n    pin::Pin,\n    sync::{Arc, Mutex, RwLock},\n    task::{Context, Poll, Waker},\n};\nuse tokio::{\n    io::{AsyncRead, AsyncWrite, ReadBuf},\n    net::TcpStream,\n};\nuse uuid::Uuid;\n\nuse crate::Result;\n\n#[derive(Debug)]\npub struct StreamWrapper {\n    incoming_receiver: UnboundedReceiver<Vec<u8>>,\n    outgoing_sender: UnboundedSender<Vec<u8>>,\n    incoming_waker: Arc<Mutex<Option<Waker>>>,\n    outgoing_waker: Arc<Mutex<Option<Waker>>>,\n    incoming_buf: BytesMut,\n}\n\nimpl StreamWrapper {\n    pub fn new(\n        incoming_receiver: UnboundedReceiver<Vec<u8>>,\n        outgoing_sender: UnboundedSender<Vec<u8>>,\n        incoming_waker: Arc<Mutex<Option<Waker>>>,\n        outgoing_waker: Arc<Mutex<Option<Waker>>>,\n    ) -> StreamWrapper {\n        StreamWrapper {\n            incoming_receiver,\n            outgoing_sender,\n            incoming_waker,\n            outgoing_waker,\n            incoming_buf: BytesMut::new(),\n        }\n    }\n\n    fn poll_receiver(&mut self, cx: &mut Context) -> Poll<usize> {\n        debug!(\"polling incoming TCP stream receiver\");\n\n        match Stream::poll_next(Pin::new(&mut self.incoming_receiver), cx) {\n            Poll::Pending => Poll::Pending,\n            Poll::Ready(Some(incoming)) => {\n                let r_len = incoming.len();\n                self.incoming_buf.extend_from_slice(&incoming);\n\n                debug!(\"received {} Bytes on incoming TCP stream receiver\", &r_len);\n\n                Poll::Ready(r_len)\n            },\n            Poll::Ready(None) => {\n                debug!(\"received 0 Bytes on incoming TCP stream receiver\");\n                Poll::Ready(0)\n            },\n        }\n    }\n}\n\nimpl AsyncRead for StreamWrapper {\n    fn poll_read(\n        self: Pin<&mut Self>,\n        cx: &mut Context,\n        buf: &mut ReadBuf,\n    ) -> Poll<std::result::Result<(), io::Error>> {\n        let stream_wrapper = Pin::into_inner(self);\n\n        match stream_wrapper.poll_receiver(cx) {\n            Poll::Pending => Poll::Pending,\n            Poll::Ready(_r_len) => {\n                let r_len = min(buf.capacity(), stream_wrapper.incoming_buf.len());\n                buf.put_slice(&stream_wrapper.incoming_buf[..r_len]);\n                stream_wrapper.incoming_buf.advance(r_len);\n\n                if let Some(waker) = stream_wrapper\n                    .outgoing_waker\n                    .lock()\n                    .expect(\"accessing outgoing_waker\")\n                    .take()\n                {\n                    waker.wake()\n                }\n                if let Some(waker) = stream_wrapper\n                    .incoming_waker\n                    .lock()\n                    .expect(\"accessing incoming_waker\")\n                    .take()\n                {\n                    waker.wake()\n                }\n\n                Poll::Ready(Ok(()))\n            },\n        }\n    }\n}\n\nimpl AsyncWrite for StreamWrapper {\n    fn poll_write(self: Pin<&mut Self>, _cx: &mut Context, buf: &[u8]) -> Poll<std::result::Result<usize, io::Error>> {\n        let stream_wrapper = Pin::into_inner(self);\n\n        debug!(\"writing {} Bytes to outgoing TCP stream sender\", buf.len());\n\n        stream_wrapper\n            .outgoing_sender\n            .unbounded_send(buf.to_vec())\n            .map_err(|_| io::Error::new(io::ErrorKind::Other, \"couldn't write\"))?;\n\n        if let Some(waker) = stream_wrapper\n            .outgoing_waker\n            .lock()\n            .expect(\"accessing outgoing_waker\")\n            .take()\n        {\n            waker.wake()\n        }\n        if let Some(waker) = stream_wrapper\n            .incoming_waker\n            .lock()\n            .expect(\"accessing incoming_waker\")\n            .take()\n        {\n            waker.wake()\n        }\n\n        let w_len = buf.len();\n\n        debug!(\"wrote {} Bytes to outgoing TCP stream sender\", &w_len);\n\n        Poll::Ready(Ok(w_len))\n    }\n\n    fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context) -> Poll<std::result::Result<(), io::Error>> {\n        // let stream_wrapper = Pin::into_inner(self);\n        // Poll::Ready(Write::flush(stream_wrapper))\n        Poll::Ready(Ok(()))\n    }\n\n    fn poll_shutdown(self: Pin<&mut Self>, _cx: &mut Context) -> Poll<std::result::Result<(), io::Error>> {\n        Poll::Ready(Ok(()))\n    }\n}\n\n#[derive(Debug)]\npub struct Session {\n    pub controller_id: Uuid,\n    pub shared_secret: [u8; 32],\n}\n\n#[derive(Debug)]\npub struct EncryptedStream {\n    stream: TcpStream,\n    incoming_sender: UnboundedSender<Vec<u8>>,\n    outgoing_receiver: UnboundedReceiver<Vec<u8>>,\n    incoming_waker: Arc<Mutex<Option<Waker>>>,\n    outgoing_waker: Arc<Mutex<Option<Waker>>>,\n    session_receiver: oneshot::Receiver<Session>,\n    pub controller_id: Arc<RwLock<Option<Uuid>>>,\n    shared_secret: Option<[u8; 32]>,\n    decrypt_count: u64,\n    encrypt_count: u64,\n    encrypted_buf: BytesMut,\n    decrypted_buf: BytesMut,\n    encrypted_readbuf_inner: [u8; 1042],\n    packet_len: usize,\n    decrypted_ready: bool,\n    missing_data_for_decrypted_buf: bool,\n    missing_data_for_encrypted_buf: bool,\n}\n\nimpl EncryptedStream {\n    pub fn new(\n        stream: TcpStream,\n    ) -> (\n        EncryptedStream,\n        UnboundedReceiver<Vec<u8>>,\n        UnboundedSender<Vec<u8>>,\n        oneshot::Sender<Session>,\n        Arc<Mutex<Option<Waker>>>,\n        Arc<Mutex<Option<Waker>>>,\n    ) {\n        let (sender, receiver) = oneshot::channel();\n        let (incoming_sender, incoming_receiver) = mpsc::unbounded();\n        let (outgoing_sender, outgoing_receiver) = mpsc::unbounded();\n        let incoming_waker = Arc::new(Mutex::new(None));\n        let outgoing_waker = Arc::new(Mutex::new(None));\n        let encrypted_buf = BytesMut::with_capacity(1042);\n        let decrypted_buf = BytesMut::with_capacity(1024);\n\n        (\n            EncryptedStream {\n                stream,\n                incoming_sender,\n                outgoing_receiver,\n                incoming_waker: incoming_waker.clone(),\n                outgoing_waker: outgoing_waker.clone(),\n                session_receiver: receiver,\n                controller_id: Arc::new(RwLock::new(None)),\n                shared_secret: None,\n                decrypt_count: 0,\n                encrypt_count: 0,\n                encrypted_buf,\n                decrypted_buf,\n                encrypted_readbuf_inner: [0; 1042],\n                packet_len: 0,\n                decrypted_ready: false,\n                missing_data_for_decrypted_buf: false,\n                missing_data_for_encrypted_buf: false,\n            },\n            incoming_receiver,\n            outgoing_sender,\n            sender,\n            incoming_waker,\n            outgoing_waker,\n        )\n    }\n\n    fn read_decrypted(&mut self, buf: &mut ReadBuf) -> Poll<std::result::Result<(), io::Error>> {\n        debug!(\"reading from decrypted buffer\");\n\n        if self.decrypted_ready {\n            let r_len = min(buf.capacity(), self.packet_len - 16);\n\n            buf.put_slice(&self.decrypted_buf[..r_len]);\n\n            self.decrypted_buf.advance(r_len);\n\n            if r_len == self.packet_len - 16 {\n                self.decrypted_buf.clear();\n                self.decrypted_ready = false;\n            }\n\n            return Poll::Ready(Ok(()));\n        }\n\n        Poll::Pending\n    }\n\n    fn read_encrypted(&mut self, buf: &mut ReadBuf) -> Poll<std::result::Result<(), io::Error>> {\n        debug!(\"reading from encrypted buffer\");\n\n        if self.missing_data_for_decrypted_buf {\n            let decrypted = decrypt_chunk(\n                &self.shared_secret.expect(\"missing shared secret\"),\n                &self.encrypted_buf[..2],\n                &self.encrypted_buf[2..(self.packet_len - 14)],\n                &self.encrypted_buf[(self.packet_len - 14)..(self.packet_len + 2)],\n                &mut self.decrypt_count,\n            )\n            .map_err(|_| io::Error::new(io::ErrorKind::Other, \"decryption failed\"))?;\n\n            self.decrypted_buf.extend_from_slice(&decrypted);\n\n            self.encrypted_buf.advance(self.packet_len + 2);\n\n            self.missing_data_for_decrypted_buf = false;\n            self.decrypted_ready = true;\n\n            return self.read_decrypted(buf);\n        }\n\n        Poll::Pending\n    }\n\n    fn read_stream(&mut self, cx: &mut Context, buf: &mut ReadBuf) -> Poll<std::result::Result<(), io::Error>> {\n        debug!(\"reading from TCP stream\");\n\n        if self.missing_data_for_encrypted_buf {\n            let mut r_buf = ReadBuf::new(&mut self.encrypted_readbuf_inner);\n            let r = AsyncRead::poll_read(Pin::new(&mut self.stream), cx, &mut r_buf)?;\n\n            match r {\n                Poll::Pending => Poll::Pending,\n                Poll::Ready(()) => {\n                    self.encrypted_buf.extend_from_slice(r_buf.filled());\n\n                    if self.encrypted_buf.len() == self.packet_len + 2 {\n                        self.missing_data_for_encrypted_buf = false;\n                        self.missing_data_for_decrypted_buf = true;\n\n                        return self.read_encrypted(buf);\n                    }\n\n                    Poll::Pending\n                },\n            }\n        } else {\n            let mut r_buf = ReadBuf::new(&mut self.encrypted_readbuf_inner);\n            let r = AsyncRead::poll_read(Pin::new(&mut self.stream), cx, &mut r_buf)?;\n\n            match r {\n                Poll::Pending => Poll::Pending,\n                Poll::Ready(()) => {\n                    self.encrypted_buf.extend_from_slice(r_buf.filled());\n\n                    if self.encrypted_buf.len() >= 2 {\n                        self.packet_len = LittleEndian::read_u16(&self.encrypted_buf[..2]) as usize + 16;\n\n                        if self.encrypted_buf.len() == self.packet_len + 2 {\n                            self.missing_data_for_encrypted_buf = false;\n                            self.missing_data_for_decrypted_buf = true;\n\n                            self.read_encrypted(buf)\n                        } else {\n                            self.missing_data_for_encrypted_buf = true;\n\n                            Poll::Pending\n                        }\n                    } else {\n                        Poll::Pending\n                    }\n                },\n            }\n        }\n    }\n\n    fn poll_outgoing(self: Pin<&mut Self>, cx: &mut Context) -> Poll<std::result::Result<(), io::Error>> {\n        let encrypted_stream = Pin::into_inner(self);\n        loop {\n            match Stream::poll_next(Pin::new(&mut encrypted_stream.outgoing_receiver), cx) {\n                Poll::Pending => {\n                    *encrypted_stream.outgoing_waker.lock().expect(\"setting outgoing_waker\") = Some(cx.waker().clone());\n                    return Poll::Pending;\n                },\n                Poll::Ready(Some(data)) => {\n                    debug!(\"writing {} Bytes to outgoing TCP stream\", data.len());\n\n                    match AsyncWrite::poll_write(Pin::new(encrypted_stream), cx, &data) {\n                        Poll::Pending => {},\n                        Poll::Ready(Err(e)) => {\n                            error!(\"error writing to outgoing stream: {}\", e);\n                            return Poll::Ready(Err(e));\n                        },\n                        Poll::Ready(Ok(w_len)) => {\n                            debug!(\"wrote {} Bytes to outgoing TCP stream\", w_len);\n                        },\n                    };\n                },\n                Poll::Ready(None) => {\n                    debug!(\"outgoing TCP stream ended\");\n\n                    return Poll::Ready(Ok(()));\n                },\n            }\n        }\n    }\n\n    fn poll_incoming(self: Pin<&mut Self>, cx: &mut Context) -> Poll<std::result::Result<(), io::Error>> {\n        let encrypted_stream = Pin::into_inner(self);\n\n        let mut data_inner = [0; 1536];\n        let mut data = ReadBuf::new(&mut data_inner);\n\n        loop {\n            match AsyncRead::poll_read(Pin::new(encrypted_stream), cx, &mut data) {\n                Poll::Pending => {\n                    *encrypted_stream.incoming_waker.lock().expect(\"setting incoming_waker\") = Some(cx.waker().clone());\n                    return Poll::Pending;\n                },\n                Poll::Ready(Err(e)) => match e.kind() {\n                    ErrorKind::WouldBlock => {\n                        *encrypted_stream.incoming_waker.lock().expect(\"setting incoming_waker\") =\n                            Some(cx.waker().clone());\n                        return Poll::Pending;\n                    },\n                    _ => {\n                        return Poll::Ready(Err(e));\n                    },\n                },\n                Poll::Ready(Ok(())) => {\n                    let data_filled = data.filled();\n\n                    if data_filled.len() == 0 {\n                        return Poll::Ready(Ok(()));\n                    }\n\n                    encrypted_stream\n                        .incoming_sender\n                        .unbounded_send(data_filled.to_vec())\n                        .map_err(|_| io::Error::new(io::ErrorKind::Other, \"couldn't send incoming data\"))?;\n\n                    data.clear();\n                },\n            }\n        }\n    }\n}\n\nimpl Future for EncryptedStream {\n    type Output = std::result::Result<(), io::Error>;\n\n    #[allow(unused_must_use)]\n    fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {\n        let encrypted_stream = Pin::into_inner(self);\n        EncryptedStream::poll_outgoing(Pin::new(encrypted_stream), cx)?;\n        EncryptedStream::poll_incoming(Pin::new(encrypted_stream), cx)\n    }\n}\n\nimpl AsyncRead for EncryptedStream {\n    fn poll_read(\n        self: Pin<&mut Self>,\n        cx: &mut Context,\n        buf: &mut ReadBuf,\n    ) -> Poll<std::result::Result<(), io::Error>> {\n        let mut encrypted_stream = Pin::into_inner(self);\n\n        if encrypted_stream.shared_secret.is_none() {\n            match encrypted_stream.session_receiver.try_recv() {\n                Ok(Some(session)) => {\n                    *encrypted_stream.controller_id.write().expect(\"setting controller_id\") =\n                        Some(session.controller_id);\n                    encrypted_stream.shared_secret = Some(session.shared_secret);\n                },\n                _ => {\n                    return AsyncRead::poll_read(Pin::new(&mut encrypted_stream.stream), cx, buf);\n                },\n            }\n        }\n\n        match encrypted_stream.read_decrypted(buf) {\n            Poll::Ready(Ok(())) => Poll::Ready(Ok(())),\n            Poll::Ready(Err(e)) => Poll::Ready(Err(e)),\n            Poll::Pending => match encrypted_stream.read_encrypted(buf) {\n                Poll::Ready(Ok(_size)) => Poll::Ready(Ok(())),\n                Poll::Ready(Err(e)) => Poll::Ready(Err(e)),\n                Poll::Pending => encrypted_stream.read_stream(cx, buf),\n            },\n        }\n    }\n}\n\nimpl AsyncWrite for EncryptedStream {\n    #[allow(unused_must_use)]\n    fn poll_write(self: Pin<&mut Self>, cx: &mut Context, buf: &[u8]) -> Poll<std::result::Result<usize, Error>> {\n        let encrypted_stream = Pin::into_inner(self);\n\n        if let Some(shared_secret) = encrypted_stream.shared_secret {\n            let mut write_buf = BytesMut::from(buf);\n\n            while write_buf.len() > 1024 {\n                let (aad, chunk, auth_tag) =\n                    encrypt_chunk(&shared_secret, &write_buf[..1024], &mut encrypted_stream.encrypt_count)\n                        .map_err(|_| io::Error::new(io::ErrorKind::Other, \"encryption failed\"))?;\n\n                let data = [&aad[..], &chunk[..], &auth_tag[..]].concat();\n                AsyncWrite::poll_write(Pin::new(&mut encrypted_stream.stream), cx, &data)?;\n\n                write_buf.advance(1024);\n            }\n\n            let (aad, chunk, auth_tag) = encrypt_chunk(&shared_secret, &write_buf, &mut encrypted_stream.encrypt_count)\n                .map_err(|_| io::Error::new(io::ErrorKind::Other, \"encryption failed\"))?;\n\n            let data = [&aad[..], &chunk[..], &auth_tag[..]].concat();\n            AsyncWrite::poll_write(Pin::new(&mut encrypted_stream.stream), cx, &data)?;\n\n            Poll::Ready(Ok(buf.len()))\n        } else {\n            AsyncWrite::poll_write(Pin::new(&mut encrypted_stream.stream), cx, buf)\n        }\n    }\n\n    fn poll_flush(self: Pin<&mut Self>, cx: &mut Context) -> Poll<std::result::Result<(), Error>> {\n        let encrypted_stream = Pin::into_inner(self);\n        AsyncWrite::poll_flush(Pin::new(&mut encrypted_stream.stream), cx)\n    }\n\n    fn poll_shutdown(self: Pin<&mut Self>, _cx: &mut Context) -> Poll<std::result::Result<(), Error>> {\n        Poll::Ready(Ok(()))\n    }\n}\n\nfn decrypt_chunk(\n    shared_secret: &[u8; 32],\n    aad: &[u8],\n    data: &[u8],\n    auth_tag: &[u8],\n    count: &mut u64,\n) -> Result<Vec<u8>> {\n    let read_key = compute_read_key(shared_secret)?;\n    let aead = ChaCha20Poly1305::new(GenericArray::from_slice(&read_key));\n\n    let mut nonce = vec![0; 4];\n    let mut suffix = vec![0; 8];\n    LittleEndian::write_u64(&mut suffix, *count);\n    nonce.extend(suffix);\n    *count += 1;\n\n    let mut buffer = Vec::new();\n    buffer.extend_from_slice(data);\n    aead.decrypt_in_place_detached(Nonce::from_slice(&nonce), aad, &mut buffer, Tag::from_slice(&auth_tag))?;\n\n    Ok(buffer)\n}\n\nfn encrypt_chunk(shared_secret: &[u8; 32], data: &[u8], count: &mut u64) -> Result<([u8; 2], Vec<u8>, [u8; 16])> {\n    let write_key = compute_write_key(shared_secret)?;\n    let aead = ChaCha20Poly1305::new(GenericArray::from_slice(&write_key));\n\n    let mut nonce = vec![0; 4];\n    let mut suffix = vec![0; 8];\n    LittleEndian::write_u64(&mut suffix, *count);\n    nonce.extend(suffix);\n    *count += 1;\n\n    let mut aad = [0; 2];\n    LittleEndian::write_u16(&mut aad, data.len() as u16);\n\n    let mut buffer = Vec::new();\n    buffer.extend_from_slice(data);\n    let auth_tag = aead.encrypt_in_place_detached(Nonce::from_slice(&nonce), &aad, &mut buffer)?;\n\n    Ok((aad, buffer, auth_tag.into()))\n}\n\nfn compute_read_key(shared_secret: &[u8; 32]) -> Result<[u8; 32]> {\n    compute_key(shared_secret, b\"Control-Write-Encryption-Key\")\n}\n\nfn compute_write_key(shared_secret: &[u8; 32]) -> Result<[u8; 32]> {\n    compute_key(shared_secret, b\"Control-Read-Encryption-Key\")\n}\n\nfn compute_key(shared_secret: &[u8; 32], info: &[u8]) -> Result<[u8; 32]> {\n    super::hkdf_extract_and_expand(b\"Control-Salt\", shared_secret, info)\n}\n"
  }
]