Commit a22ce6af authored by vimala.v's avatar vimala.v Committed by Erich Keane

Enabled EDR and BLE adapter in RI

- Added EDR and BLE connectivity types for sending Response.
- Parsing of EDR and BLE adapter address in Request URI.

Verification of IP and EDR adapter was done in Tizen with the above changes.

Change-Id: I70ebc099497ab744c4d822e65c94e0610d338e13
Signed-off-by: default avatarvimala.v <vimala.v@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1634Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarErich Keane <erich.keane@intel.com>
parent 1503c9ca
......@@ -535,9 +535,9 @@ OCStackResult HandleSingleResponse(OCEntityHandlerResponse * ehResponse)
}
#ifdef WITH_PRESENCE
//TODO: Add other connectivity types to CAConnTypes[] when enabled
CATransportAdapter_t CAConnTypes[] = {CA_ADAPTER_IP};
const char * connTypes[] = {"IP"};
CATransportAdapter_t CAConnTypes[] = {CA_ADAPTER_IP, CA_ADAPTER_GATT_BTLE,
CA_ADAPTER_RFCOMM_BTEDR};
const char * connTypes[] = {"ip" , "ble", "edr"};
int size = sizeof(CAConnTypes)/ sizeof(CATransportAdapter_t);
CATransportAdapter_t adapter = responseEndpoint.adapter;
CAResult_t caResult = CA_STATUS_FAILED;
......
......@@ -1723,48 +1723,67 @@ static OCStackResult ParseRequestUri(const char *fullUri,
// processs url prefix, if any
size_t urlLen = slash - start;
// port
uint16_t port = 0;
size_t len = 0;
if (urlLen && devAddr)
{ // construct OCDevAddr
if (start[0] == '[')
{ // ipv6 address
char *close = strchr(++start, ']');
if (!close || close > slash)
if (OC_ADAPTER_IP == adapter)
{
if (start[0] == '[')
{ // ipv6 address
char *close = strchr(++start, ']');
if (!close || close > slash)
{
return OC_STACK_INVALID_URI;
}
end = close;
if (close[1] == ':')
{
colon = close + 1;
}
}
else
{ // ipv4 address
end = slash;
colon = strchr(start, ':');
end = (colon && colon < slash) ? colon : slash;
}
len = end - start;
if (len >= sizeof(da->addr))
{
return OC_STACK_INVALID_URI;
}
end = close;
if (close[1] == ':')
// use standard multicast port
if (colon && colon < slash)
{
colon = close + 1;
for (colon++; colon < slash; colon++)
{
char c = colon[0];
if (c < '0' || c > '9')
{
return OC_STACK_INVALID_URI;
}
port = 10 * port + c - '0';
}
}
}
else
{ // ipv4 address
{
/**
* This is for Non-IP adapters(EDR and BLE).
* The address will be between "//" and "/" in the request URI.
* [Ex. coap://AB:BC:CD:DE:EF:FG/resource_uri]
*/
end = slash;
colon = strchr(start, ':');
end = (colon && colon < slash) ? colon : slash;
}
size_t len = end - start;
len = end - start;
if (len >= sizeof(da->addr))
{
return OC_STACK_INVALID_URI;
}
// port
uint16_t port = 0; // use standard multicast port
if (colon && colon < slash)
{
for (colon++; colon < slash; colon++)
{
char c = colon[0];
if (c < '0' || c > '9')
{
return OC_STACK_INVALID_URI;
}
port = 10 * port + c - '0';
}
}
da = (OCDevAddr *)OICCalloc(sizeof (OCDevAddr), 1);
if (!da)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment