diff --git a/src/app/pages/setup/ble-wifi-setup/ble-wifi-setup.page.scss b/src/app/pages/setup/ble-wifi-setup/ble-wifi-setup.page.scss
index 0822df5..e4d7974 100644
--- a/src/app/pages/setup/ble-wifi-setup/ble-wifi-setup.page.scss
+++ b/src/app/pages/setup/ble-wifi-setup/ble-wifi-setup.page.scss
@@ -90,3 +90,10 @@
margin-bottom: 16px;
text-align: center;
}
+
+.wifinote {
+ margin-top: 16px;
+ margin-bottom: 16px;
+ // text-align: center;
+ // font-size: 14px;
+}
diff --git a/src/app/pages/setup/setup-server/setup-server.page.ts b/src/app/pages/setup/setup-server/setup-server.page.ts
index 63049f7..55e1c5b 100644
--- a/src/app/pages/setup/setup-server/setup-server.page.ts
+++ b/src/app/pages/setup/setup-server/setup-server.page.ts
@@ -6,7 +6,7 @@ import { SnapcastService } from 'src/app/services/snapcast.service';
import { ServerDetail, SnapCastServerStatusResponse } from 'src/app/model/snapcast.model';
import { ActivatedRoute, Router } from '@angular/router';
import Swiper, { SwiperOptions } from 'swiper';
-import { AlertController, NavController } from '@ionic/angular';
+import { AlertController, LoadingController, NavController } from '@ionic/angular';
import { BeatnikHardwareService, HardwareStatus } from 'src/app/services/beatnik-hardware.service';
import { BeatnikHardware } from 'src/app/model/beatnik-hardware.model';
import { SUPPORTED_HATS } from 'src/app/constant/hat.constant';
@@ -36,7 +36,7 @@ export class SetupServerPage implements OnInit {
ip: string | null = null;
userPreferenceServerAdress: string = '';
- isFirstDevice: boolean = true;
+ isFirstDevice: boolean = false;
swiperConfig: SwiperOptions = {
slidesPerView: 1,
@@ -52,6 +52,8 @@ export class SetupServerPage implements OnInit {
hats = Object.values(SUPPORTED_HATS);
manualHatId: string = '';
+ loadingDisplay: HTMLIonLoadingElement | null = null;
+
constructor(
private zeroconf: ZeroconfService,
private snapcastService: SnapcastService,
@@ -60,7 +62,8 @@ export class SetupServerPage implements OnInit {
private beatnikHardwareService: BeatnikHardwareService,
private beatnikSnapcastService: BeatnikSnapcastService,
private alertController: AlertController,
- private router: Router
+ private router: Router,
+ private loadingController: LoadingController
) {
this.services$ = this.zeroconf.services$;
}
@@ -235,6 +238,13 @@ export class SetupServerPage implements OnInit {
}
async setupAsSnapcastServer(): Promise
{
+ this.showLoadingSpinner('Setting up this device as Snapcast server...');
+ if (!this.ip) {
+ console.error('No IP address provided for Snapcast server.');
+ this.loadingDisplay?.dismiss();
+ return;
+ }
+
console.log('Setting up this device as Snapcast server...');
this.beatnikSnapcastService.enable(this.ip || '').subscribe({
next: (response) => {
@@ -242,10 +252,12 @@ export class SetupServerPage implements OnInit {
console.log('Successfully enabled Snapserver on server at IP', this.ip, response);
this.connectToSnapcast(this.selectedService);
this.navToSetupSoundcard();
+ this.loadingDisplay?.dismiss();
},
error: (err) => {
console.error('Failed to enable Snapserver on server at IP', this.ip, err);
+ this.loadingDisplay?.dismiss();
}
});
}
@@ -260,19 +272,28 @@ export class SetupServerPage implements OnInit {
}
async setupAsSecondaryServer(): Promise {
+ this.showLoadingSpinner('Setting up this device as secondary Snapcast server...');
+ if (!this.ip) {
+ console.error('No IP address provided for Snapcast server.');
+ this.loadingDisplay?.dismiss();
+ return;
+ }
console.log('Setting up this device as secondary Snapcast server...');
this.beatnikSnapcastService.enable(this.ip || '').subscribe({
next: (response) => {
console.log('Successfully enabled Snapserver on server at IP', this.ip, response);
this.slideTo(2);
+ this.loadingDisplay?.dismiss();
},
error: (err) => {
console.error('Failed to enable Snapserver on server at IP', this.ip, err);
+ this.loadingDisplay?.dismiss();
}
});
}
async setupAsSnapcastClient(): Promise {
+ this.showLoadingSpinner('Setting up this device as Snapcast client...');
if (!this.ip) {
console.error('No IP address provided for Snapcast server.');
return;
@@ -282,9 +303,11 @@ export class SetupServerPage implements OnInit {
next: (response) => {
console.log('Successfully disabled Snapserver on server at IP', this.ip, response);
this.navToSetupSoundcard();
+ this.loadingDisplay?.dismiss();
},
error: (err) => {
console.error('Failed to disable Snapserver on server at IP', this.ip, err);
+ this.loadingDisplay?.dismiss();
}
});
}
@@ -359,5 +382,15 @@ export class SetupServerPage implements OnInit {
this.router.navigateByUrl(`/setup-soundcard/${this.ip}`);
}
+ async showLoadingSpinner(text: string) {
+
+ this.loadingDisplay = await this.loadingController.create({
+ message: text,
+ spinner: 'dots',
+ backdropDismiss: false,
+ });
+ await this.loadingDisplay.present();
+ }
+
}
diff --git a/src/app/pages/setup/setup-soundcard/setup-soundcard.page.html b/src/app/pages/setup/setup-soundcard/setup-soundcard.page.html
index b427d90..f8ac5e7 100644
--- a/src/app/pages/setup/setup-soundcard/setup-soundcard.page.html
+++ b/src/app/pages/setup/setup-soundcard/setup-soundcard.page.html
@@ -62,7 +62,7 @@ Rebooting client... Please wait.
-
+
Continue
diff --git a/src/app/pages/zeroconf/zeroconf.page.html b/src/app/pages/zeroconf/zeroconf.page.html
index 9894278..e649dbd 100644
--- a/src/app/pages/zeroconf/zeroconf.page.html
+++ b/src/app/pages/zeroconf/zeroconf.page.html
@@ -45,28 +45,45 @@
Searching for services...
-
-
- {{ service.hostname }}
- {{ service.name }}
- {{ service.type }}
- {{ service.ipv4Addresses[0] }}:{{ service.port }}
-
+ 0">
+ Servers
+
+
+
+
+ {{ service.hostname }}
+ {{ service.name }}
+ {{ service.type }}
+ {{ service.ipv4Addresses[0] }}:{{ service.port }}
+
+
+ Set as Server
+
+
+
+
+
+ 0">
+ Clients
+
+
+
+
+ {{ service.hostname }}
+ {{ service.name }}
+ {{ service.type }}
+ {{ service.ipv4Addresses[0] }}:{{ service.port }}
Beatnik Device - MAC: {{ service.txtRecord['mac'] }}
Beatnik Pi: {{ service.txtRecord['model'] }}
Beatnik Version: {{ service.txtRecord['version'] }}
RAM: {{ service.txtRecord['ram'] }}
-
-
-
-
+
+
+
View
Device
-
-
- Set as Server
-
-
+
+
diff --git a/src/app/services/beatnik-snapcast.service.ts b/src/app/services/beatnik-snapcast.service.ts
index 9e9f86e..f62df23 100644
--- a/src/app/services/beatnik-snapcast.service.ts
+++ b/src/app/services/beatnik-snapcast.service.ts
@@ -43,4 +43,18 @@ export class BeatnikSnapcastService {
disable(host: string): Observable {
return this.http.post(`${this.getApiUrl(host)}/disable`, {});
}
+
+ /**
+ * Restart Snapserver
+ */
+ restartServer(host: string): Observable<{ success: boolean; message: string }> {
+ return this.http.post<{ success: boolean; message: string }>(`${this.getApiUrl(host)}/restart-server`, {});
+ }
+
+ /**
+ * Restart Snapclient
+ */
+ restartClient(host: string): Observable<{ success: boolean; message: string }> {
+ return this.http.post<{ success: boolean; message: string }>(`${this.getApiUrl(host)}/restart-client`, {});
+ }
}