Skip to content

Commit dca9bae

Browse files
authored
Merge pull request #50 from hideakitai/feature/bump-arxcontainer-to-v0.6.0
feat: bump arxcontainer to v0.6.0
2 parents fd80df8 + 8032494 commit dca9bae

13 files changed

Lines changed: 103 additions & 56 deletions

File tree

.github/workflows/build.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,40 @@ jobs:
7373
- name: WiFi
7474
verbose: true
7575

76+
build-wifis3:
77+
name: "Build Test (WiFiS3): ${{matrix.board.arch}}:${{matrix.board.name}}"
78+
runs-on: ubuntu-latest
79+
strategy:
80+
fail-fast: false
81+
matrix:
82+
board:
83+
- vendor: arduino
84+
arch: renesas_uno
85+
name: unor4wifi
86+
include:
87+
- index: https://downloads.arduino.cc/packages/package_index.json
88+
board:
89+
vendor: arduino
90+
steps:
91+
- uses: actions/checkout@v4
92+
- name: compile example sketchs
93+
uses: arduino/compile-sketches@v1
94+
with:
95+
github-token: ${{ secrets.GITHUB_TOKEN }}
96+
fqbn: ${{matrix.board.vendor}}:${{matrix.board.arch}}:${{matrix.board.name}}
97+
platforms: |
98+
- name: ${{matrix.board.vendor}}:${{matrix.board.arch}}
99+
source-url: ${{matrix.index}}
100+
sketch-paths: |
101+
- examples/arduino/OscWiFi
102+
libraries: |
103+
- source-path: ./
104+
- name: ArxContainer
105+
- name: ArxSmartPtr
106+
- name: ArxTypeTraits
107+
- name: DebugLog
108+
verbose: true
109+
76110
build-wifinina:
77111
name: 'Build Test (WiFiNINA): ${{matrix.board.arch}}:${{matrix.board.name}}'
78112
runs-on: ubuntu-latest

ArduinoOSC/OSCClient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ namespace osc {
273273
private:
274274
ElementRef publish_impl(const String& ip, const uint16_t port, const String& addr, ElementRef ref) {
275275
Destination dest {ip, port, addr};
276-
dest_map.insert(make_pair(dest, ref));
276+
dest_map.insert(std::make_pair(dest, ref));
277277
return ref;
278278
}
279279
};

