Skip to content

Commit

Permalink
Removed 'netcat' default log4j logging, removed deprecated PVOutput s…
Browse files Browse the repository at this point in the history
…tuff, removed MX convenience fields
  • Loading branch information
retrodaredevil committed Aug 31, 2021
1 parent d0dc7e9 commit 2e836f8
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 59 deletions.
8 changes: 4 additions & 4 deletions client/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
</Delete>
</DefaultRolloverStrategy>
</RollingFile>
<ServerSocket name="logAllToLocalSocket" host="localhost" port="15400" ignoreExceptions="false">
<PatternLayout pattern="${LOG_PATTERN}"/>
</ServerSocket>
<!-- <ServerSocket name="logAllToLocalSocket" host="localhost" port="15400" ignoreExceptions="false">-->
<!-- <PatternLayout pattern="${LOG_PATTERN}"/>-->
<!-- </ServerSocket>-->

<RollingFile name="logInfo" fileName="${logPath}/log_info.log" filePattern="${logPath}/log_info_%d{yyyy.MM.dd}-%i.log.gz"
filePermissions="${filePermissions}">
Expand Down Expand Up @@ -64,7 +64,7 @@
<Loggers>
<Root level="DEBUG" >
<AppenderRef ref="Console" level="DEBUG"/>
<AppenderRef ref="logAllToLocalSocket" level="DEBUG"/>
<!-- <AppenderRef ref="logAllToLocalSocket" level="DEBUG"/>-->
</Root>
<Logger name="me.retrodaredevil.solarthing">
<AppenderRef ref="logAll" level="DEBUG"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import me.retrodaredevil.solarthing.annotations.NotNull;
import me.retrodaredevil.solarthing.annotations.Nullable;
import me.retrodaredevil.solarthing.packets.identification.IdentityInfo;
import me.retrodaredevil.solarthing.packets.support.Support;
import me.retrodaredevil.solarthing.solar.outback.OutbackIdentifier;
Expand All @@ -13,6 +14,7 @@
"batteryVoltageString", "dailyKWHString", "ampChargerCurrentString"
}, allowGetters = true)
final class ImmutableMXStatusPacket implements MXStatusPacket {
private final @Nullable Integer packetVersion;
private final int address;
private final int chargerCurrent, pvCurrent, inputVoltage;
private final float dailyKWH;
Expand All @@ -30,6 +32,7 @@ final class ImmutableMXStatusPacket implements MXStatusPacket {

@JsonCreator
ImmutableMXStatusPacket(
@JsonProperty("packetVersion") Integer packetVersion,
@JsonProperty(value = "address", required = true) int address, @JsonProperty(value = "chargerCurrent", required = true) int chargerCurrent, @JsonProperty(value = "pvCurrent", required = true) int pvCurrent, @JsonProperty(value = "inputVoltage", required = true) int inputVoltage,
@JsonProperty(value = "dailyKWH", required = true) float dailyKWH,
@JsonProperty(value = "ampChargerCurrent", required = true) float ampChargerCurrent,
Expand All @@ -38,6 +41,7 @@ final class ImmutableMXStatusPacket implements MXStatusPacket {
@JsonProperty(value = "dailyAH", required = true) int dailyAH, @JsonProperty(value = "dailyAHSupport") Support dailyAHSupport,
@JsonProperty(value = "chksum", required = true) int chksum
) {
this.packetVersion = packetVersion;
this.address = address;
this.chargerCurrent = chargerCurrent;
this.pvCurrent = pvCurrent;
Expand All @@ -56,6 +60,11 @@ final class ImmutableMXStatusPacket implements MXStatusPacket {
this.identityInfo = new MXIdentityInfo(address);
}

@Override
public @Nullable Integer getPacketVersion() {
return packetVersion;
}

@Override
public @NotNull IdentityInfo getIdentityInfo() {
return identityInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import me.retrodaredevil.solarthing.annotations.*;
import me.retrodaredevil.solarthing.packets.Modes;
import me.retrodaredevil.solarthing.packets.VersionedPacket;
import me.retrodaredevil.solarthing.packets.support.Support;
import me.retrodaredevil.solarthing.solar.SolarStatusPacketType;
import me.retrodaredevil.solarthing.solar.common.BasicChargeController;
Expand All @@ -23,7 +24,11 @@
@JsonDeserialize(as = ImmutableMXStatusPacket.class)
@JsonTypeName("MXFM_STATUS")
@JsonExplicit
public interface MXStatusPacket extends OutbackStatusPacket, BasicChargeController, DailyChargeController, BatteryVoltage {
public interface MXStatusPacket extends OutbackStatusPacket, BasicChargeController, DailyChargeController, BatteryVoltage, VersionedPacket {

/** This version indicates that the packet no longer has convenience string fields. This indicates a different in serialization, not in underlying data. */
int VERSION_NO_MORE_CONVENIENCE_FIELDS = 2;

@DefaultFinal
@Override
default @NotNull SolarStatusPacketType getPacketType(){
Expand Down Expand Up @@ -186,10 +191,9 @@ default int getAuxModeValue() {
* Should be serialized as "dailyAHSupport". Should be serialized using {@link Support#toString()}
* @return A {@link Support} enum constant indicating whether or not {@link #getDailyAH()} is supported
*/
@NotNull
@JsonProperty("dailyAHSupport")
@Override
Support getDailyAHSupport();
@NotNull Support getDailyAHSupport();

/**
* Should be serialized as "chksum"
Expand All @@ -200,10 +204,13 @@ default int getAuxModeValue() {
// endregion

// region Convenience Strings
@ConvenienceField
@JsonProperty("auxModeName")
default @NotNull String getAuxModeName(){ return getAuxMode().getModeName(); }
@ConvenienceField
@JsonProperty("errors")
default @NotNull String getErrorsString(){ return Modes.toString(MXErrorMode.class, getErrorModeValue()); }
@ConvenienceField
@JsonProperty("chargerModeName")
default @NotNull String getChargerModeName(){ return getChargingMode().getModeName(); }
// endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public static ImmutableMXStatusPacket createFromChars(char[] chars, IgnoreCheckS
}

return new ImmutableMXStatusPacket(
MXStatusPacket.VERSION_NO_MORE_CONVENIENCE_FIELDS,
address, chargerCurrent, pvCurrent, inputVoltage, dailyKWH,
ampChargerCurrent, auxMode, errorMode, chargerMode,
batteryVoltage, dailyAH, dailyAHSupported, chksum
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package me.retrodaredevil.solarthing.pvoutput.service;

import me.retrodaredevil.solarthing.pvoutput.data.AddBatchOutputParameters;
import me.retrodaredevil.solarthing.pvoutput.data.DeprecatedAddBatchOutputParameters;
import me.retrodaredevil.solarthing.pvoutput.data.AddOutputParameters;
import me.retrodaredevil.solarthing.pvoutput.data.AddStatusParameters;
import retrofit2.Call;
Expand All @@ -20,10 +19,6 @@ public interface PVOutputService {
@POST("addstatus.jsp") // or get
Call<String> addStatus(@Body AddStatusParameters parameters);

@Deprecated
@POST("addbatchoutput.jsp")
Call<String> addDeprecatedBatchOutput(@Body DeprecatedAddBatchOutputParameters parameters);

@GET("jointeam.jsp")
Call<String> joinTeam(@Query("tid") int teamId);
}

0 comments on commit 2e836f8

Please sign in to comment.