Commit Graph

132 Commits

Author SHA1 Message Date
Tristan B. Velloza Kildaire 9578ad029f CoapClient (unit tests)
- Added a test for the message IDs
2023-09-25 20:12:41 +02:00
Tristan B. Velloza Kildaire 6c20adfe11 CoapRequest
- Added `getMid()`
2023-09-25 20:06:37 +02:00
Tristan B. Velloza Kildaire 1bc4664e33 UDPMessaging
- `handlePacket(CoapPacket)` now calls `yankRequest()` with the received and decoded `CoapPacket`
2023-09-25 20:05:20 +02:00
Tristan B. Velloza Kildaire 8dad7795ad CoapClient
- `yankRequest(ubyte[])` updated to now be `yankRequestCoapPacket)`
2023-09-25 20:04:48 +02:00
Tristan B. Velloza Kildaire 5b67894b32 CoapClient
- Made the `rollingMid` a `ushort` and fixed the `newMid()` method to return that
2023-09-25 20:00:54 +02:00
Tristan B. Velloza Kildaire 23260860f5 CoapClient
- `doRequest(CoapRequestBuilder)` now sets the message id to the result from `newMid()`
2023-09-25 20:00:11 +02:00
Tristan B. Velloza Kildaire d6eefb3a9b CoapClient
- Implemented `newMid()`  to provide a unique new mid
2023-09-25 19:43:23 +02:00
Tristan B. Velloza Kildaire 4c788b91c3 CoapClient
- Added rolling counter and a lock for it
- Count starts at 0
2023-09-25 19:41:29 +02:00
Tristan B. Velloza Kildaire 1136e384f8 CoapRequest
- Added missing documentation
2023-09-25 17:51:13 +02:00
Tristan B. Velloza Kildaire f2f1f8fece
Merge pull request #6 from deavmi/bugfix/yanked_free
Remove request when matched by messaging layer
2023-09-25 17:23:48 +02:00
Tristan B. Velloza Kildaire 3b7be4073f CoapClient
- Cleaned up
2023-09-25 17:22:52 +02:00
Tristan B. Velloza Kildaire 95673cf21f CoapClient
- `yankRequest(ubyte[] token)` now will also remove the matched `CoapRequest` from the `outgoingRequests` queue
- Fixes #6
2023-09-25 17:15:40 +02:00
Tristan B. Velloza Kildaire ce5418a9bd CoapClient
- Added a TODO
2023-09-25 17:11:00 +02:00
Tristan B. Velloza Kildaire c438c6c78c - Refactored packaging
- Removed now-completed TODO
2023-09-25 15:18:57 +02:00
Tristan B. Velloza Kildaire 42471e21d1
Update README.md 2023-09-25 14:52:50 +02:00
Tristan B. Velloza Kildaire 4af4c00dc1
Merge pull request #4 from deavmi/feature/timeoutable_gets
Timeout-able get()'s
2023-09-25 14:51:14 +02:00
Tristan B. Velloza Kildaire 1d4cce19ca CoapClient (unit test)
- Re-enabled previously disabled normal non-timeout-based test
2023-09-25 14:49:56 +02:00
Tristan B. Velloza Kildaire ecd85e195e CoapRequestFuture
- Fixed documentation
2023-09-25 14:48:48 +02:00
Tristan B. Velloza Kildaire 7e475579df CoapRequestFuture
- `getDUration)` does not set the completed state for us, receiveWake(), does
- Check why we woke up and handle accordingly
2023-09-25 14:48:07 +02:00
Tristan B. Velloza Kildaire 45ef86fff9 CoapClient (unit tests)
- Added a high-enough test to make sure we complete a timeout-based test
2023-09-25 14:45:35 +02:00
Tristan B. Velloza Kildaire 0bbabfdb74 CoapClient (unit test)
- Removed `writeln()`'s
2023-09-25 14:43:15 +02:00
Tristan B. Velloza Kildaire e64cf824e6 CoapRequestFuture
- Ensure that we set the request's state to `RequestState.COMPLETED` when `get(Duration)` completes successfully
2023-09-25 14:42:37 +02:00
Tristan B. Velloza Kildaire deaebdaaed CoapClient
- Removed `writeln`'s

CoapCLient (unittest)

- Test the state of the `CoapFutureRequest` when it times out
2023-09-25 14:41:55 +02:00
Tristan B. Velloza Kildaire 19722746f4 CoapRequestFuture
- When the `wait(Duration)` returns `false` (i.e. times out) then also set the state to `RequestState.TIMEDOUT`
2023-09-25 14:39:20 +02:00
Tristan B. Velloza Kildaire 9b779b4c9b RequestState
- Added new enum member `TIMEDOUT` for when the future times out
2023-09-25 14:38:36 +02:00
Tristan B. Velloza Kildaire 237cde4169 CoapRequestFuture
- Removed now-completed TODO
2023-09-25 14:37:38 +02:00
Tristan B. Velloza Kildaire f58f3cdb5c CoapClient
- Disabled normal `get()`-based tests for now (whilst I test the timeout-based ones)
- Added unit test to test timeout-based `get(Duration)`

