Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@

package com.google.sample.eddystonevalidator;

import static com.google.sample.eddystonevalidator.Constants.TLM_FRAME_TYPE;
import static com.google.sample.eddystonevalidator.TestUtils.DEVICE_ADDRESS;
import static com.google.sample.eddystonevalidator.TestUtils.INITIAL_RSSI;

import android.test.AndroidTestCase;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Arrays;

import static com.google.sample.eddystonevalidator.Constants.TLM_FRAME_TYPE;
import static com.google.sample.eddystonevalidator.TestUtils.DEVICE_ADDRESS;
import static com.google.sample.eddystonevalidator.TestUtils.INITIAL_RSSI;

/**
* Basic tests for the TlmValidator class.
*/
Expand Down Expand Up @@ -100,28 +100,6 @@ public void testTlmValidator_failsVoltageTooHigh() throws IOException {
assertFalse(beacon.tlmStatus.getErrors().isEmpty());
}

public void testTlmValidator_failsTempTooLow() throws IOException {
byte[] serviceData = tlmServiceData();
// -1 °C. No doubt that's a valid operating temperature for most beacons
// but are you really validating your beacons when it's this cold?
serviceData[4] = (byte) 0xff;
serviceData[5] = 0x00;
TlmValidator.validate(DEVICE_ADDRESS, serviceData, beacon);

assertNotNull(beacon.tlmStatus.errTemp);
assertFalse(beacon.tlmStatus.getErrors().isEmpty());
}

public void testTlmValidator_failsTempTooHigh() throws IOException {
byte[] serviceData = tlmServiceData();
serviceData[4] = 0x3d;
serviceData[5] = 0x00; // 61 °C.
TlmValidator.validate(DEVICE_ADDRESS, serviceData, beacon);

assertNotNull(beacon.tlmStatus.errTemp);
assertFalse(beacon.tlmStatus.getErrors().isEmpty());
}

public void testTlmValidator_passesTempNotSupported() throws IOException {
byte[] serviceData = tlmServiceData();
serviceData[4] = (byte) 0x80;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public class TlmValidator {
static final float TEMPERATURE_NOT_SUPPORTED = -128.0f;

// Minimum expected temperature value in beacon telemetry in degrees Celsius.
static final float MIN_EXPECTED_TEMP = 0.0f;
static final float MIN_EXPECTED_TEMP = -127.0f;

// Maximum expected temperature value in beacon telemetry in degrees Celsius.
static final float MAX_EXPECTED_TEMP = 60.0f;
static final float MAX_EXPECTED_TEMP = 128.0f;

// Maximum expected PDU count in beacon telemetry.
// The fastest we'd expect to see a beacon transmitting would be about 10 Hz.
Expand Down