igpsport: Removed all RuntimeException from igpsport and minor fixes

This commit is contained in:
Vitaliy Tomin
2026-05-13 23:33:24 +02:00
committed by José Rebelo
parent 5f9114c221
commit 6255057772
6 changed files with 17 additions and 9 deletions
@@ -148,7 +148,7 @@ public class IGPSportRouteInstallHandler implements InstallHandler {
R.string.installhandler_firmware_name, R.string.installhandler_firmware_name,
mContext.getString(coordinator.getDeviceNameResource()), mContext.getString(coordinator.getDeviceNameResource()),
mContext.getString(R.string.kind_gpx_route), mContext.getString(R.string.kind_gpx_route),
"test" //FIXME filename
); );
return new GenericItem(firmwareName); return new GenericItem(firmwareName);
} }
@@ -946,7 +946,7 @@ public enum DeviceType {
SILVERCREST_SBM_67(SilverCrestSBM67Coordinator.class), SILVERCREST_SBM_67(SilverCrestSBM67Coordinator.class),
BRAUN_BPW4500(BraunBPW4500DeviceCoordinator.class), BRAUN_BPW4500(BraunBPW4500DeviceCoordinator.class),
IGPSPORT_BSC200(IGPSportBSC200Coordinator.class), IGPSPORT_BSC200(IGPSportBSC200Coordinator.class),
IGPSPORT_BSC200s(IGPSportBSC200SCoordinator.class), IGPSPORT_BSC200S(IGPSportBSC200SCoordinator.class),
IGPSPORT_IGS630(IGPSportiGS630Coordinator.class), IGPSPORT_IGS630(IGPSportiGS630Coordinator.class),
IGPSPORT_IGS800(IGPSportiGS800Coordinator.class), IGPSPORT_IGS800(IGPSportiGS800Coordinator.class),
TEST(TestDeviceCoordinator.class); TEST(TestDeviceCoordinator.class);
@@ -265,7 +265,7 @@ public class IGPSportDeviceSupport extends AbstractBTLESingleDeviceSupport {
LOG.error("Unknown general operation received"); LOG.error("Unknown general operation received");
} }
} catch (InvalidProtocolBufferException e) { } catch (InvalidProtocolBufferException e) {
throw new RuntimeException(e); LOG.error("Failed to parse protobuf packet" + e);
} }
} }
@@ -54,7 +54,7 @@ import nodomain.freeyourgadget.gadgetbridge.util.notifications.GBProgressNotific
public class IGPSportDownloadManager { public class IGPSportDownloadManager {
Logger LOG = LoggerFactory.getLogger(nodomain.freeyourgadget.gadgetbridge.service.devices.igpsport.IGPSportDownloadManager.class); Logger LOG = LoggerFactory.getLogger(IGPSportDownloadManager.class);
private IGPSportDeviceSupport support = null; private IGPSportDeviceSupport support = null;
private List<FileInfo> avaliableActivityFiles = new ArrayList<>(); private List<FileInfo> avaliableActivityFiles = new ArrayList<>();
private ByteArrayOutputStream recievingDataBuffer; private ByteArrayOutputStream recievingDataBuffer;
@@ -151,7 +151,7 @@ public class IGPSportDownloadManager {
try { try {
recievingDataBuffer.write(data); recievingDataBuffer.write(data);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); LOG.error("Failed to add data to buffer" + e);
} }
if (firstChunk) { if (firstChunk) {
@@ -166,7 +166,7 @@ public class IGPSportDownloadManager {
downloadInProgress = false; downloadInProgress = false;
File dir; File dir;
File outputFile; File outputFile = null;
try { try {
dir = support.getWritableExportDirectory(); dir = support.getWritableExportDirectory();
@@ -180,7 +180,7 @@ public class IGPSportDownloadManager {
outputFile.setLastModified(garminTimestampToJavaMillis(downloadingFile.getGarminTimeStamp())); outputFile.setLastModified(garminTimestampToJavaMillis(downloadingFile.getGarminTimeStamp()));
filesToProcess.add(outputFile); filesToProcess.add(outputFile);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); LOG.error("Failed to save fit file to: " + outputFile.getAbsolutePath() + e);
} }
syncNextFile(); syncNextFile();
@@ -16,6 +16,11 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.service.devices.igpsport; package nodomain.freeyourgadget.gadgetbridge.service.devices.igpsport;
import android.widget.Toast;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@@ -28,8 +33,10 @@ import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec;
import nodomain.freeyourgadget.gadgetbridge.proto.igpsport.Back; import nodomain.freeyourgadget.gadgetbridge.proto.igpsport.Back;
import nodomain.freeyourgadget.gadgetbridge.proto.igpsport.Common; import nodomain.freeyourgadget.gadgetbridge.proto.igpsport.Common;
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
public class IGPSportWeather { public class IGPSportWeather {
Logger LOG = LoggerFactory.getLogger(IGPSportWeather.class);
IGPSportDeviceSupport support; IGPSportDeviceSupport support;
public IGPSportWeather(IGPSportDeviceSupport support) { public IGPSportWeather(IGPSportDeviceSupport support) {
this.support = support; this.support = support;
@@ -38,6 +45,7 @@ public class IGPSportWeather {
// A static map to hold the conversion logic from OWM to QWeather. // A static map to hold the conversion logic from OWM to QWeather.
private static final Map<Integer, Integer> codeMap = new HashMap<>(); private static final Map<Integer, Integer> codeMap = new HashMap<>();
// Static initializer block to populate the map with conversion data. // Static initializer block to populate the map with conversion data.
static { static {
// === OWM Group 2xx: Thunderstorm === // === OWM Group 2xx: Thunderstorm ===
@@ -193,7 +201,7 @@ public class IGPSportWeather {
builder.queue(); builder.queue();
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); LOG.error("Failed to encode weather " + e);
} }
} }
+1 -1
View File
@@ -2251,7 +2251,7 @@
<string name="devicetype_earfun_air_pro_4" translatable="false">EarFun Air Pro 4</string> <string name="devicetype_earfun_air_pro_4" translatable="false">EarFun Air Pro 4</string>
<string name="devicetype_atc_ble_oepl" translatable="false">ATC_BLE_OEPL</string> <string name="devicetype_atc_ble_oepl" translatable="false">ATC_BLE_OEPL</string>
<string name="devicetype_igpsport_bsc200" translatable="false">iGPSPORT BSC200</string> <string name="devicetype_igpsport_bsc200" translatable="false">iGPSPORT BSC200</string>
<string name="devicetype_igpsport_bsc200s" translatable="false">iGPSPORT BSC200s</string> <string name="devicetype_igpsport_bsc200s" translatable="false">iGPSPORT BSC200S</string>
<string name="devicetype_igpsport_igs630" translatable="false">iGPSPORT iGS630</string> <string name="devicetype_igpsport_igs630" translatable="false">iGPSPORT iGS630</string>
<string name="devicetype_igpsport_igs800" translatable="false">iGPSPORT iGS800</string> <string name="devicetype_igpsport_igs800" translatable="false">iGPSPORT iGS800</string>
<string name="task_installing_route">Installing route</string> <string name="task_installing_route">Installing route</string>