From 5a129b268a082112d9063d76c2710c77ea439336 Mon Sep 17 00:00:00 2001 From: Matheus Thibau Date: Tue, 6 Jan 2026 13:21:54 -0300 Subject: [PATCH 01/11] Fix: getUserById waiting for the user email #13 --- app/Http/Controllers/UserController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index a5c9703..0598154 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -18,7 +18,7 @@ public function showAllUsers() public function showOneUser($id) { - if (!$user = User::firstWhere('email', $id)) { + if (!$user = User::firstWhere('id', $id)) { (new ErrorController)->saveError(static::class, 404, 'Could not find user'); return response()->json(['message' => 'Not found'], 404); } else { From 197047b472a4370ec7ac9e49a40eb478292cba58 Mon Sep 17 00:00:00 2001 From: Matheus Thibau Date: Tue, 6 Jan 2026 14:39:39 -0300 Subject: [PATCH 02/11] Feat: New endpoint: Set digital mode value #12 --- app/Http/Controllers/RadioController.php | 19 +++++++++++++++++++ routes/web.php | 1 + 2 files changed, 20 insertions(+) diff --git a/app/Http/Controllers/RadioController.php b/app/Http/Controllers/RadioController.php index 6fbdce6..3aaff9b 100755 --- a/app/Http/Controllers/RadioController.php +++ b/app/Http/Controllers/RadioController.php @@ -911,6 +911,25 @@ public function setTimeoutConfig($seconds) return response()->json(['message' => 'Server error'], 500); } + public function setDigitalVoice($value) + { + + if ($value < 0 || $value > 1) { + (new ErrorController)->saveError(static::class, 500, 'API Error: digital voice value must be 0 or 1'); + return response()->json(['message' => 'Server error'], 500); + } + + $command = "set_digital -a " . $value; + $output = explode("\n", (string) exec_uc($command))[0]; + + if ($output == "OK") { + return response(true, 200); + } + + (new ErrorController)->saveError(static::class, 500, 'API Error: Error during updating the digital voice mode - ' . $output); + return response()->json(['message' => 'Server error'], 500); + } + public function getBitrate() { $command = "get_bitrate"; /*UPDATE COMMAND*/ diff --git a/routes/web.php b/routes/web.php index 58572ca..32a3231 100644 --- a/routes/web.php +++ b/routes/web.php @@ -95,6 +95,7 @@ $router->post('/voice/timeout', ['uses' => 'RadioController@restartVoiceTimeout']); $router->get('/voice/timeout/config', ['uses' => 'RadioController@getTimeoutConfig']); $router->post('/voice/timeout/config/{seconds}', ['uses' => 'RadioController@setTimeoutConfig']); + $router->post('voice/digital', ['uses' => 'RadioController@setDigitalVoice']); $router->get('/bitrate', ['uses' => 'RadioController@getBitrate']); $router->get('/snr', ['uses' => 'RadioController@getSNR']); $router->get('{profile}', ['uses' => 'RadioController@getRadioStatus']); From 33ea80416e553f123790c9bd287acd18256323f0 Mon Sep 17 00:00:00 2001 From: Matheus Thibau Date: Tue, 3 Feb 2026 11:22:08 -0300 Subject: [PATCH 03/11] Feat: Update set digital mode endpoint #14 --- app/Http/Controllers/RadioController.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Http/Controllers/RadioController.php b/app/Http/Controllers/RadioController.php index 3aaff9b..e378d33 100755 --- a/app/Http/Controllers/RadioController.php +++ b/app/Http/Controllers/RadioController.php @@ -913,13 +913,12 @@ public function setTimeoutConfig($seconds) public function setDigitalVoice($value) { - if ($value < 0 || $value > 1) { (new ErrorController)->saveError(static::class, 500, 'API Error: digital voice value must be 0 or 1'); return response()->json(['message' => 'Server error'], 500); } - $command = "set_digital -a " . $value; + $command = "set_digital_voice -a " . $value . " -p 1"; $output = explode("\n", (string) exec_uc($command))[0]; if ($output == "OK") { From d5e6f014fe8bd0964d415973869dc2e1a9068e23 Mon Sep 17 00:00:00 2001 From: Matheus Thibau Date: Tue, 3 Feb 2026 11:22:55 -0300 Subject: [PATCH 04/11] Feat: New endpoint to GET digital mode value #16 --- app/Http/Controllers/RadioController.php | 14 ++++++++++++++ routes/web.php | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/RadioController.php b/app/Http/Controllers/RadioController.php index e378d33..13e4731 100755 --- a/app/Http/Controllers/RadioController.php +++ b/app/Http/Controllers/RadioController.php @@ -911,6 +911,20 @@ public function setTimeoutConfig($seconds) return response()->json(['message' => 'Server error'], 500); } + public function getDigitalVoice() + { + + $command = "get_digital_voice -p 1"; + $output = explode("\n", (string) exec_uc($command))[0]; + + if ($output == "OK") { + return response(true, 200); + } + + (new ErrorController)->saveError(static::class, 500, 'API Error: Error during getting the digital voice mode - ' . $output); + return response()->json(['message' => 'Server error'], 500); + } + public function setDigitalVoice($value) { if ($value < 0 || $value > 1) { diff --git a/routes/web.php b/routes/web.php index 32a3231..b947149 100644 --- a/routes/web.php +++ b/routes/web.php @@ -95,13 +95,13 @@ $router->post('/voice/timeout', ['uses' => 'RadioController@restartVoiceTimeout']); $router->get('/voice/timeout/config', ['uses' => 'RadioController@getTimeoutConfig']); $router->post('/voice/timeout/config/{seconds}', ['uses' => 'RadioController@setTimeoutConfig']); + $router->get('voice/digital', ['uses' => 'RadioController@getDigitalVoice']); $router->post('voice/digital', ['uses' => 'RadioController@setDigitalVoice']); $router->get('/bitrate', ['uses' => 'RadioController@getBitrate']); $router->get('/snr', ['uses' => 'RadioController@getSNR']); $router->get('{profile}', ['uses' => 'RadioController@getRadioStatus']); $router->get('powerlevel/{profile}', ['uses' => 'RadioController@getPowerLevel']); $router->post('powerlevel', ['uses' => 'RadioController@setPowerLevel']); - }); $router->group(['prefix' => '/geolocation'], function () use ($router): void { From acc570aa0e7e0a006bbff6e2b00397aaaf4aa5b9 Mon Sep 17 00:00:00 2001 From: Matheus Thibau Date: Tue, 3 Feb 2026 13:07:48 -0300 Subject: [PATCH 05/11] Feat: New endpoint to GET digital mode value #16 --- app/Http/Controllers/RadioController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/RadioController.php b/app/Http/Controllers/RadioController.php index 13e4731..82127d8 100755 --- a/app/Http/Controllers/RadioController.php +++ b/app/Http/Controllers/RadioController.php @@ -917,8 +917,8 @@ public function getDigitalVoice() $command = "get_digital_voice -p 1"; $output = explode("\n", (string) exec_uc($command))[0]; - if ($output == "OK") { - return response(true, 200); + if ($output == "OFF" || $output == "ON") { + return response($output, 200); } (new ErrorController)->saveError(static::class, 500, 'API Error: Error during getting the digital voice mode - ' . $output); From dfaddc8f5f5ff9fe79176bba4d4b75957e6c309c Mon Sep 17 00:00:00 2001 From: Matheus Thibau Date: Tue, 3 Feb 2026 13:49:50 -0300 Subject: [PATCH 06/11] Feat: Update set digital mode endpoint #14 --- app/Http/Controllers/RadioController.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/RadioController.php b/app/Http/Controllers/RadioController.php index 82127d8..21ab98e 100755 --- a/app/Http/Controllers/RadioController.php +++ b/app/Http/Controllers/RadioController.php @@ -913,7 +913,6 @@ public function setTimeoutConfig($seconds) public function getDigitalVoice() { - $command = "get_digital_voice -p 1"; $output = explode("\n", (string) exec_uc($command))[0]; @@ -925,14 +924,14 @@ public function getDigitalVoice() return response()->json(['message' => 'Server error'], 500); } - public function setDigitalVoice($value) - { - if ($value < 0 || $value > 1) { + public function setDigitalVoice(Request $request) + { + if ($request->value < 0 || $request->value > 1) { (new ErrorController)->saveError(static::class, 500, 'API Error: digital voice value must be 0 or 1'); return response()->json(['message' => 'Server error'], 500); } - $command = "set_digital_voice -a " . $value . " -p 1"; + $command = "set_digital_voice -a " . $request->value. " -p 1"; $output = explode("\n", (string) exec_uc($command))[0]; if ($output == "OK") { From 02f5f47ec9f744d45418ccc78a3db67da4d04164 Mon Sep 17 00:00:00 2001 From: Matheus Thibau Date: Tue, 3 Feb 2026 14:00:36 -0300 Subject: [PATCH 07/11] Feat: New endpoint to GET digital mode value #16 --- app/Http/Controllers/RadioController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/RadioController.php b/app/Http/Controllers/RadioController.php index 21ab98e..28c15f7 100755 --- a/app/Http/Controllers/RadioController.php +++ b/app/Http/Controllers/RadioController.php @@ -917,7 +917,7 @@ public function getDigitalVoice() $output = explode("\n", (string) exec_uc($command))[0]; if ($output == "OFF" || $output == "ON") { - return response($output, 200); + return response()->json($output, 200); } (new ErrorController)->saveError(static::class, 500, 'API Error: Error during getting the digital voice mode - ' . $output); From ee4dd5c138a0b0ce49320ec3e3248f79f6dd58a7 Mon Sep 17 00:00:00 2001 From: Matheus Thibau Date: Tue, 3 Feb 2026 14:21:23 -0300 Subject: [PATCH 08/11] Feat: Update set digital mode endpoint #14 --- app/Http/Controllers/RadioController.php | 1 - routes/web.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Http/Controllers/RadioController.php b/app/Http/Controllers/RadioController.php index 28c15f7..77760eb 100755 --- a/app/Http/Controllers/RadioController.php +++ b/app/Http/Controllers/RadioController.php @@ -978,7 +978,6 @@ public function getPowerLevel($profile) public function setPowerLevel(Request $request) { - if ($request->powerLevel >= 0 && $request->powerLevel <= 100) { $command = "set_power -a " . $request->powerLevel . " -p " . $request->profile; $output = explode("\n", (string) exec_uc($command))[0]; diff --git a/routes/web.php b/routes/web.php index b947149..8d2f675 100644 --- a/routes/web.php +++ b/routes/web.php @@ -96,7 +96,7 @@ $router->get('/voice/timeout/config', ['uses' => 'RadioController@getTimeoutConfig']); $router->post('/voice/timeout/config/{seconds}', ['uses' => 'RadioController@setTimeoutConfig']); $router->get('voice/digital', ['uses' => 'RadioController@getDigitalVoice']); - $router->post('voice/digital', ['uses' => 'RadioController@setDigitalVoice']); + $router->post('voice/digital/{value}', ['uses' => 'RadioController@setDigitalVoice']); $router->get('/bitrate', ['uses' => 'RadioController@getBitrate']); $router->get('/snr', ['uses' => 'RadioController@getSNR']); $router->get('{profile}', ['uses' => 'RadioController@getRadioStatus']); From 3d32d5e748ac6068c5797e10a1339b368d9e21df Mon Sep 17 00:00:00 2001 From: Matheus Thibau Date: Tue, 3 Mar 2026 16:24:16 -0300 Subject: [PATCH 09/11] Fix: Find user by ID #17 --- app/Http/Controllers/UserController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 0598154..9e3f1e4 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -18,7 +18,9 @@ public function showAllUsers() public function showOneUser($id) { - if (!$user = User::firstWhere('id', $id)) { + $user = User::find('id', $id); + + if (!$user) { (new ErrorController)->saveError(static::class, 404, 'Could not find user'); return response()->json(['message' => 'Not found'], 404); } else { From 5b5d2d11724ba62ccac26d494a593666d79034e3 Mon Sep 17 00:00:00 2001 From: Matheus Thibau Date: Mon, 27 Apr 2026 13:14:07 -0300 Subject: [PATCH 10/11] Fix: Correct user retrieval by ID #20 --- app/Http/Controllers/UserController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 9e3f1e4..6446406 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -18,7 +18,7 @@ public function showAllUsers() public function showOneUser($id) { - $user = User::find('id', $id); + $user = User::find($id); if (!$user) { (new ErrorController)->saveError(static::class, 404, 'Could not find user'); From e0b3dd49d33890a52c4360ac79e21f514304a5c8 Mon Sep 17 00:00:00 2001 From: Matheus Thibau Date: Tue, 12 May 2026 08:58:30 -0300 Subject: [PATCH 11/11] Fix: Update digital voice handling #21 --- app/Http/Controllers/RadioController.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/RadioController.php b/app/Http/Controllers/RadioController.php index 77760eb..9e30ad7 100755 --- a/app/Http/Controllers/RadioController.php +++ b/app/Http/Controllers/RadioController.php @@ -917,21 +917,21 @@ public function getDigitalVoice() $output = explode("\n", (string) exec_uc($command))[0]; if ($output == "OFF" || $output == "ON") { - return response()->json($output, 200); + return response($output, 200); } (new ErrorController)->saveError(static::class, 500, 'API Error: Error during getting the digital voice mode - ' . $output); return response()->json(['message' => 'Server error'], 500); } - public function setDigitalVoice(Request $request) - { - if ($request->value < 0 || $request->value > 1) { + public function setDigitalVoice(int $value) + { + if (!in_array((string) $value, ['0', '1'], true)) { (new ErrorController)->saveError(static::class, 500, 'API Error: digital voice value must be 0 or 1'); return response()->json(['message' => 'Server error'], 500); } - $command = "set_digital_voice -a " . $request->value. " -p 1"; + $command = "set_digital_voice -a " . $value. " -p 1"; $output = explode("\n", (string) exec_uc($command))[0]; if ($output == "OK") {