Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix beaconPeriod and defaults for voltage/temp #94

Merged
merged 2 commits into from
Nov 2, 2015
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
4 changes: 2 additions & 2 deletions ble/services/EddystoneConfigService.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class EddystoneConfigService
DBG("Setting Default TLM Data, version = %d, advPeriodInMind= %f", tlmVersionIn, advPeriodInSec);
defaultTlmVersion = tlmVersionIn;
TlmBatteryVoltage = 0;
TlmBeaconTemp = 0;
TlmBeaconTemp = 0x8000;
TlmPduCount = 0;
TlmTimeSinceBoot = 0;
defaultTlmAdvPeriod = advPeriodInSec;
Expand Down Expand Up @@ -389,7 +389,7 @@ class EddystoneConfigService
params.flags = 0x10;
memcpy(params.advPowerLevels, defaultAdvPowerLevels, sizeof(PowerLevels_t));
params.txPowerMode = TX_POWER_MODE_LOW;
params.beaconPeriod = 1000;
params.beaconPeriod = (uint16_t) defaultUriAdvPeriod * 1000;

// TLM Frame
params.tlmVersion = defaultTlmVersion;
Expand Down
26 changes: 13 additions & 13 deletions ble/services/EddystoneService.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ class EddystoneService
void setUIDFrameData(int8_t power,
UIDNamespaceID_t namespaceID,
UIDInstanceID_t instanceID,
uint32_t uidAdvPeriodIn,
float uidAdvPeriodIn,
uint16_t RFU = 0x0000) {
if (0 == uidAdvPeriodIn) {
if (0.0f == uidAdvPeriodIn) {
uidIsSet = false;
return;
}
Expand Down Expand Up @@ -170,8 +170,8 @@ class EddystoneService
* @param[in] urlAdvPeriodIn How long to advertise the URL frame (measured in # of adv periods)
* @return false on success, true on failure.
*/
bool setURLFrameData(int8_t power, const char *urlIn, uint32_t urlAdvPeriodIn) {
if (0 == urlAdvPeriodIn) {
bool setURLFrameData(int8_t power, const char *urlIn, float urlAdvPeriodIn) {
if (0.0f == urlAdvPeriodIn) {
urlIsSet = false;
return false;
}
Expand All @@ -193,8 +193,8 @@ class EddystoneService
* @param[in] urlAdvPeriodIn How long to advertise the URL frame (measured in # of adv periods)
* @return false on success, true on failure.
*/
bool setURLFrameEncodedData(int8_t power, const char *encodedUrlIn, uint8_t encodedUrlInLength, uint32_t urlAdvPeriodIn) {
if (0 == urlAdvPeriodIn) {
bool setURLFrameEncodedData(int8_t power, const char *encodedUrlIn, uint8_t encodedUrlInLength, float urlAdvPeriodIn) {
if (0.0f == urlAdvPeriodIn) {
urlIsSet = false;
return false;
}
Expand Down Expand Up @@ -235,12 +235,12 @@ class EddystoneService
*
*/
void setTLMFrameData(uint8_t version = 0,
uint32_t advPeriod = 60,
float advPeriod = 60.0f,
uint16_t batteryVoltage = 0,
uint16_t beaconTemp = 0,
uint16_t beaconTemp = 0x8000,
uint32_t pduCount = 0,
uint32_t timeSinceBoot = 0) {
if (0 == advPeriod) {
if (0.0f == advPeriod) {
tlmIsSet = false;
return;
}
Expand Down Expand Up @@ -507,7 +507,7 @@ class EddystoneService
// Initialize Frame transition, start with URL to pass eddystone validator app on first try
if (urlIsSet) {
frameIndex = url;
urlTicker.attach(this, &EddystoneService::urlCallback, urlAdvPeriod);
urlTicker.attach(this, &EddystoneService::urlCallback, (float) advPeriodus / 1000.0f);
DBG("attached urlCallback every %d seconds", urlAdvPeriod);
}
if (uidIsSet) {
Expand Down Expand Up @@ -552,7 +552,7 @@ class EddystoneService
UriData_t defaultUriData;
int8_t defaultUrlPower;
bool urlIsSet; // flag that enables / disable URI Frames
uint32_t urlAdvPeriod; // how long the url frame will be advertised for
float urlAdvPeriod; // how long the url frame will be advertised for
Ticker urlTicker;

// UID Frame Variables
Expand All @@ -561,7 +561,7 @@ class EddystoneService
int8_t defaultUidPower;
uint16_t uidRFU;
bool uidIsSet; // flag that enables / disable UID Frames
uint32_t uidAdvPeriod; // how long the uid frame will be advertised for
float uidAdvPeriod; // how long the uid frame will be advertised for
Ticker uidTicker;

// TLM Frame Variables
Expand All @@ -571,7 +571,7 @@ class EddystoneService
volatile uint32_t TlmPduCount;
volatile uint32_t TlmTimeSinceBoot;
bool tlmIsSet; // flag that enables / disables TLM frames
uint32_t TlmAdvPeriod; // number of minutes between adv frames
float TlmAdvPeriod; // number of minutes between adv frames
Ticker tlmTicker;

public:
Expand Down