Add CoAP protocol binding for WoT consumer with Block2 support and enhanced error messages#12
Add CoAP protocol binding for WoT consumer with Block2 support and enhanced error messages#12
Conversation
Co-authored-by: BinkertR <65028874+BinkertR@users.noreply.github.com>
Co-authored-by: BinkertR <65028874+BinkertR@users.noreply.github.com>
Co-authored-by: BinkertR <65028874+BinkertR@users.noreply.github.com>
|
Implement Block2 (recommended for robustness) Info: Fetched TD from coap://localhost:5683/ac successfully at Program.(String[] args) |
Co-authored-by: BinkertR <65028874+BinkertR@users.noreply.github.com>
Implemented Block2 (RFC 7959) support in commit f4fb6ce. The CoAP client now:
This fixes the "Unterminated string" error when fetching large Thing Descriptions. The JSON parsing error at position 1024 was caused by the payload being truncated to a single block. With Block2 support, large TDs (and any payloads exceeding ~1KB) are now fully retrieved. |
|
@copilot add more meaningful error messages when something fails. e.g. if an action requires and input, this is the current error message "coap://10.5.0.2:5683/ac/actions/incrementInvoke 'increment' failed: CoAP request failed with code 5.00" But should be sth. like "Invalid value according to DataSchema" |
…scriptions Co-authored-by: BinkertR <65028874+BinkertR@users.noreply.github.com>
Enhanced error messages in commit 5cee6f3. CoAP failures now include:
Example improvements:
The error for missing action input will now display as: |
Implements CoAP (Constrained Application Protocol) support per WoT Scripting API spec, enabling consumption of CoAP Things alongside existing HTTP/HTTPS support.
Implementation
New binding package (
WoT.Net.Binding.CoAP):WotCoapClient: IProtocolClient implementation with RFC 7252 compliant message encoding/decodingCoapClientFactory: Factory for creating CoAP client instancesCoapClientConfig: Configuration for timeout, retransmit, ACK parametersCoAP protocol support:
Block2 implementation:
Enhanced error handling:
CoAP request failed with code 5.00 (Internal Server Error - Server encountered an error (check request parameters and payload)) - Invalid value according to DataSchemaNot implemented (throws NotImplementedException):
Usage
Notes
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.