Skip to content

Commit 1dc5c7e

Browse files
committed
provide port to server
1 parent 09dcab7 commit 1dc5c7e

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/AudioHttp/AudioServer.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ class AudioServer {
3131
* @brief Construct a new Audio W A V Server object
3232
* We assume that the WiFi is already connected
3333
*/
34-
AudioServer() {
34+
AudioServer(int port=80) {
3535
// the client returns 0 for avialableForWrite()
3636
copier.setCheckAvailableForWrite(false);
37+
WiFiServer tmp(port);
38+
server = tmp;
3739
}
3840

3941

@@ -43,11 +45,13 @@ class AudioServer {
4345
* @param network
4446
* @param password
4547
*/
46-
AudioServer(const char* network, const char *password) {
48+
AudioServer(const char* network, const char *password, int port=80) {
4749
this->network = (char*)network;
4850
this->password = (char*)password;
4951
// the client returns 0 for avialableForWrite()
5052
copier.setCheckAvailableForWrite(false);
53+
WiFiServer tmp(port);
54+
server = tmp;
5155
}
5256

5357
/**
@@ -145,7 +149,7 @@ class AudioServer {
145149

146150
protected:
147151
// WIFI
148-
WiFiServer server = WiFiServer(80);
152+
WiFiServer server;
149153
WiFiClient client_obj;
150154
char *password = nullptr;
151155
char *network = nullptr;
@@ -246,7 +250,7 @@ class AudioEncoderServer : public AudioServer {
246250
* @brief Construct a new Audio W A V Server object
247251
* We assume that the WiFi is already connected
248252
*/
249-
AudioEncoderServer(AudioEncoder *encoder) : AudioServer() {
253+
AudioEncoderServer(AudioEncoder *encoder, int port=80) : AudioServer(port) {
250254
this->encoder = encoder;
251255
}
252256

@@ -256,7 +260,7 @@ class AudioEncoderServer : public AudioServer {
256260
* @param network
257261
* @param password
258262
*/
259-
AudioEncoderServer(AudioEncoder *encoder, const char* network, const char *password) : AudioServer(network, password) {
263+
AudioEncoderServer(AudioEncoder *encoder, const char* network, const char *password, int port=80) : AudioServer(network, password, port) {
260264
this->encoder = encoder;
261265
}
262266

@@ -363,7 +367,7 @@ class AudioWAVServer : public AudioEncoderServer {
363367
* @brief Construct a new Audio W A V Server object
364368
* We assume that the WiFi is already connected
365369
*/
366-
AudioWAVServer() : AudioEncoderServer(new WAVEncoder()){
370+
AudioWAVServer(int port=80) : AudioEncoderServer(new WAVEncoder(), port){
367371
}
368372

369373
/**
@@ -372,7 +376,7 @@ class AudioWAVServer : public AudioEncoderServer {
372376
* @param network
373377
* @param password
374378
*/
375-
AudioWAVServer(const char* network, const char *password) : AudioEncoderServer(new WAVEncoder(), network, password) {
379+
AudioWAVServer(const char* network, const char *password, int port=80) : AudioEncoderServer(new WAVEncoder(), network, password, port) {
376380
}
377381

378382
/// Destructor: release the allocated encoder

0 commit comments

Comments
 (0)