Skip to content

Commit

Permalink
Merge pull request #79 from andresag01/develop
Browse files Browse the repository at this point in the history
Introduced fix for defect IOTSFW-1058
  • Loading branch information
rgrover committed Oct 22, 2015
2 parents d43b1d1 + f8e3d2f commit 4c76373
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ble/services/EddystoneConfigService.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ class EddystoneConfigService
eddyServ.setTLMFrameData(params.tlmVersion, params.tlmBeaconPeriod);
}
if (params.uriEnabled) {
eddyServ.setURLFrameData(params.advPowerLevels[params.txPowerMode], (const char *) params.uriData, params.uriBeaconPeriod);
eddyServ.setURLFrameEncodedData(params.advPowerLevels[params.txPowerMode], (const char *) params.uriData, params.uriDataLength, params.uriBeaconPeriod);
}
if (params.uidEnabled) {
eddyServ.setUIDFrameData(params.advPowerLevels[params.txPowerMode],
Expand Down
26 changes: 25 additions & 1 deletion ble/services/EddystoneService.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,40 @@ class EddystoneService
urlIsSet = false;
return false;
}
defaultUrlPower = power;
encodeURL(urlIn, defaultUriData, defaultUriDataLength); // encode URL to URL Formatting
if (defaultUriDataLength > URI_DATA_MAX) {
return true; // error, URL is too big
}
defaultUrlPower = power;
urlAdvPeriod = urlAdvPeriodIn;
urlIsSet = true;
return false;
}

/**
* Set Eddystone URL Frame information.
* @param[in] power TX Power in dB measured at 0 meters from the device.
* @param[in] encodedUrlIn Encoded URL
* @param[in] encodedUrlInLength Length of the encoded URL
* @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) {
urlIsSet = false;
return false;
}
memcpy(defaultUriData, encodedUrlIn, encodedUrlInLength);
if (defaultUriDataLength > URI_DATA_MAX) {
return true; // error, URL is too big
}
defaultUrlPower = power;
defaultUriDataLength = encodedUrlInLength;
urlAdvPeriod = urlAdvPeriodIn;
urlIsSet = true;
return false;
}

/*
* Construct URL frame from private variables
* @param[in/out] Data pointer to array to store constructed frame in
Expand Down

0 comments on commit 4c76373

Please sign in to comment.