Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>com.ajinkyagokhale</groupId>
<artifactId>espflasher</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
<packaging>jar</packaging>

<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.ajinkyagokhale.espflasher.model;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;

public class FirmwareDefinition {

private final String name;
private final String description;
private final String githubRepo;
private final String websiteUrl;
private final Map<String, String> chipBinMap;

// constructor
public FirmwareDefinition(String name, String description,
String githubRepo, String websiteUrl,
Map<String, String> chipBinMap) {
this.name = name;
this.description = description;
this.githubRepo = githubRepo;
this.websiteUrl = websiteUrl;
this.chipBinMap = chipBinMap == null
? Collections.emptyMap()
: Collections.unmodifiableMap(new LinkedHashMap<>(chipBinMap));
}

public String getName() { return name; }
public String getDescription() { return description; }
public String getGithubRepo() { return githubRepo; }
public String getWebsiteUrl() { return websiteUrl; }
@SuppressFBWarnings(value = "EI_EXPOSE_REP",
justification = "chipBinMap is an unmodifiableMap wrapping a defensive copy; safe to expose")
public Map<String, String> getChipBinMap() { return chipBinMap; }

public String getBinForChip(String chip) {
return chipBinMap.getOrDefault(chip, chipBinMap.get("default"));
}

@Override
public String toString() { return name; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.ajinkyagokhale.espflasher.service;

import com.ajinkyagokhale.espflasher.model.FirmwareDefinition;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public class FirmwareCatalog {

public static List<FirmwareDefinition> getCatalog() {
return List.of(
new FirmwareDefinition(
"Tasmota",
"Universal smart home firmware with web UI and MQTT",
"arendst/Tasmota",
"https://tasmota.github.io",
tasmotaBins()
),
new FirmwareDefinition(
"Tasmota SML (ottelo9)",
"Tasmota with SML support for smart meter reading",
"ottelo9/tasmota-sml-images",
"https://github.com/ottelo9/tasmota-sml-images",
tasmotaSmlBins()
)
);
}

private static Map<String, String> tasmotaBins() {
LinkedHashMap<String, String> m = new LinkedHashMap<>();
m.put("esp32c6", "tasmota32c6.bin");
m.put("esp32", "tasmota32.bin");
m.put("esp32s2", "tasmota32s2.bin");
m.put("esp32s3", "tasmota32s3.bin");
m.put("esp32c3", "tasmota32c3.bin");
m.put("esp8266", "tasmota.bin");
m.put("default", "tasmota32.bin");
return m;
}

private static Map<String, String> tasmotaSmlBins() {
LinkedHashMap<String, String> m = new LinkedHashMap<>();
m.put("esp32c6", "tasmota32c6_ottelo_tas.zip");
m.put("esp32", "tasmota32_ottelo_tas.zip");
m.put("esp32s2", "tasmota32s2_ottelo_tas.zip");
m.put("esp32s3", "tasmota32s3_ottelo_tas.zip");
m.put("esp32c3", "tasmota32c3_ottelo_tas.zip");
m.put("esp8266", "tasmota8266_bundle_ottelo.zip");
m.put("default", "tasmota32_ottelo_tas.zip");
return m;
}

}
Loading
Loading