mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-08-24 16:21:16 +02:00
Move another file from AmazfitBip to Huami which is no longer Bip specific
This commit is contained in:
parent
ff7886765f
commit
f99bc0de64
@ -15,7 +15,7 @@
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip;
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -34,8 +34,8 @@ import nodomain.freeyourgadget.gadgetbridge.model.ActivityTrack;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.GPSCoordinate;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.BLETypeConversions;
|
||||
|
||||
public class ActivityDetailsParser {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ActivityDetailsParser.class);
|
||||
public class HuamiActivityDetailsParser {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(HuamiActivityDetailsParser.class);
|
||||
|
||||
private static final byte TYPE_GPS = 0;
|
||||
private static final byte TYPE_HR = 1;
|
||||
@ -65,7 +65,7 @@ public class ActivityDetailsParser {
|
||||
|
||||
private boolean skipCounterByte;
|
||||
|
||||
public ActivityDetailsParser(BaseActivitySummary summary) {
|
||||
public HuamiActivityDetailsParser(BaseActivitySummary summary) {
|
||||
this.summary = summary;
|
||||
// this.version = version;
|
||||
// this.baseDate = baseDate;
|
@ -40,7 +40,7 @@ import nodomain.freeyourgadget.gadgetbridge.model.ActivityTrack;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.BLETypeConversions;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.ActivityDetailsParser;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiActivityDetailsParser;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.DateTimeUtils;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||
@ -86,7 +86,7 @@ public class FetchSportsDetailsOperation extends AbstractFetchOperation {
|
||||
|
||||
|
||||
if (success) {
|
||||
ActivityDetailsParser parser = new ActivityDetailsParser(summary);
|
||||
HuamiActivityDetailsParser parser = new HuamiActivityDetailsParser(summary);
|
||||
parser.setSkipCounterByte(false); // is already stripped
|
||||
try {
|
||||
ActivityTrack track = parser.parse(buffer.toByteArray());
|
||||
|
@ -19,10 +19,10 @@ public class HexToBinaryInputStreamTest extends TestBase {
|
||||
byte[] hexString;
|
||||
byte[] binString;
|
||||
|
||||
try (InputStream in = ActivityDetailsParserTest.class.getClassLoader().getResourceAsStream("ActivityDetailsDump1.txt")) {
|
||||
try (InputStream in = HuamiActivityDetailsParserTest.class.getClassLoader().getResourceAsStream("ActivityDetailsDump1.txt")) {
|
||||
hexString = FileUtils.readAll(in, 1024 * 1024);
|
||||
assertTrue(hexString.length > 1);
|
||||
try (InputStream in2 = getContents(ActivityDetailsParserTest.class.getClassLoader().getResource("ActivityDetailsDump1.txt"))) {
|
||||
try (InputStream in2 = getContents(HuamiActivityDetailsParserTest.class.getClassLoader().getResource("ActivityDetailsDump1.txt"))) {
|
||||
binString = FileUtils.readAll(in2, 1024 * 1024);
|
||||
assertTrue(binString.length > 1);
|
||||
}
|
||||
|
@ -17,15 +17,15 @@ import nodomain.freeyourgadget.gadgetbridge.export.GPXExporter;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivityPoint;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivityTrack;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.BLETypeConversions;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.ActivityDetailsParser;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiActivityDetailsParser;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.DateTimeUtils;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class ActivityDetailsParserTest extends TestBase {
|
||||
private static final URL DETAILS_1 = ActivityDetailsParserTest.class.getClassLoader().getResource("ActivityDetailsDump1.txt");
|
||||
public class HuamiActivityDetailsParserTest extends TestBase {
|
||||
private static final URL DETAILS_1 = HuamiActivityDetailsParserTest.class.getClassLoader().getResource("ActivityDetailsDump1.txt");
|
||||
private static final long MAX_DETAILS = 1024 * 1024;
|
||||
private static Date baseTime;
|
||||
|
||||
@ -38,7 +38,7 @@ public class ActivityDetailsParserTest extends TestBase {
|
||||
public void testActivityDetails() throws Exception {
|
||||
BipActivitySummary summary = createSummary();
|
||||
|
||||
ActivityDetailsParser parser = new ActivityDetailsParser(summary);
|
||||
HuamiActivityDetailsParser parser = new HuamiActivityDetailsParser(summary);
|
||||
parser.setSkipCounterByte(true);
|
||||
try (InputStream in = getContents(DETAILS_1)) {
|
||||
ActivityTrack track = parser.parse(FileUtils.readAll(in, MAX_DETAILS));
|
||||
@ -79,7 +79,7 @@ public class ActivityDetailsParserTest extends TestBase {
|
||||
summary.setBaseLatitude(baseLati);
|
||||
summary.setBaseAltitude(baseAlti);
|
||||
|
||||
ActivityDetailsParser parser = new ActivityDetailsParser(summary);
|
||||
HuamiActivityDetailsParser parser = new HuamiActivityDetailsParser(summary);
|
||||
parser.setSkipCounterByte(true);
|
||||
try (InputStream in = getContents(DETAILS_1)) {
|
||||
ActivityTrack track = parser.parse(FileUtils.readAll(in, MAX_DETAILS));
|
Loading…
Reference in New Issue
Block a user