Commit Graph

46 Commits

Author SHA1 Message Date
Tristan B. Velloza Kildaire c16b8a4b06 Client
- `newMid2()` now uses the updated `findNextFree(..., ...)` from niknaks
2023-10-15 17:03:45 +02:00
Tristan B. Velloza Kildaire 9e93acd408 Client
- Fixed duplicate imports causing compilation issues with `ldc2`

UDP

- Fixed duplicate imports causing compilation issues with `ldc2`
2023-09-30 20:35:34 +02:00
Tristan B. Velloza Kildaire 1190199905 CoapClient
- Bumped `EXCHANGE_LIFETIME` to 5 seconds (for now)
2023-09-26 19:35:14 +02:00
Tristan B. Velloza Kildaire 7071c9361f Merge branch 'master' into feature/exchange_lifetime 2023-09-26 19:30:19 +02:00
Tristan B. Velloza Kildaire b4af82599b CoapClient
- Removed `watcherSignal` as unused
2023-09-26 19:29:11 +02:00
Tristan B. Velloza Kildaire 1ff0751900 CoapClient
- Removed old `rollingMid`
- Renamed mutex for `mids`
- Cleaned up imports
2023-09-26 19:27:53 +02:00
Tristan B. Velloza Kildaire 94b9c2d714 CoapClient
- Removed `newMid()`
2023-09-26 19:18:33 +02:00
Tristan B. Velloza Kildaire 4daf3daad0 CoapClient
- Cleaned up `newMid2()`
2023-09-26 19:17:20 +02:00
Tristan B. Velloza Kildaire dc23fbd1a0 CoapClient (unit test)
- Set `EXCHANGE_LIFETIME` high enough to not reuse message IDs
2023-09-26 16:29:51 +02:00
Tristan B. Velloza Kildaire 5edfd4ae36 CoapClient (unittests)
- Unset for now
2023-09-26 15:09:44 +02:00
Tristan B. Velloza Kildaire c2075dd604 CoapClient
- Added `setExchangeLifetime(Duration)`

CoapClient (unittests)

- Manually set the exchange lifetime
2023-09-26 15:09:30 +02:00
Tristan B. Velloza Kildaire 1408a5c202 CoapClient
- Tested
2023-09-25 22:11:20 +02:00
Tristan B. Velloza Kildaire c2b5b64cda CoapClient
- Start the stopwatch
2023-09-25 22:02:50 +02:00
Tristan B. Velloza Kildaire aadd9c320f CoapClient
- Set time to 10 milliseconds (for now)
2023-09-25 22:02:21 +02:00
Tristan B. Velloza Kildaire 3bb0b17353 CoapClient
- Switched to using `newMid2()` in `doRequest(CoapRequestBuilder)`
2023-09-25 21:57:16 +02:00
Tristan B. Velloza Kildaire dd9f5c994f CoapClient
- Fixed bug whereby we didn't register the new found message id
2023-09-25 21:55:51 +02:00
Tristan B. Velloza Kildaire f56210732b CoapClient
- Documented
- `newMid2()` now uses `findNextFree()`
2023-09-25 21:54:07 +02:00
Tristan B. Velloza Kildaire 41ef2a39cf CoapClient
- Added `EXCHANGE_LIFETIME` and made it very high for starters
2023-09-25 21:41:32 +02:00
Tristan B. Velloza Kildaire ae97035035 CoapClient
- Made `newMid()` private and final
- Added documentation for `newMid()`
2023-09-25 21:19:56 +02:00
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 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 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 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 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 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 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 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 e354a33bcb CoapMessagingLayer
- Now inherits from `CoapMessagingLayerFR`
- Migrated to it

CoapClient

- Migrated to `CoapMessagingLayerFR`
2023-09-22 18:00:49 +02:00
Tristan B. Velloza Kildaire 0c81ce635f CoapClient
- Removed the `Socket` instance
- `init()` now calls `begin()` on the messaging layer and no longer creates a new `Socket` itself
- `close()` now just calls `close()` on the messaging layer
- `transmitRequest(CoapRequest)` now calls `send(CoapPacket)` on the messaging layer instead of via a socket's `send(ubyte[])`

CoapMessagingLayer

- Added a `running` flag
- Added `begin()` which sets the running flag (ours) to `true`, it then creates and opens a `Socket` and then starts the reading loop
- Added `send(CoapPacket)` whcih wire-encoded the packet and then sends it over our `Socket`
- Added `close()` which sets the running flag to false, shutsdown the `Socket` (unblocking any blocking receives) and then closes the `Socket` (releasing the bound datagram port)
- Removed references to the `CoapClient`'s now-non-existent `Socket`
2023-09-22 17:19:38 +02:00
Tristan B. Velloza Kildaire 0fb0149d9d CoapClient
- Made `address` package-accessible

CoapMessagingLayer

- Added `getEndpointAddress()` which returns the associated `CoapClient`'s address
2023-09-22 16:56:48 +02:00
Tristan B. Velloza Kildaire b069a03ab4 CoapClient
- Added TODO to move the `Socket` into the messaging layer
2023-09-22 16:49:55 +02:00
Tristan B. Velloza Kildaire e98eb83bad CoapClient
- Added new `onNoNewMessages()`
- Removed `watch()`
2023-09-22 16:40:12 +02:00
Tristan B. Velloza Kildaire ed97a2a3b4 CoapRequest
- Removed `getAndReset()`, replaced it with `hasTimedOut(Duration)`

CoapClient

- The `watch()` now uses `CoapRequest`'s new `hasTimedOut(Duration)` method
2023-09-22 16:22:27 +02:00
Tristan B. Velloza Kildaire 31b5d13943 CoapClient
- Added a `Condition` variable for the `requestsLock` mutex
- Added `transmitRequest(CoapRequest request)` which will take in the `CoapRequest`, yank the `CoapPacket` from it, encode it, send it over the underlying transport and then start the request's timer
- Added some code for a future "watcher" routine

CoapRequest

- Added a `StopWatch` timer which does not auto start
- Added `startTime()` which starts the timer
- Added `getAndReset()` which gets the elapsed time and resets it
2023-09-22 16:19:24 +02:00
Tristan B. Velloza Kildaire 2716fd3986 CoapRequest
- Now takes in the original request packet, `CoapPacket` instead of the token
- Added `getToken()` to fetch the token (for matching purposes)
- Added `getRequestPacket()` to obtain the original request

CoapClient

- Use `getToken()`
- Pass the `CoapPacket` in rather
2023-09-22 15:40:11 +02:00
Tristan B. Velloza Kildaire d497494eeb Client (unit test)
- Neatened up
2023-09-18 15:09:58 +02:00
Tristan B. Velloza Kildaire 1e50540e75 CoapClient
- Added new constructor `this(string host, ushort port)`
-This constructor provided name resolution on the host part.

Client (unit tests)

- Updated unit test to use the new `CoapClient` name-resolution-based constructor
2023-09-14 17:05:44 +02:00
Tristan B. Velloza Kildaire 456d8918ee CoapClient
- Added client class
2023-09-14 17:01:03 +02:00