ArduinoOSC/OSCServer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ namespace osc {
253253

254254
Server<S>& getServer(const uint16_t port) {
255255
if (server_map.find(port) == server_map.end())
256-
server_map.insert(make_pair(port, ServerRef<S>(new Server<S>(port))));
256+
server_map.insert(std::make_pair(port, ServerRef<S>(new Server<S>(port))));
257257
return *(server_map[port].get());
258258
}
259259

ArduinoOSC/OscMessage.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ namespace osc {
9898

9999
Message& pushBool(const bool b) {
100100
type_tags += (char)(b ? TYPE_TAG_TRUE : TYPE_TAG_FALSE);
101-
arguments.push_back(make_pair(storage.size(), storage.size()));
101+
arguments.push_back(std::make_pair(storage.size(), storage.size()));
102102
return *this;
103103
}
104104
Message& pushInt32(const int32_t i) { return pushPod(TYPE_TAG_INT32, i); }
@@ -107,14 +107,14 @@ namespace osc {
107107
Message& pushDouble(const double d) { return pushPod(TYPE_TAG_DOUBLE, d); }
108108
Message& pushString(const String& s) {
109109
type_tags += (char)TYPE_TAG_STRING;
110-
arguments.push_back(make_pair(storage.size(), s.length() + 1));
110+
arguments.push_back(std::make_pair(storage.size(), s.length() + 1));
111111
strcpy(storage.getBytes(s.length() + 1), s.c_str());
112112
return *this;
113113
}
114114
Message& pushBlob(const Blob& b) { return pushBlob(b.data(), b.size()); }
115115
Message& pushBlob(const void* ptr, const size_t num_bytes) {
116116
type_tags += (char)TYPE_TAG_BLOB;
117-
arguments.push_back(make_pair(storage.size(), num_bytes + 4));
117+
arguments.push_back(std::make_pair(storage.size(), num_bytes + 4));
118118
pod2bytes<int32_t>((int32_t)num_bytes, storage.getBytes(4));
119119
if (num_bytes) memcpy(storage.getBytes(num_bytes), ptr, num_bytes);
120120
return *this;
@@ -222,7 +222,7 @@ namespace osc {
222222
size_t iarg = 0;
223223
while (iarg < type_tags.length()) {
224224
size_t len = getArgSize(type_tags[iarg], arg);
225-
arguments.push_back(make_pair((size_t)(arg - storage.begin()), len));
225+
arguments.push_back(std::make_pair((size_t)(arg - storage.begin()), len));
226226
arg += ceil4(len);
227227
++iarg;
228228
}
@@ -308,7 +308,7 @@ namespace osc {
308308
template <typename POD>
309309
Message& pushPod(const int tag, const POD& v) {
310310
type_tags += (char)tag;
311-
arguments.push_back(make_pair(storage.size(), sizeof(POD)));
311+
arguments.push_back(std::make_pair(storage.size(), sizeof(POD)));
312312
pod2bytes(v, storage.getBytes(sizeof(POD)));
313313
return *this;
314314
}

ArduinoOSC/OscTypes.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,47 +92,47 @@ namespace osc {
9292
template <typename S>
9393
using UdpRef = std::shared_ptr<S>;
9494
template <typename S>
95-
using UdpMap = arx::map<uint16_t, UdpRef<S>, ARDUINOOSC_MAX_SUBSCRIBE_PORTS>;
95+
using UdpMap = arx::stdx::map<uint16_t, UdpRef<S>, ARDUINOOSC_MAX_SUBSCRIBE_PORTS>;
9696

9797
namespace message {
98-
using ArgumentType = arx::pair<size_t, size_t>;
99-
using ArgumentQueue = arx::vector<ArgumentType, ARDUINOOSC_MAX_MSG_ARGUMENT_SIZE>;
98+
using ArgumentType = arx::stdx::pair<size_t, size_t>;
99+
using ArgumentQueue = arx::stdx::vector<ArgumentType, ARDUINOOSC_MAX_MSG_ARGUMENT_SIZE>;
100100
class Message;
101-
using MessageQueue = arx::vector<Message, ARDUINOOSC_MAX_MSG_QUEUE_SIZE>;
101+
using MessageQueue = arx::stdx::vector<Message, ARDUINOOSC_MAX_MSG_QUEUE_SIZE>;
102102
} // namespace message
103103
#ifndef ARDUINOOSC_DISABLE_BUNDLE
104-
using BundleData = arx::vector<uint32_t, ARDUINOOSC_MAX_MSG_BUNDLE_SIZE>;
104+
using BundleData = arx::stdx::vector<uint32_t, ARDUINOOSC_MAX_MSG_BUNDLE_SIZE>;
105105
#endif
106-
using Blob = arx::vector<char, ARDUINOOSC_MAX_MSG_BYTE_SIZE>;
106+
using Blob = arx::stdx::vector<char, ARDUINOOSC_MAX_MSG_BYTE_SIZE>;
107107

108108
namespace client {
109109
namespace element {
110110
class Base;
111111
using Ref = std::shared_ptr<Base>;
112-
using TupleRef = arx::vector<Ref, ARDUINOOSC_MAX_MSG_ARGUMENT_SIZE>;
112+
using TupleRef = arx::stdx::vector<Ref, ARDUINOOSC_MAX_MSG_ARGUMENT_SIZE>;
113113
} // namespace element
114114
class Destination;
115115
using ElementRef = element::Ref;
116116
using ElementTupleRef = element::TupleRef;
117-
using DestinationMap = arx::map<Destination, ElementRef, ARDUINOOSC_MAX_PUBLISH_DESTINATION>;
117+
using DestinationMap = arx::stdx::map<Destination, ElementRef, ARDUINOOSC_MAX_PUBLISH_DESTINATION>;
118118
} // namespace client
119119

120120
namespace server {
121121
namespace element {
122122
class Base;
123123
using Ref = std::shared_ptr<Base>;
124-
using TupleRef = arx::vector<Ref, ARDUINOOSC_MAX_MSG_ARGUMENT_SIZE>;
125-
using dummy_vector_t = arx::vector<size_t, ARDUINOOSC_MAX_MSG_ARGUMENT_SIZE>;
124+
using TupleRef = arx::stdx::vector<Ref, ARDUINOOSC_MAX_MSG_ARGUMENT_SIZE>;
125+
using dummy_vector_t = arx::stdx::vector<size_t, ARDUINOOSC_MAX_MSG_ARGUMENT_SIZE>;
126126
} // namespace element
127127
using ElementRef = element::Ref;
128128
using ElementTupleRef = element::TupleRef;
129-
using CallbackMap = arx::map<String, ElementRef, ARDUINOOSC_MAX_SUBSCRIBE_ADDRESS_PER_PORT>;
129+
using CallbackMap = arx::stdx::map<String, ElementRef, ARDUINOOSC_MAX_SUBSCRIBE_ADDRESS_PER_PORT>;
130130
template <typename S>
131131
class Server;
132132
template <typename S>
133133
using ServerRef = std::shared_ptr<Server<S>>;
134134
template <typename S>
135-
using ServerMap = arx::map<uint16_t, ServerRef<S>, ARDUINOOSC_MAX_SUBSCRIBE_PORTS>;
135+
using ServerMap = arx::stdx::map<uint16_t, ServerRef<S>, ARDUINOOSC_MAX_SUBSCRIBE_PORTS>;
136136
} // namespace server
137137

138138
} // namespace osc
@@ -171,7 +171,7 @@ namespace osc {
171171
struct Storage {
172172
Blob data;
173173

174-
// reserve() makes no sense on arx::vector because capacity is fixed
174+
// reserve() makes no sense on arx::stdx::vector because capacity is fixed
175175
Storage() { data.reserve(200); }
176176

177177
char* getBytes(const size_t sz) {

ArduinoOSC/OscUdpMap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace osc {
4040
// use first port for PORT_DISCARD if some udp instances exist
4141
if (port == PORT_DISCARD) {
4242
if (udp_map.empty()) {
43-
udp_map.insert(make_pair(port, UdpRef<S>(new S())));
43+
udp_map.insert(std::make_pair(port, UdpRef<S>(new S())));
4444
udp_map[port]->begin(port);
4545
}
4646
return udp_map.begin()->second;
@@ -53,7 +53,7 @@ namespace osc {
5353
udp_discard_ref->second->stop();
5454
udp_map.erase(udp_discard_ref);
5555
}
56-
udp_map.insert(make_pair(port, UdpRef<S>(new S())));
56+
udp_map.insert(std::make_pair(port, UdpRef<S>(new S())));
5757
udp_map[port]->begin(port);
5858
}
5959
return udp_map[port];

ArduinoOSCWiFi.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#if defined(ESP_PLATFORM) || defined(ESP8266) || defined(ARDUINO_AVR_UNO_WIFI_REV2) \
66
|| defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_MKRVIDOR4000) || defined(ARDUINO_SAMD_MKR1000) \
7-
|| defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_RASPBERRY_PI_PICO_W)
7+
|| defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_RASPBERRY_PI_PICO_W) || defined(ARDUINO_UNOR4_WIFI)
88
#define ARDUINOOSC_ENABLE_WIFI
99
#endif
1010

@@ -23,6 +23,8 @@
2323
#include <SPI.h>
2424
#include <WiFi101.h>
2525
#include <WiFiUdp.h>
26+
#elif defined(ARDUINO_UNOR4_WIFI)
27+
#include <WiFiS3.h>
2628
#endif
2729
#include "ArduinoOSC/ArduinoOSCCommon.h"
2830
using OscWiFiManager = ArduinoOSC::Manager<WiFiUDP>;

README.md

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
OSC subscriber / publisher for Arduino
44

5-
65
#### NOTE (>= v0.3.x) : BREAKING API CHANGES
76

87
- almost all apis has have changed and got much simpler
@@ -19,22 +18,21 @@ If you have already installed this library, please follow:
1918
## Feature
2019

2120
- simple usage
22-
- flexible callback registration with lambda
23-
- directly binding osc packet to values
24-
- osc packet sending in one-line
25-
- publishing osc packet in one-line
21+
- flexible callback registration with lambda
22+
- directly binding osc packet to values
23+
- osc packet sending in one-line
24+
- publishing osc packet in one-line
2625
- support basic OSC types based on [oscpkt](http://gruntthepeon.free.fr/oscpkt/html/)
27-
- TF (`bool`: true, false)
28-
- i (`int32_t`)
29-
- h (`int64_t`)
30-
- f (`float`)
31-
- d (`double`)
32-
- s (`string`)
33-
- b (`bundle`)
26+
- TF (`bool`: true, false)
27+
- i (`int32_t`)
28+
- h (`int64_t`)
29+
- f (`float`)
30+
- d (`double`)
31+
- s (`string`)
32+
- b (`bundle`)
3433
- support pattern-matching (wildcards)
3534
- does NOT support timestamp values.
3635

37-
3836
## Usage
3937

4038
### Include ArduinoOSC
@@ -85,7 +83,7 @@ void loop() {
8583

8684
### Bind OSC to Lambda Arguments and One-Line Send
8785

88-
``` C++
86+
```C++
8987
void setup() {
9088
// WiFi stuff
9189
// ...
@@ -110,7 +108,7 @@ void loop() {
110108

111109
### Other Way to Subscribe
112110

113-
``` C++
111+
```C++
114112
// OscMessage as lambda argument
115113
OscWiFi.subscribe(recv_port, "/lambda/msg",
116114
[](const OscMessage& m) {
@@ -144,7 +142,6 @@ OscWiFi.subscribe(recv_port, "/need/reply", []() {
144142
OscWiFi.subscribe(recv_port, "/callback", onOscReceived);
145143
```
146144

147-
148145
## Supported Platform
149146

150147
This library currently supports following platforms and interfaces.
@@ -155,6 +152,7 @@ Please feel free to send PR or request for more board support!
155152
- ESP32
156153
- ESP8266
157154
- Raspberry Pi Pico W
155+
- Arduino Uno R4 WiFi
158156
- Arduino Uno WiFi Rev2
159157
- Arduino MKR VIDOR 4000
160158
- Arduino MKR WiFi 1010
@@ -165,7 +163,6 @@ Please feel free to send PR or request for more board support!
165163

166164
- Almost all platforms which has `Ethernet` (and `ETH`) library
167165

168-
169166
## Limitation and Options for NO-STL Boards
170167

171168
STL is used to handle packet data by default, but for following boards/architectures, [ArxContainer](https://github.com/hideakitai/ArxContainer) is used to store the packet data because STL can not be used for such boards.
@@ -174,15 +171,14 @@ The storage size of such boards for packets, queue of packets, max packet binary
174171
- AVR
175172
- megaAVR
176173

177-
178174
### Usage Recommendation for Arduino Uno (and other boards with tiny memory size)
179175

180176
For the boards which has tiny memory size (e.g. Arduino Uno), I reccomend not to use publisher and subscriber.
181177
Though you can use them on such boards, such rich functions requires more memory.
182178
The reccomended way is to use `send` and `parse` manually.
183179
The example is shown in `examples/arduino/OscEtherUno`, so please consider to use it.
184180

185-
``` C++
181+
```C++
186182
#include <ArduinoOSCEther.h>
187183
// #include <ArduinoOSC.h> // you can use this because Uno supports only Ethernet
188184

@@ -219,14 +215,13 @@ void loop() {
219215
}
220216
```
221217
222-
223218
### Memory Management (only for NO-STL Boards)
224219
225220
As mentioned above, for such boards like Arduino Uno, the storage sizes are limited.
226221
And of course you can manage them by defining following macros.
227222
But these default values are optimized for such boards, please be careful not to excess your boards storage/memory.
228223
229-
``` C++
224+
```C++
230225
#define ARDUINOOSC_MAX_MSG_ARGUMENT_SIZE 8
231226
#define ARDUINOOSC_MAX_MSG_BYTE_SIZE 128
232227
#define ARDUINOOSC_MAX_MSG_QUEUE_SIZE 1
@@ -241,22 +236,20 @@ OSC bundle option is disabled for such boards.
241236
If you want to use that, please use this macro and handle packets manually.
242237
`ArduinoOSC` does not use bundle by default.
243238

244-
``` C++
239+
```C++
245240
#define ARDUINOOSC_ENABLE_BUNDLE
246241
#define ARDUINOOSC_MAX_MSG_BUNDLE_SIZE 128
247242
```
248243
249-
250244
### Enable Debug Logger
251245
252246
You can see the debug log when you insert following line before include `ArduinoOSC`.
253247
254-
``` C++
248+
```C++
255249
#define ARDUINOOSC_DEBUGLOG_ENABLE
256250
#include <ArduinoOSC.h>
257251
```
258252

259-
260253
## Dependent Libraries
261254

262255
- [ArxTypeTraits](https://github.com/hideakitai/ArxTypeTraits)
@@ -268,12 +261,10 @@ You can see the debug log when you insert following line before include `Arduino
268261

269262
- [TeensyDirtySTLErrorSolution v0.1.0](https://github.com/hideakitai/TeensyDirtySTLErrorSolution)
270263

271-
272264
## Special Thanks
273265

274266
- [ofxPubSubOsc](https://github.com/2bbb/ofxPubSubOsc)
275267

276-
277268
## License
278269

279270
MIT

examples/arduino/OscEther/OscEther.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111

1212
// Ethernet stuff
1313
uint8_t mac[] = {0xAB, 0xCD, 0xEF, 0x01, 0x23, 0x45};
14-
const IPAddress ip(192, 168, 1, 201);
14+
const IPAddress ip(192, 168, 0, 201);
1515
// Ethernet with useful options
1616
// const IPAddress dns (192, 168, 1, 1);
1717
// const IPAddress gateway (192, 168, 1, 1);
1818
// const IPAddress subnet (255, 255, 255, 0);
1919

2020
// for ArduinoOSC
21-
const char* host = "192.168.1.200";
21+
const char* host = "192.168.0.200";
2222
const int recv_port = 54321;
2323
const int bind_port = 54345;
2424
const int send_port = 55555;

0 commit comments

Comments
 (0)