CoapRequestFuture

- Added documentation for `get(Duration)`
- Fixed bug whereby the `Mutex` was NOT unlock after a failed `wait(Duration)` (a timedout one)
2023-09-25 14:36:38 +02:00
Tristan B. Velloza Kildaire 89cc55f266 Merge branch 'master' into feature/timeoutable_gets 2023-09-25 14:17:11 +02:00
Tristan B. Velloza Kildaire 33648d5e44 Package (server)
- Added module stub

Package (general)

- Documented
- Added `doap.server` import
2023-09-25 14:16:54 +02:00
Tristan B. Velloza Kildaire 4d13968a2f RequestTimeoutException
- Added doc

Package (client)

- Publically import the required exceptions
2023-09-25 14:14:32 +02:00
Tristan B. Velloza Kildaire b240250611 RequestTimeoutException
- Added method `getFuture()` and `getTimeout()`
2023-09-25 14:13:01 +02:00
Tristan B. Velloza Kildaire f78993ad22 RequestTimeoutException
- Made publically accessible
- Made constructor package-level accessible
2023-09-25 14:08:37 +02:00
Tristan B. Velloza Kildaire 82ba08b472 CoapClientExcpeiton
- Added new base class for any client-based errors

RequestTimeoutException

- Added new exception type
2023-09-25 14:08:00 +02:00
Tristan B. Velloza Kildaire 123605df99 Request
- Throw a `RequestTImeoutException` when `get(Duration)` times out
` If the `token(ubyte[])` validation fails then throw a `CoapException` now
2023-09-25 14:07:15 +02:00
Tristan B. Velloza Kildaire ba54bf1b70 Merge branch 'master' into feature/timeoutable_gets 2023-09-25 13:57:41 +02:00
Tristan B. Velloza Kildaire d9fb911424
Update README.md 2023-09-25 13:57:01 +02:00
Tristan B. Velloza Kildaire 46fcb3c5d2
Update README.md 2023-09-25 13:55:59 +02:00
Tristan B. Velloza Kildaire cffb5dbdf0
Update d.yml 2023-09-25 13:53:09 +02:00
Tristan B. Velloza Kildaire 0944b9a6ae
Update d.yml 2023-09-25 13:52:39 +02:00
Tristan B. Velloza Kildaire 50acc144de
Update d.yml 2023-09-25 13:52:00 +02:00
Tristan B. Velloza Kildaire a85285849f
Update d.yml 2023-09-25 13:50:09 +02:00
Tristan B. Velloza Kildaire 2e499d267f Merge branch 'master' into feature/timeoutable_gets 2023-09-25 13:47:34 +02:00
Tristan B. Velloza Kildaire 718b644535
Merge pull request #3 from deavmi/feature/cancellable_future
Cancellable future's
2023-09-25 13:45:17 +02:00
Tristan B. Velloza Kildaire 3faa9a0f56 Merge branch 'master' into feature/cancellable_future 2023-09-24 23:57:46 +02:00
Tristan B. Velloza Kildaire 4f1f843d43 CoapPacket
- Added stub `orderOptions()` type which will re-order the current options and then return a new re-ordered array for encoding properly
- Added stub `encodeOption(CoapOption)` which returns the encoded option as a `ubyte[]`
- `getBytes()` has stub code to call `orderOption()`, iterate over itsm items and call `encodeOption()` on each
2023-09-24 23:57:26 +02:00
Tristan B. Velloza Kildaire 573deec14b CoapRequestBase
- Added `get(Duration)` which times out after the provided time has elapsed
2023-09-22 20:04:25 +02:00
Tristan B. Velloza Kildaire 094d59feb1 CoapRequestFuture
- Added `getState()`
- Cleaned up whitespace
2023-09-22 19:55:56 +02:00
Tristan B. Velloza Kildaire 2b2641f479 Package
- Make `RequestState` available

CoapRequestFuture

- Made `RequestState` public
- Documented it
2023-09-22 19:54:11 +02:00
Tristan B. Velloza Kildaire d659c2348b CoapClient
- When `close()` is called we will unblock all active `get()` calls to futures
2023-09-22 19:06:06 +02:00
Tristan B. Velloza Kildaire e790cf2ec0 erge branch 'master' into feature/cancellable_future 2023-09-22 19:02:29 +02:00