Commit Graph

182 Commits

Author SHA1 Message Date
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
f85b33a5b1 CoapPacket
- Fixed bug in `fromBytes(ubyte[])` whereby we would parse the delta 0-12 option value correctly in the 0-12 length case but would never jump over it idx-wise
- This effectively left us on the starting byte of the option value for the next round, instead of starting on the next `(option delta | option length)`
2023-09-21 16:25:26 +02:00
e4ba2dd0da CoapPacket
- Space out debug prints in `fromBytes(ubyte[])`
2023-09-18 15:29:47 +02:00
2c65c61c0a Packet
- Added `flip!(T)(T  integral)` for byteswapping
- Added `order!(T)(T integral, Order)` for byte swapping dependent on current system configuration
- Added `CoapOption` for storing options
- `CoapPacket`'s `options` field is now an array of `CoapOption` structs
- `fromBytes(ubyte[])` now prints the partially decoded packet befor message ID and options processing
- Added initial options support
- Options are still not decoding all correctly
- Added `OptionLenType`
- Added `getOptionLenType(ubyte)` which determins the length type based on the 4 bits in the header (lower)
- The `toString()` method now includes the `CoapOptions[]` in its output

Packet (unit tests)

- Added example CoAP packet to play with
2023-09-18 15:18:25 +02:00
d497494eeb Client (unit test)
- Neatened up
2023-09-18 15:09:58 +02:00
54c1fe0ba3
Update d.yml 2023-09-18 14:00:34 +02:00
a51cc61c86
Update d.yml 2023-09-18 13:56:21 +02:00
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
456d8918ee CoapClient
- Added client class
2023-09-14 17:01:03 +02:00
ce3f6240a6 CoapRequestBuilder
- Added a `get()` method
2023-09-14 16:55:50 +02:00
02aa1988be CoapMessagingLayer
- Added new class
- This is stateful management of responses for  previously made requests.
- Handles the actual sending and receiving of datagrams and issueing of callbacks etc.
2023-09-14 16:55:31 +02:00
0fefd27666 CoapPacket
- Added `getToken()` method
2023-09-14 16:34:03 +02:00
ae8462ef9a CoapRequestBuilder
- Added new class
- This allows one to build up a new CoAP request of some form in a method-call-by-method-call manner.
- In order to instantiate one of these please do so via the `CoapClient`.
2023-09-14 16:32:06 +02:00