Commit Graph

94 Commits

Author SHA1 Message Date
46fcb3c5d2
Update README.md 2023-09-25 13:55:59 +02:00
cffb5dbdf0
Update d.yml 2023-09-25 13:53:09 +02:00
0944b9a6ae
Update d.yml 2023-09-25 13:52:39 +02:00
50acc144de
Update d.yml 2023-09-25 13:52:00 +02:00
a85285849f
Update d.yml 2023-09-25 13:50:09 +02:00
718b644535
Merge pull request #3 from deavmi/feature/cancellable_future
Cancellable future's
2023-09-25 13:45:17 +02:00
3faa9a0f56 Merge branch 'master' into feature/cancellable_future 2023-09-24 23:57:46 +02:00
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
094d59feb1 CoapRequestFuture
- Added `getState()`
- Cleaned up whitespace
2023-09-22 19:55:56 +02:00
2b2641f479 Package
- Make `RequestState` available

CoapRequestFuture

- Made `RequestState` public
- Documented it
2023-09-22 19:54:11 +02:00
d659c2348b CoapClient
- When `close()` is called we will unblock all active `get()` calls to futures
2023-09-22 19:06:06 +02:00
e790cf2ec0 erge branch 'master' into feature/cancellable_future 2023-09-22 19:02:29 +02:00
05557fc63c CoapRequestBuilder
- You can now call `con()` to make the message confirmable
- You can now call `non()` to make the message non-confirmable
- Messages are now by default confirmable
2023-09-22 19:02:06 +02:00
bf834a92c8 Merge branch 'master' into feature/cancellable_future 2023-09-22 18:51:47 +02:00
c1be1b39cf README
- Added example usage
- Added link documentation
2023-09-22 18:51:24 +02:00
8dfab918d9 Branding
- Added branding

README

- Added logo
2023-09-22 18:46:18 +02:00
7a30195d10 CoapRequestFuture
- Fixed `receiveWake(CoapPacket response)` to use `notifyAll()`
2023-09-22 18:40:13 +02:00
ae0161860a CoapRequestFuture
- Added `RequestState` enum
- State if `CREATED` on construction
- Calling `receiveWake(CoapPacket)` now sets the state to `COMPLETED`
- Calling `cancel()` now sets the state to `CANCELLED`
2023-09-22 18:39:49 +02:00
8a1b1f8ea1 Merge branch 'master' into feature/cancellable_future 2023-09-22 18:33:27 +02:00
9e48f21ff1 CoapRequestFuture
- Fixed problem where multiple threads calling  `get()` would not all be woken up on the completion of the future due to usage of `notify()` instead of `notifyAll()`
2023-09-22 18:32:02 +02:00
5eac338517 CoapRequestFuture
- Added new method `cancel()` (WIP)
2023-09-22 18:29:45 +02:00
e354a33bcb CoapMessagingLayer
- Now inherits from `CoapMessagingLayerFR`
- Migrated to it

CoapClient

- Migrated to `CoapMessagingLayerFR`
2023-09-22 18:00:49 +02:00
013886c79f
Merge pull request #2 from deavmi/hotfix/composed_thread_for_udp
Composed thread
2023-09-22 17:57:29 +02:00
a8cee217f7 CoapMessagingLayer
- Using a composed `Thread` instead of inheriting from `Thread`
2023-09-22 17:55:52 +02:00
8fa139b038 CoapMessagingLayerFR
- Added abstract methods `begin()`, `send(CoapPacket)` and `close()`
2023-09-22 17:51:20 +02:00
faa9bc1bc1 CoapMessagingLayerFR
- Added method `getEndpointAddress()`
2023-09-22 17:49:10 +02:00
1004d027cb Package
- Publically import `client` module

Client

- Added package declaration
2023-09-22 17:47:58 +02:00
0494a0fd74 CoapMessagingLayerFR
- Added missing imports
- Added `getClient()` method
- Removed the super constructor call
2023-09-22 17:43:13 +02:00
f4a4258f87 CoapMessagingLayerFR
- Added new stub abstract class
2023-09-22 17:41:16 +02:00
d2661421bd CoapMessagingLayer
- Fixed bug whereby OUR running status was not being used
2023-09-22 17:39:25 +02:00
6652cb1467
Merge pull request #1 from deavmi/hotfix/migrate_socket
Hotfix/migrate socket
2023-09-22 17:38:20 +02:00
114e780be5 CoapMessagingLayer
- Documented `begin()`, `send(CoapPacket)` and `close()`
2023-09-22 17:36:45 +02:00
3dc5fe4feb CoapMessagingLayer
- Added a TODO
2023-09-22 17:24:28 +02:00
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
76feaade27 CoapMessagingLayer
- Made `getEndpointAddress()` protected
- Added documentation for `getEndpointAddress()`
2023-09-22 16:57:39 +02:00
0fb0149d9d CoapClient
- Made `address` package-accessible

CoapMessagingLayer

- Added `getEndpointAddress()` which returns the associated `CoapClient`'s address
2023-09-22 16:56:48 +02:00
a28166dcb1 CoapMessagingLayer
- Added future `select()`-based code
2023-09-22 16:54:28 +02:00
b069a03ab4 CoapClient
- Added TODO to move the `Socket` into the messaging layer
2023-09-22 16:49:55 +02:00
cb3b5a35b5 CoapMessagingLayer
- Added information about the `select()`-based + I/O timed `receive()` I want to implement
2023-09-22 16:44:52 +02:00
e98eb83bad CoapClient
- Added new `onNoNewMessages()`
- Removed `watch()`
2023-09-22 16:40:12 +02:00
f25066900a CoapMessaging
- When a matched packet is found in `handlePacket(CoapPacket)` then print the elapsed time since the original request (thus far)
2023-09-22 16:27:11 +02:00
07c1cb90cc CapRequest
- Added `getElapsedTime()`
2023-09-22 16:26:41 +02:00
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
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
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
497dabf6bf Utils
- Made new module with all the utility functions and types in it

CoapPacket

- Use the new `utils` module
2023-09-21 21:04:11 +02:00
ccda78ed6d CoapPacket
- Cleared up code
2023-09-21 21:01:38 +02:00
6dfd908184 CoapPacket
- If we are in the 16-bit extended option delta mode and we come across a non 4bit length, then assert falsely
2023-09-21 17:23:53 +02:00
71c0781ff6 CoapPacket
- For option delta type 14. Once we compute the delta, add missing 269 and the current delta; that's our option id
- BUT it is als the NEW delta
2023-09-21 17:21:51 +02:00
74f287ad9d CoapPacket
- On the beginning of each loop print out the `data` buffer from the `idx` till the end of the array
- When handling an extended option delta (16bits) we now extract it, add missing 269, add the current delta.
- THEN we jump over that 16bit entity, now we check the option length type based on previously available information
- So far we support ZERO_TO_TWELVE
- WIP: What to do with the new delta? Do we increment it? If so, how?!?
2023-09-21 17:20:00 +02:00