diff --git a/Hapinest.docc/HAPiNest.md b/Hapinest.docc/HAPiNest.md index b52fe480..d38bf004 100644 --- a/Hapinest.docc/HAPiNest.md +++ b/Hapinest.docc/HAPiNest.md @@ -16,7 +16,7 @@ HAPiNest is a my personal Home-automation system compatible with Apples HomeKit ![The HAPiNest icon](icon_256x256.png) -The program implements the [HomeKit Accessory Protocol (HAP)](https://github.com/TheMisfit68/HAPiNest/blob/develop/Hapinest.docc/Resources/HAP-Specification-Non-Commercial-Version.pdf). +The program implements the [HomeKit Accessory Protocol (HAP)](./Resources/HAP-Specification-Non-Commercial-Version.pdf). It serves as a HomeKit bridge that bundles different HomeKit accessories. Those accessories can be controlled with Apples Home app (or any other HomeKit-client). diff --git a/ToDo.md b/ToDo.md index 095c25dd..37c93e46 100644 --- a/ToDo.md +++ b/ToDo.md @@ -27,8 +27,46 @@ Check doubleclick interval of the programmable switches (e.g. for the lights in - [ ] Bundle ClibYASDI as a binary package by creating a new binary-target for the package (do not includec zip-archive in git, upload to seperate server LFS) ## Longterm MacOS xx -- [ ] include support for Matter instead of only HAP once the docmentation for Matter(support) improves and rename the project accordingly - [ ] Refactor TizenDriver (=Websocket) to Async/Await when available. -- [ ] Refactor Milightdriver (=UDP-socket) to Async/Await when available. + +copilot example: +import Foundation + +// Create a URL for the WebSocket endpoint +guard let url = URL(string: "ws://127.0.0.1:8080") else { + fatalError("Invalid URL") +} + +// Create a WebSocket task +let socketTask = URLSession.shared.webSocketTask(with: url) + +// Start the task +socketTask.resume() + +// A function to receive messages asynchronously +func receiveMessages() async throws { + for try await message in socketTask.messages { + switch message { + case .string(let text): + print("Received string: \(text)") + case .data(let data): + print("Received data: \(data)") + @unknown default: + fatalError("Received an unknown message type") + } + } +} + +// Call the function to start receiving messages +Task { + do { + try await receiveMessages() + } catch { + print("Error: \(error)") + } +} - [ ] Use SwiftData as the persistent store for all dbase-based Apps. +- [ ] include support for Matter instead of only HAP once the docmentation for Matter(support) improves and rename the project accordingly +- [ ] Refactor Milightdriver (=UDP-socket) to Async/Await when available. +