/*****************************************************************************/
OCStackResult TWInitialize(PIPlugin_Zigbee* plugin, const char* deviceDevPath)
{
- OC_LOG(INFO, TAG, "Enter TWInitialize()");
+ OIC_LOG(INFO, TAG, "Enter TWInitialize()");
TWResultCode twCode = TW_RESULT_ERROR;
ctx->g_plugin = plugin;
ctx->g_port = deviceDevPath;
- OC_LOG_V(INFO, TAG, "Attempt to open %s", deviceDevPath);
+ OIC_LOG_V(INFO, TAG, "Attempt to open %s", deviceDevPath);
twCode = TWStartSock(ctx->g_plugin, deviceDevPath); //TODO:
if (twCode != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "Failed to open %s because of error: %d", deviceDevPath, twCode);
+ OIC_LOG_V(ERROR, TAG, "Failed to open %s because of error: %d", deviceDevPath, twCode);
OICFree(ctx);
return OC_STACK_ERROR;
}
twCode = TWGetEUI(ctx->g_plugin, &eui);
if (twCode != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "Failed to get EUI because of error: %d", twCode);
+ OIC_LOG_V(ERROR, TAG, "Failed to get EUI because of error: %d", twCode);
OICFree(ctx);
return OC_STACK_ERROR;
}
OICStrcpy(ctx->g_LocalEUI, sizeof(ctx->g_LocalEUI), eui);
- OC_LOG_V(INFO, TAG, "LocalEUI=%s", ctx->g_LocalEUI);
+ OIC_LOG_V(INFO, TAG, "LocalEUI=%s", ctx->g_LocalEUI);
OICFree(eui);
bool wantReset = false; //TODO:
twCode = Reset(ctx);
if (twCode != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "ZigBee Initialization - Reset");
+ OIC_LOG(ERROR, TAG, "ZigBee Initialization - Reset");
OICFree(ctx);
return OC_STACK_ERROR;
}
twCode = CreatePAN(ctx);
if (twCode != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "CreatePan Failed");
- OC_LOG(ERROR, TAG, "TWInitialize() - MUST STOP NOW");
+ OIC_LOG(ERROR, TAG, "CreatePan Failed");
+ OIC_LOG(ERROR, TAG, "TWInitialize() - MUST STOP NOW");
ctx->g_ZigBeeStatus.state = ZB_STATE_UNKNOWN;
OICFree(ctx);
return OC_STACK_ERROR;
}
else
{
- OC_LOG(INFO, TAG, "CreatePan Succeed");
- OC_LOG(INFO, TAG, "TWInitialize() Succeed");
+ OIC_LOG(INFO, TAG, "CreatePan Succeed");
+ OIC_LOG(INFO, TAG, "TWInitialize() Succeed");
ctx->g_ZigBeeStatus.state = ZB_STATE_INIT;
LL_APPEND(g_twContextList, ctx);
return OC_STACK_OK;
OCStackResult TWDiscover(PIPlugin_Zigbee* plugin)
{
- OC_LOG(INFO, TAG, "Enter TWDiscover()");
+ OIC_LOG(INFO, TAG, "Enter TWDiscover()");
OCStackResult ret = OC_STACK_ERROR;
TWResultCode twRet = TW_RESULT_ERROR;
TWContext* ctx = GetTWContext(plugin);
if (ctx == NULL)
{
- OC_LOG(ERROR, TAG, "Invalid Param");
+ OIC_LOG(ERROR, TAG, "Invalid Param");
return OC_STACK_INVALID_PARAM;
}
if (ctx->g_DeviceFoundCallback == NULL)
{
- OC_LOG(INFO, TAG, "Required TWDeviceFoundCallback.");
+ OIC_LOG(INFO, TAG, "Required TWDeviceFoundCallback.");
return OC_STACK_ERROR;
}
twRet = EnableJoin(false, ctx);
if (twRet != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "EnableJoin");
+ OIC_LOG(ERROR, TAG, "EnableJoin");
return OC_STACK_ERROR;
}
twRet = FindMatchNodes(ctx);
if (twRet == TW_RESULT_OK)
{
- OC_LOG(INFO, TAG, "FindMatchNodes");
+ OIC_LOG(INFO, TAG, "FindMatchNodes");
ret = OC_STACK_OK;
}
else
{
- OC_LOG(ERROR, TAG, "FindMatchNodes");
+ OIC_LOG(ERROR, TAG, "FindMatchNodes");
ret = OC_STACK_ERROR;
}
- OC_LOG_V(INFO, TAG, "Leave TWDiscover() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TWDiscover() with ret=%d", ret);
return ret;
}
{
//Ask: AT+WRITEATR:5DA7,01,0,0003,0000,21,01
- OC_LOG(INFO, TAG, "Enter TWSetAttribute()");
+ OIC_LOG(INFO, TAG, "Enter TWSetAttribute()");
TWContext* ctx = GetTWContext(plugin);
if (ctx == NULL)
{
- OC_LOG(ERROR, TAG, "Invalid Param");
+ OIC_LOG(ERROR, TAG, "Invalid Param");
return OC_STACK_INVALID_PARAM;
}
char* cmdString = (char*)OICMalloc(size * sizeof(char));
if (cmdString == NULL)
{
- OC_LOG(ERROR, TAG, "No Memory");
+ OIC_LOG(ERROR, TAG, "No Memory");
ret = OC_STACK_ERROR;
goto exit;
}
twRet = TWIssueATCommand(ctx->g_plugin, cmdString);
if (twRet != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "Write %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "Write %s", cmdString);
ret = OC_STACK_ERROR;
goto exit;
}
- OC_LOG_V(INFO, TAG, "Write %s", cmdString);
+ OIC_LOG_V(INFO, TAG, "Write %s", cmdString);
TWEntry* entry = NULL;
twRet = TWDequeueEntry(ctx->g_plugin, &entry, TW_WRITEATTR);
if (twRet != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "TWDequeueEntry");
+ OIC_LOG(ERROR, TAG, "TWDequeueEntry");
ret = OC_STACK_ERROR;
goto exit;
}
if (entry == NULL)
{
- OC_LOG(INFO, TAG, "TWEntry is NULL.");
+ OIC_LOG(INFO, TAG, "TWEntry is NULL.");
ret = OC_STACK_ERROR;
goto exit;
}
twRet = processEntry(entry, ctx);
if (twRet == TW_RESULT_ERROR_INVALID_OP)
{
- OC_LOG_V(INFO, TAG, "Write %s - Invalid Operation", cmdString);
+ OIC_LOG_V(INFO, TAG, "Write %s - Invalid Operation", cmdString);
ret = OC_STACK_INVALID_OPTION;
goto exit;
}
if (twRet != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "processEntry");
+ OIC_LOG(ERROR, TAG, "processEntry");
ret = OC_STACK_ERROR;
goto exit;
}
exit:
TWDeleteEntry(ctx->g_plugin, entry);
OICFree(cmdString);
- OC_LOG_V(INFO, TAG, "Leave TWSetAttribute() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TWSetAttribute() with ret=%d", ret);
return ret;
}
{
//Ask: AT+READATR:FE5A,01,0,0402,0002
- OC_LOG(INFO, TAG, "Enter TWGetAttribute()");
+ OIC_LOG(INFO, TAG, "Enter TWGetAttribute()");
TWContext* ctx = GetTWContext(plugin);
if (ctx == NULL)
char* cmdString = (char*)OICMalloc(size * sizeof(char));
if (cmdString == NULL)
{
- OC_LOG(ERROR, TAG, "No Memory");
+ OIC_LOG(ERROR, TAG, "No Memory");
ret = OC_STACK_NO_MEMORY;
goto exit;
}
SEPARATOR, attributeId);
if(stringRet <= 0)
{
- OC_LOG(ERROR, TAG, "Build command error.");
+ OIC_LOG(ERROR, TAG, "Build command error.");
ret = OC_STACK_ERROR;
goto exit;
}
twRet = TWIssueATCommand(ctx->g_plugin, cmdString);
if (twRet != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "Write %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "Write %s", cmdString);
ret = OC_STACK_ERROR;
goto exit;
}
- OC_LOG_V(INFO, TAG, "Write %s", cmdString);
+ OIC_LOG_V(INFO, TAG, "Write %s", cmdString);
TWEntry* entry = NULL;
twRet = TWDequeueEntry(ctx->g_plugin, &entry, TW_RESPATTR);
if (twRet != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "TWDequeueEntry");
+ OIC_LOG(ERROR, TAG, "TWDequeueEntry");
ret = OC_STACK_ERROR;
goto exit;
}
if (entry == NULL)
{
- OC_LOG(INFO, TAG, "TWEntry is NULL");
+ OIC_LOG(INFO, TAG, "TWEntry is NULL");
ret = OC_STACK_ERROR;
goto exit;
}
twRet = processEntry(entry, ctx);
if (twRet != TW_RESULT_REMOTE_ATTR_HAS_VALUE)
{
- OC_LOG(ERROR, TAG, "processEntry.");
+ OIC_LOG(ERROR, TAG, "processEntry.");
ret = OC_STACK_ERROR;
goto exit;
}
*outValue = (char*)OICMalloc(sizeof(char) * size);
if (*outValue == NULL)
{
- OC_LOG(ERROR, TAG, "No Memory");
+ OIC_LOG(ERROR, TAG, "No Memory");
ret = OC_STACK_NO_MEMORY;
goto exit;
}
OICFree(ctx->g_ZigBeeStatus.remoteAttributeValueRead);
ctx->g_ZigBeeStatus.remoteAttributeValueRead = NULL;
ctx->g_ZigBeeStatus.remoteAtrributeValueReadLength = 0;
- OC_LOG(INFO, TAG, "TWGetAttribute() gets an attribute value.");
+ OIC_LOG(INFO, TAG, "TWGetAttribute() gets an attribute value.");
ret = OC_STACK_OK;
exit:
TWDeleteEntry(ctx->g_plugin, entry);
OICFree(cmdString);
- OC_LOG_V(INFO, TAG, "Leave TWGetAttribute() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TWGetAttribute() with ret=%d", ret);
return ret;
}
// OK
// DFTREP:9E2B,01,0006,01,00
- OC_LOG(INFO, TAG, "Enter TWSwitchOnOff()");
+ OIC_LOG(INFO, TAG, "Enter TWSwitchOnOff()");
TWContext* ctx = GetTWContext(plugin);
if (ctx == NULL)
{
- OC_LOG(ERROR, TAG, "Invalid Param");
+ OIC_LOG(ERROR, TAG, "Invalid Param");
return OC_STACK_INVALID_PARAM;
}
char* cmdString = (char*)OICMalloc(size * sizeof(char));
if (cmdString == NULL)
{
- OC_LOG(ERROR, TAG, "No Memory");
+ OIC_LOG(ERROR, TAG, "No Memory");
ret = OC_STACK_NO_MEMORY;
goto exit;
}
endpointId, SEPARATOR, SENDMODE);
if(stringRet <= 0)
{
- OC_LOG(ERROR, TAG, "Build command error.");
+ OIC_LOG(ERROR, TAG, "Build command error.");
ret = OC_STACK_ERROR;
goto exit;
}
twRet = TWIssueATCommand(ctx->g_plugin, cmdString);
if (twRet != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "Write %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "Write %s", cmdString);
ret = OC_STACK_ERROR;
goto exit;
}
- OC_LOG_V(INFO, TAG, "Write %s", cmdString);
+ OIC_LOG_V(INFO, TAG, "Write %s", cmdString);
TWEntry* entry = NULL;
twRet = TWDequeueEntry(ctx->g_plugin, &entry, TW_DFTREP);
if (twRet != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "TWDequeueEntry");
+ OIC_LOG(ERROR, TAG, "TWDequeueEntry");
ret = OC_STACK_ERROR;
goto exit;
}
if (entry == NULL)
{
- OC_LOG(ERROR, TAG, "TWEntry is NULL");
+ OIC_LOG(ERROR, TAG, "TWEntry is NULL");
ret = OC_STACK_ERROR;
goto exit;
}
twRet = processEntry(entry, ctx);
if (twRet != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "processEntry - %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "processEntry - %s", cmdString);
ret = OC_STACK_ERROR;
goto exit;
}
exit:
TWDeleteEntry(ctx->g_plugin, entry);
OICFree(cmdString);
- OC_LOG_V(INFO, TAG, "Leave TWSwitchOnOff() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TWSwitchOnOff() with ret=%d", ret);
return ret;
}
{
//AT+LCMVTOLEV:<Address>,<EP>,<SendMode>,<ON/OFF>,<LevelValue>,<TransTime>
- OC_LOG(INFO, TAG, "Enter TWMoveToLevel()");
+ OIC_LOG(INFO, TAG, "Enter TWMoveToLevel()");
TWContext* ctx = GetTWContext(plugin);
if (ctx == NULL)
{
- OC_LOG(ERROR, TAG, "Invalid Param");
+ OIC_LOG(ERROR, TAG, "Invalid Param");
return OC_STACK_INVALID_PARAM;
}
char* cmdString = (char*)OICMalloc(size * sizeof(char));
if (cmdString == NULL)
{
- OC_LOG(ERROR, TAG, "No Memory");
+ OIC_LOG(ERROR, TAG, "No Memory");
ret = OC_STACK_NO_MEMORY;
goto exit;
}
SEPARATOR, transTime);
if(stringRet <= 0)
{
- OC_LOG(ERROR, TAG, "Build command error.");
+ OIC_LOG(ERROR, TAG, "Build command error.");
ret = OC_STACK_ERROR;
goto exit;
}
twRet = TWIssueATCommand(ctx->g_plugin, cmdString);
if (twRet != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "Write %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "Write %s", cmdString);
ret = OC_STACK_ERROR;
goto exit;
}
- OC_LOG_V(INFO, TAG, "Write %s", cmdString);
+ OIC_LOG_V(INFO, TAG, "Write %s", cmdString);
TWEntry* entry = NULL;
twRet = TWDequeueEntry(ctx->g_plugin, &entry, TW_DFTREP);
if (twRet != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "TWDequeueEntry");
+ OIC_LOG(ERROR, TAG, "TWDequeueEntry");
ret = OC_STACK_ERROR;
goto exit;
}
if (entry == NULL)
{
- OC_LOG(ERROR, TAG, "TWEntry is NULL");
+ OIC_LOG(ERROR, TAG, "TWEntry is NULL");
ret = OC_STACK_ERROR;
goto exit;
}
twRet = processEntry(entry, ctx);
if (twRet != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "processEntry - %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "processEntry - %s", cmdString);
ret = OC_STACK_ERROR;
goto exit;
}
exit:
TWDeleteEntry(ctx->g_plugin, entry);
OICFree(cmdString);
- OC_LOG_V(INFO, TAG, "Leave TWMoveToLevel() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TWMoveToLevel() with ret=%d", ret);
return ret;
}
{
//AT+DRLOCK:<Address>,<EP>,<SendMode>,<Lock/Unlock>
- OC_LOG(INFO, TAG, "Enter TWSwitchDoorLockState()");
+ OIC_LOG(INFO, TAG, "Enter TWSwitchDoorLockState()");
TWContext* ctx = GetTWContext(plugin);
if (ctx == NULL)
{
- OC_LOG(ERROR, TAG, "Invalid Param");
+ OIC_LOG(ERROR, TAG, "Invalid Param");
return OC_STACK_INVALID_PARAM;
}
char* cmdString = (char*)OICMalloc(size * sizeof(char));
if (cmdString == NULL)
{
- OC_LOG(ERROR, TAG, "No Memory");
+ OIC_LOG(ERROR, TAG, "No Memory");
ret = OC_STACK_NO_MEMORY;
goto exit;
}
SEPARATOR, newState);
if(stringRet <= 0)
{
- OC_LOG(ERROR, TAG, "Build command error.");
+ OIC_LOG(ERROR, TAG, "Build command error.");
ret = OC_STACK_ERROR;
goto exit;
}
twRet = TWIssueATCommand(ctx->g_plugin, cmdString);
if (twRet != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "Write %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "Write %s", cmdString);
ret = OC_STACK_ERROR;
goto exit;
}
- OC_LOG_V(INFO, TAG, "Write %s", cmdString);
+ OIC_LOG_V(INFO, TAG, "Write %s", cmdString);
TWEntry* entry = NULL;
twRet = TWDequeueEntry(ctx->g_plugin, &entry, TW_DFTREP);
if (twRet != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "TWDequeueEntry");
+ OIC_LOG(ERROR, TAG, "TWDequeueEntry");
ret = OC_STACK_ERROR;
goto exit;
}
if (entry == NULL)
{
- OC_LOG(ERROR, TAG, "TWEntry is NULL");
+ OIC_LOG(ERROR, TAG, "TWEntry is NULL");
ret = OC_STACK_ERROR;
goto exit;
}
twRet = processEntry(entry, ctx);
if (twRet != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "processEntry - %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "processEntry - %s", cmdString);
ret = OC_STACK_ERROR;
goto exit;
}
exit:
TWDeleteEntry(ctx->g_plugin, entry);
OICFree(cmdString);
- OC_LOG_V(INFO, TAG, "Leave TWSwitchDoorLockState() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TWSwitchDoorLockState() with ret=%d", ret);
return ret;
}
// OK
// ERROR:<errorcode>
- OC_LOG(INFO, TAG, "Enter TWColorMoveToColorTemperature()");
+ OIC_LOG(INFO, TAG, "Enter TWColorMoveToColorTemperature()");
TWContext* ctx = GetTWContext(plugin);
if (ctx == NULL)
{
- OC_LOG(ERROR, TAG, "Invalid Param");
+ OIC_LOG(ERROR, TAG, "Invalid Param");
return OC_STACK_INVALID_PARAM;
}
char* cmdString = (char*)OICMalloc(size * sizeof(char));
if (cmdString == NULL)
{
- OC_LOG(ERROR, TAG, "No Memory");
+ OIC_LOG(ERROR, TAG, "No Memory");
ret = OC_STACK_NO_MEMORY;
goto exit;
}
SEPARATOR, transTime);
if(stringRet <= 0)
{
- OC_LOG(ERROR, TAG, "Build command error.");
+ OIC_LOG(ERROR, TAG, "Build command error.");
ret = OC_STACK_ERROR;
goto exit;
}
twRet = TWIssueATCommand(ctx->g_plugin, cmdString);
if (twRet != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "Write %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "Write %s", cmdString);
ret = OC_STACK_ERROR;
goto exit;
}
- OC_LOG_V(INFO, TAG, "Write %s", cmdString);
+ OIC_LOG_V(INFO, TAG, "Write %s", cmdString);
TWEntry* entry = NULL;
twRet = TWDequeueEntry(ctx->g_plugin, &entry, TW_DFTREP);
if (twRet != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "TWDequeueEntry - %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "TWDequeueEntry - %s", cmdString);
ret = OC_STACK_ERROR;
goto exit;
}
if (entry == NULL)
{
- OC_LOG_V(ERROR, TAG, "TWEntry is NULL - %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "TWEntry is NULL - %s", cmdString);
ret = OC_STACK_ERROR;
goto exit;
}
twRet = processEntry(entry, ctx);
if (twRet != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "processEntry - %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "processEntry - %s", cmdString);
ret = OC_STACK_ERROR;
goto exit;
}
exit:
TWDeleteEntry(ctx->g_plugin, entry);
OICFree(cmdString);
- OC_LOG_V(INFO, TAG, "Leave TWColorMoveToColorTemperature() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TWColorMoveToColorTemperature() with ret=%d", ret);
return ret;
}
OCStackResult TWSetDiscoveryCallback(const TWDeviceFoundCallback callback, PIPlugin_Zigbee* plugin)
{
- OC_LOG(INFO, TAG, "Enter TWSetDiscoveryCallback()");
+ OIC_LOG(INFO, TAG, "Enter TWSetDiscoveryCallback()");
OCStackResult ret = OC_STACK_OK;
}
}
- OC_LOG_V(INFO, TAG, "Leave TWSetDiscoveryCallback() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TWSetDiscoveryCallback() with ret=%d", ret);
return ret;
}
OCStackResult TWSetEndDeviceNodeIdChangedCallback(TWDeviceNodeIdChangedCallback callback,
PIPlugin_Zigbee* plugin)
{
- OC_LOG(INFO, TAG, "Enter TWSetEndDeviceNodeIdChangedCallback()");
+ OIC_LOG(INFO, TAG, "Enter TWSetEndDeviceNodeIdChangedCallback()");
OCStackResult ret = OC_STACK_OK;
ctx->g_EndDeviceNodeIdChangedCallback = NULL;
}
}
- OC_LOG_V(INFO, TAG, "Leave TWSetEndDeviceNodeIdChangedCallback() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TWSetEndDeviceNodeIdChangedCallback() with ret=%d", ret);
return ret;
}
OCStackResult TWSetStatusUpdateCallback(TWDeviceStatusUpdateCallback callback,
PIPlugin_Zigbee* plugin)
{
- OC_LOG(INFO, TAG, "Enter TWSetStatusUpdateCallback()");
+ OIC_LOG(INFO, TAG, "Enter TWSetStatusUpdateCallback()");
OCStackResult ret = OC_STACK_OK;
}
}
- OC_LOG_V(INFO, TAG, "Leave TWSetStatusUpdateCallback() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TWSetStatusUpdateCallback() with ret=%d", ret);
return ret;
}
OCStackResult TWListenForStatusUpdates(char* nodeId, char* endpointId, PIPlugin_Zigbee* plugin)
{
- OC_LOG(INFO, TAG, "Enter TWListenForStatusUpdates()");
+ OIC_LOG(INFO, TAG, "Enter TWListenForStatusUpdates()");
OCStackResult ret = OC_STACK_OK;
if (ret == OC_STACK_INVALID_OPTION)
{
- OC_LOG(INFO, TAG, "Already registered for ZoneStatusUpdate");
+ OIC_LOG(INFO, TAG, "Already registered for ZoneStatusUpdate");
ret = OC_STACK_OK;
}
}
- OC_LOG_V(INFO, TAG, "Leave TWListenForStatusUpdates() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TWListenForStatusUpdates() with ret=%d", ret);
return ret;
}
ret = TWDequeueEntry(ctx->g_plugin, &entry, TW_NONE);
if (ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "TWDequeueEntry");
+ OIC_LOG(ERROR, TAG, "TWDequeueEntry");
ret = OC_STACK_ERROR;
break;
}
ret = processEntry(entry, ctx);
if (ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "processEntry");
+ OIC_LOG(ERROR, TAG, "processEntry");
ret = TWDeleteEntry(ctx->g_plugin, entry);
if(ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "Failed to delete entry.");
+ OIC_LOG(ERROR, TAG, "Failed to delete entry.");
ret = OC_STACK_ERROR;
break;
}
}
else
{
- OC_LOG(INFO, TAG, "processEntry");
+ OIC_LOG(INFO, TAG, "processEntry");
ret = TWDeleteEntry(ctx->g_plugin, entry);
if(ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "Failed to delete entry.");
+ OIC_LOG(ERROR, TAG, "Failed to delete entry.");
ret = OC_STACK_ERROR;
break;
}
OCStackResult TWUninitialize(PIPlugin_Zigbee* plugin)
{
- OC_LOG(INFO, TAG, "Enter TWUninitializeZigBee()");
+ OIC_LOG(INFO, TAG, "Enter TWUninitializeZigBee()");
OCStackResult ret = OC_STACK_ERROR;
TWContext* ctx = GetTWContext(plugin);
TWResultCode twRet = TWStopSock(ctx->g_plugin);
if (twRet == TW_RESULT_OK)
{
- OC_LOG(INFO, TAG, "TWStopSock");
+ OIC_LOG(INFO, TAG, "TWStopSock");
ret = OC_STACK_OK;
}
else
{
- OC_LOG(ERROR, TAG, "TWStopSock");
+ OIC_LOG(ERROR, TAG, "TWStopSock");
ret = OC_STACK_ERROR;
}
DeallocateTWDeviceList(ctx);
OICFree(ctx);
}
- OC_LOG_V(INFO, TAG, "Leave TWUninitializeZigBee() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TWUninitializeZigBee() with ret=%d", ret);
return ret;
}
TWResultCode processEntry(TWEntry *entry, TWContext* ctx)
{
- OC_LOG(INFO, TAG, "Enter processEntry()");
+ OIC_LOG(INFO, TAG, "Enter processEntry()");
TWResultCode ret = TW_RESULT_UNKNOWN;
switch(entry->type)
if ((ret != TW_RESULT_NO_LOCAL_PAN) &&
(ret != TW_RESULT_HAS_LOCAL_PAN))
{
- OC_LOG(ERROR, TAG, "processEntryNETWORK_INFO.");
+ OIC_LOG(ERROR, TAG, "processEntryNETWORK_INFO.");
}
break;
case TW_JPAN:
ret = processEntryJPAN(entry, ctx);
if (ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "processEntryJPAN.");
+ OIC_LOG(ERROR, TAG, "processEntryJPAN.");
}
break;
case TW_SED:
ret = processEntryEndDevice(entry, ctx);
if (ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "processEntrySED.");
+ OIC_LOG(ERROR, TAG, "processEntrySED.");
}
break;
case TW_RFD:
ret = processEntryEndDevice(entry, ctx);
if (ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "processEntryRFD.");
+ OIC_LOG(ERROR, TAG, "processEntryRFD.");
}
break;
case TW_FFD:
ret = processEntryEndDevice(entry, ctx);
if (ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "processEntryFFD.");
+ OIC_LOG(ERROR, TAG, "processEntryFFD.");
}
break;
case TW_ZED:
ret = processEntryEndDevice(entry, ctx);
if (ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "processEntryZED.");
+ OIC_LOG(ERROR, TAG, "processEntryZED.");
}
break;
case TW_MATCHDESC:
ret = processEntryMatchDesc(entry, ctx);
if (ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "processEntryMatchDesc.");
+ OIC_LOG(ERROR, TAG, "processEntryMatchDesc.");
}
break;
case TW_SIMPLEDESC:
ret = processEntrySimpleDesc(entry, ctx);
if (ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "processEntrySimpleDesc.");
+ OIC_LOG(ERROR, TAG, "processEntrySimpleDesc.");
}
break;
case TW_WRITEATTR:
ret = processEntryWriteAttr(entry, ctx);
if (ret == TW_RESULT_ERROR_INVALID_OP)
{
- OC_LOG_V(INFO, TAG, "processEntryWriteAttr - ret=%d", TW_RESULT_ERROR_INVALID_OP);
+ OIC_LOG_V(INFO, TAG, "processEntryWriteAttr - ret=%d", TW_RESULT_ERROR_INVALID_OP);
}
else if (ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "processEntryWriteAttr.");
+ OIC_LOG(ERROR, TAG, "processEntryWriteAttr.");
}
break;
case TW_RESPATTR:
ret = processEntryReadAttr(entry, ctx);
if (ret != TW_RESULT_REMOTE_ATTR_HAS_VALUE)
{
- OC_LOG(ERROR, TAG, "processEntryReadAttr.");
+ OIC_LOG(ERROR, TAG, "processEntryReadAttr.");
}
break;
case TW_TEMPERATURE:
ret = processEntryTemperature(entry, ctx);
if (ret != TW_RESULT_REMOTE_ATTR_HAS_VALUE)
{
- OC_LOG(ERROR, TAG, "processEntryTemperature.");
+ OIC_LOG(ERROR, TAG, "processEntryTemperature.");
}
break;
case TW_DRLOCRSP:
ret = processEntrySwitchDoorLockState(entry, ctx);
if (ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "processEntrySwitchDoorLockState.");
+ OIC_LOG(ERROR, TAG, "processEntrySwitchDoorLockState.");
}
break;
case TW_DRUNLOCKRSP:
ret = processEntrySwitchDoorLockState(entry, ctx);
if (ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "processEntrySwitchDoorLockState.");
+ OIC_LOG(ERROR, TAG, "processEntrySwitchDoorLockState.");
}
break;
case TW_DFTREP:
ret = processEntryZCLDefaultResponse(entry, ctx);
if (ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "processEntryZCLDefaultResponse.");
+ OIC_LOG(ERROR, TAG, "processEntryZCLDefaultResponse.");
}
break;
case TW_ZENROLLREQ:
ret = processEntryZoneEnrollRequest(entry, ctx);
if (ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "processEntryZoneEnrollRequest.");
+ OIC_LOG(ERROR, TAG, "processEntryZoneEnrollRequest.");
}
break;
case TW_ENROLLED:
ret = processEntryEnrolled(entry, ctx);
if (ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "processEntryEnrolled.");
+ OIC_LOG(ERROR, TAG, "processEntryEnrolled.");
}
break;
case TW_ZONESTATUS:
ret = processEntryZoneStatus(entry, ctx);
if (ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "processEntryZoneStatus.");
+ OIC_LOG(ERROR, TAG, "processEntryZoneStatus.");
}
break;
case TW_ADDRESS_RESPONSE:
ret = processEntryAddressResponse(entry, ctx);
if (ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "processEntryAddressResponse.");
+ OIC_LOG(ERROR, TAG, "processEntryAddressResponse.");
}
break;
default:
- OC_LOG(ERROR, TAG, "processEntry() doesn't receive an valid entry.");
+ OIC_LOG(ERROR, TAG, "processEntry() doesn't receive an valid entry.");
ret = TW_RESULT_ERROR;
break;
}
- OC_LOG_V(INFO, TAG, "Leave processEntry() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave processEntry() with ret=%d", ret);
return ret;
}
// OK
*/
- OC_LOG(INFO, TAG, "Enter processEntryNETWORK_INFO()");
+ OIC_LOG(INFO, TAG, "Enter processEntryNETWORK_INFO()");
TWResultCode ret = TW_RESULT_UNKNOWN;
if (strcmp(entry->atErrorCode, AT_STR_ERROR_EVERYTHING_OK) != 0)
{
- OC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR: %s", entry->atErrorCode);
+ OIC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR: %s", entry->atErrorCode);
ret = TW_RESULT_ERROR;
goto exit;
}
ret = HandleATResponse(entry,ctx);
exit:
- OC_LOG_V(INFO, TAG, "Leave processEntryNETWORK_INFO() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave processEntryNETWORK_INFO() with ret=%d", ret);
return ret;
}
// ERROR:28
*/
- OC_LOG(INFO, TAG, "Enter processEntryJPAN()");
+ OIC_LOG(INFO, TAG, "Enter processEntryJPAN()");
TWResultCode ret = TW_RESULT_UNKNOWN;
if (strcmp(entry->atErrorCode, AT_STR_ERROR_EVERYTHING_OK) == 0)
ret = HandleATResponse(entry,ctx);
if (ret == TW_RESULT_NEW_LOCAL_PAN_ESTABLISHED)
{
- OC_LOG(INFO, TAG, "New Local PAN established.");
+ OIC_LOG(INFO, TAG, "New Local PAN established.");
ret = TW_RESULT_OK;
}
else
}
else if (strcmp(entry->atErrorCode, AT_STR_ERROR_NODE_IS_PART_OF_PAN) == 0)
{
- OC_LOG(INFO, TAG, "Already Established PAN.");
+ OIC_LOG(INFO, TAG, "Already Established PAN.");
ret = TW_RESULT_OK;
}
else
{
- OC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR: %s", entry->atErrorCode);
+ OIC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR: %s", entry->atErrorCode);
ret = TW_RESULT_ERROR;
}
- OC_LOG_V(INFO, TAG, "Leave processEntryJPAN() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave processEntryJPAN() with ret=%d", ret);
return ret;
}
TWResultCode processEntryEndDevice(TWEntry* entry, TWContext* ctx)
{
- OC_LOG(INFO, TAG, "Enter processEntryEndDevice()");
+ OIC_LOG(INFO, TAG, "Enter processEntryEndDevice()");
TWResultCode ret = TW_RESULT_UNKNOWN;
ret = HandleATResponse(entry,ctx);
if (ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "HandleATResponse");
+ OIC_LOG(ERROR, TAG, "HandleATResponse");
}
- OC_LOG_V(INFO, TAG, "Leave processEntryEndDevice() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave processEntryEndDevice() with ret=%d", ret);
return ret;
}
{
//MatchDesc:0B4A,00,01
- OC_LOG(INFO, TAG, "Enter processEntryMatchDesc()");
+ OIC_LOG(INFO, TAG, "Enter processEntryMatchDesc()");
TWResultCode ret = TW_RESULT_UNKNOWN;
if (strcmp(entry->atErrorCode, AT_STR_ERROR_EVERYTHING_OK) != 0)
{
- OC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR = %s", entry->atErrorCode);
+ OIC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR = %s", entry->atErrorCode);
ret = TW_RESULT_ERROR;
}
else
ret = HandleATResponse(entry,ctx);
if (ret == TW_RESULT_OK)
{
- OC_LOG(INFO, TAG, "HandleATResponse");
+ OIC_LOG(INFO, TAG, "HandleATResponse");
ret = FindClusters(ctx->g_WIPDevice->nodeId,
ctx->g_WIPDevice->endpointOfInterest->endpointId,
ctx);
if (ret == TW_RESULT_OK)
{
- OC_LOG(INFO, TAG, "FindClusters - Found a match node");
+ OIC_LOG(INFO, TAG, "FindClusters - Found a match node");
if (ctx->g_DeviceFoundCallback != NULL)
{
- OC_LOG(INFO, TAG, "Found a match node -- invoke callback");
+ OIC_LOG(INFO, TAG, "Found a match node -- invoke callback");
ctx->g_DeviceFoundCallback(ctx->g_WIPDevice, ctx->g_plugin);
}
ret = TW_RESULT_OK;
}
else
{
- OC_LOG(ERROR, TAG, "FindClusters");
+ OIC_LOG(ERROR, TAG, "FindClusters");
ret = TW_RESULT_ERROR;
}
}
else
{
- OC_LOG(ERROR, TAG, "HandleATResponse");
+ OIC_LOG(ERROR, TAG, "HandleATResponse");
ret = TW_RESULT_ERROR;
}
ctx->g_WIPDevice = NULL; //reset and do not deallocate it
}
- OC_LOG_V(INFO, TAG, "Leave processEntryMatchDesc() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave processEntryMatchDesc() with ret=%d", ret);
return ret;
}
//
// ACK:97
*/
- OC_LOG(INFO, TAG, "Enter processEntrySimpleDesc()");
+ OIC_LOG(INFO, TAG, "Enter processEntrySimpleDesc()");
TWResultCode ret = TW_RESULT_UNKNOWN;
if (strcmp((entry->atErrorCode), AT_STR_ERROR_EVERYTHING_OK) != 0)
{
- OC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR = %s", (entry->atErrorCode));
+ OIC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR = %s", (entry->atErrorCode));
ret = TW_RESULT_ERROR;
}
else
ret = HandleATResponse(entry,ctx);
if (ret == TW_RESULT_HAS_CLUSTERS)
{
- OC_LOG(INFO, TAG, "has clusters.");
+ OIC_LOG(INFO, TAG, "has clusters.");
ret = TW_RESULT_OK;
}
}
else
{
- OC_LOG(INFO, TAG, "Received an invalid Simple Descriptor.");
+ OIC_LOG(INFO, TAG, "Received an invalid Simple Descriptor.");
ret = TW_RESULT_ERROR;
}
}
- OC_LOG_V(INFO, TAG, "Leave processEntrySimpleDesc() returns with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave processEntrySimpleDesc() returns with ret=%d", ret);
return ret;
}
// OK
// WRITEATTR:3A3D,01,0003,,00
- OC_LOG(INFO, TAG, "Enter processEntryWriteAttr()");
+ OIC_LOG(INFO, TAG, "Enter processEntryWriteAttr()");
TWResultCode ret = TW_RESULT_UNKNOWN;
if (strcmp((entry->atErrorCode), AT_STR_ERROR_EVERYTHING_OK) != 0)
{
- OC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR = %s", entry->atErrorCode);
+ OIC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR = %s", entry->atErrorCode);
ret = TW_RESULT_ERROR;
}
else
ret = HandleATResponse(entry,ctx);
}
- OC_LOG_V(INFO, TAG, "Leave processEntryWriteAttr() returns with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave processEntryWriteAttr() returns with ret=%d", ret);
return ret;
}
TWResultCode processEntryReadAttr(TWEntry* entry, TWContext* ctx)
{
- OC_LOG(INFO, TAG, "Enter processEntryReadAttr()");
+ OIC_LOG(INFO, TAG, "Enter processEntryReadAttr()");
TWResultCode ret = TW_RESULT_UNKNOWN;
if (strcmp((entry->atErrorCode), AT_STR_ERROR_EVERYTHING_OK) != 0)
{
- OC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR = %s", entry->atErrorCode);
+ OIC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR = %s", entry->atErrorCode);
ret = TW_RESULT_ERROR;
}
else
ret = HandleATResponse(entry,ctx);
}
- OC_LOG_V(INFO, TAG, "Leave processEntryReadAttr() returns with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave processEntryReadAttr() returns with ret=%d", ret);
return ret;
}
TWResultCode processEntryTemperature(TWEntry* entry, TWContext* ctx)
{
- OC_LOG(INFO, TAG, "Enter processEntryTemperature()");
+ OIC_LOG(INFO, TAG, "Enter processEntryTemperature()");
TWResultCode ret = TW_RESULT_UNKNOWN;
if (strcmp((entry->atErrorCode), AT_STR_ERROR_EVERYTHING_OK) != 0)
{
- OC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR = %s", entry->atErrorCode);
+ OIC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR = %s", entry->atErrorCode);
ret = TW_RESULT_ERROR;
}
else
ret = HandleATResponse(entry,ctx);
}
- OC_LOG_V(INFO, TAG, "Leave processEntryTemperature() returns with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave processEntryTemperature() returns with ret=%d", ret);
return ret;
}
TWResultCode processEntrySwitchDoorLockState(TWEntry* entry, TWContext* ctx)
{
- OC_LOG(INFO, TAG, "Enter processEntrySwitchDoorLockState()");
+ OIC_LOG(INFO, TAG, "Enter processEntrySwitchDoorLockState()");
TWResultCode ret = TW_RESULT_UNKNOWN;
if (strcmp((entry->atErrorCode), AT_STR_ERROR_EVERYTHING_OK) != 0)
{
- OC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR = %s", entry->atErrorCode);
+ OIC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR = %s", entry->atErrorCode);
ret = TW_RESULT_ERROR;
}
else
ret = HandleATResponse(entry,ctx);
}
- OC_LOG_V(INFO, TAG, "Leave processEntrySwitchDoorLockState() returns with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave processEntrySwitchDoorLockState() returns with ret=%d", ret);
return ret;
}
TWResultCode processEntryZCLDefaultResponse(TWEntry* entry, TWContext* ctx)
{
- OC_LOG(INFO, TAG, "Enter processEntryZCLDefaultResponse()");
+ OIC_LOG(INFO, TAG, "Enter processEntryZCLDefaultResponse()");
TWResultCode ret = TW_RESULT_UNKNOWN;
{
if (strcmp(entry->atErrorCode, AT_STR_ERROR_MESSAGE_NOT_SENT_TO_TARGET_SUCCESSFULLY) == 0)
{
- OC_LOG(ERROR, TAG, "Send to the target not succeed.");
+ OIC_LOG(ERROR, TAG, "Send to the target not succeed.");
ret = TW_RESULT_ERROR;
}
else
{
- OC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR = %s", entry->atErrorCode);
+ OIC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR = %s", entry->atErrorCode);
ret = TW_RESULT_ERROR;
}
}
ret = HandleATResponse(entry,ctx);
}
- OC_LOG_V(INFO, TAG, "Leave processEntryZCLDefaultResponse() returns with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave processEntryZCLDefaultResponse() returns with ret=%d", ret);
return ret;
}
TWResultCode processEntryZoneEnrollRequest(TWEntry* entry, TWContext* ctx)
{
- OC_LOG(INFO, TAG, "Enter processEntryZoneEnrollRequest()");
+ OIC_LOG(INFO, TAG, "Enter processEntryZoneEnrollRequest()");
TWResultCode ret = TW_RESULT_UNKNOWN;
if (strcmp(entry->atErrorCode, AT_STR_ERROR_EVERYTHING_OK) != 0)
{
- OC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR: %s", entry->atErrorCode);
+ OIC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR: %s", entry->atErrorCode);
ret = TW_RESULT_ERROR;
}
else
ret = HandleATResponse(entry,ctx);
}
- OC_LOG_V(INFO, TAG, "Leave processEntryZoneEnrollRequest() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave processEntryZoneEnrollRequest() with ret=%d", ret);
return ret;
}
TWResultCode processEntryEnrolled(TWEntry* entry, TWContext* ctx)
{
- OC_LOG(INFO, TAG, "Enter processEntryEnrolled()");
+ OIC_LOG(INFO, TAG, "Enter processEntryEnrolled()");
TWResultCode ret = TW_RESULT_UNKNOWN;
if (strcmp(entry->atErrorCode, AT_STR_ERROR_EVERYTHING_OK) != 0)
{
- OC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR: %s", entry->atErrorCode);
+ OIC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR: %s", entry->atErrorCode);
ret = TW_RESULT_ERROR;
}
else
ret = HandleATResponse(entry,ctx);
}
- OC_LOG_V(INFO, TAG, "Leave processEntryEnrolled() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave processEntryEnrolled() with ret=%d", ret);
return ret;
}
TWResultCode processEntryZoneStatus(TWEntry* entry, TWContext* ctx)
{
- OC_LOG(INFO, TAG, "Enter processEntryZoneStatus()");
+ OIC_LOG(INFO, TAG, "Enter processEntryZoneStatus()");
TWResultCode ret = TW_RESULT_UNKNOWN;
if (strcmp(entry->atErrorCode, AT_STR_ERROR_EVERYTHING_OK) != 0)
{
- OC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR: %s", entry->atErrorCode);
+ OIC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR: %s", entry->atErrorCode);
ret = TW_RESULT_ERROR;
}
else
ret = HandleATResponse(entry,ctx);
}
- OC_LOG_V(INFO, TAG, "Leave processEntryZoneStatus() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave processEntryZoneStatus() with ret=%d", ret);
return ret;
}
TWResultCode processEntryAddressResponse(TWEntry* entry, TWContext* ctx)
{
- OC_LOG(INFO, TAG, "Enter processEntryAddressResponse()");
+ OIC_LOG(INFO, TAG, "Enter processEntryAddressResponse()");
TWResultCode ret = TW_RESULT_UNKNOWN;
if (strcmp(entry->atErrorCode, AT_STR_ERROR_EVERYTHING_OK) != 0)
{
- OC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR: %s", entry->atErrorCode);
+ OIC_LOG_V(ERROR, TAG, "TWEntry contains AT_ERROR: %s", entry->atErrorCode);
ret = TW_RESULT_ERROR;
}
else
ret = HandleATResponse(entry,ctx);
}
- OC_LOG_V(INFO, TAG, "Leave processEntryAddressResponse() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave processEntryAddressResponse() with ret=%d", ret);
return ret;
}
TWResultCode Reset(TWContext* ctx)
{
- OC_LOG(INFO, TAG, "Enter Reset()");
+ OIC_LOG(INFO, TAG, "Enter Reset()");
TWResultCode ret = TW_RESULT_ERROR;
ret = TWIssueATCommand(ctx->g_plugin, AT_CMD_RESET);
if (ret == TW_RESULT_OK)
{
- OC_LOG_V(INFO, TAG, "Write %s", AT_CMD_RESET);
+ OIC_LOG_V(INFO, TAG, "Write %s", AT_CMD_RESET);
}
else
{
- OC_LOG_V(ERROR, TAG, "Write %s", AT_CMD_RESET);
+ OIC_LOG_V(ERROR, TAG, "Write %s", AT_CMD_RESET);
}
- OC_LOG_V(INFO, TAG, "Leave Reset() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave Reset() with ret=%d", ret);
return ret;
}
// ERROR:28
*/
- OC_LOG(INFO, TAG, "Enter CreatePAN()");
+ OIC_LOG(INFO, TAG, "Enter CreatePAN()");
TWResultCode twRet1 = TW_RESULT_UNKNOWN;
TWResultCode twRet2 = TW_RESULT_UNKNOWN;
ret = TWIssueATCommand(ctx->g_plugin, AT_CMD_GET_NETWORK_INFO);
if (ret != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "Write %s", AT_CMD_GET_NETWORK_INFO);
+ OIC_LOG_V(ERROR, TAG, "Write %s", AT_CMD_GET_NETWORK_INFO);
goto exit;
}
- OC_LOG_V(INFO, TAG, "Write %s", AT_CMD_GET_NETWORK_INFO);
+ OIC_LOG_V(INFO, TAG, "Write %s", AT_CMD_GET_NETWORK_INFO);
TWEntry* entry = NULL;
TWEntry* entry2 = NULL;
ret = TWDequeueEntry(ctx->g_plugin, &entry, TW_NETWORK_INFO);
if (ret != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "TWDequeueEntry - %s", AT_CMD_GET_NETWORK_INFO);
+ OIC_LOG_V(ERROR, TAG, "TWDequeueEntry - %s", AT_CMD_GET_NETWORK_INFO);
goto exit;
}
if (entry == NULL)
{
- OC_LOG_V(ERROR, TAG, "TWEntry is NULL - %s", AT_CMD_GET_NETWORK_INFO);
+ OIC_LOG_V(ERROR, TAG, "TWEntry is NULL - %s", AT_CMD_GET_NETWORK_INFO);
ret = TW_RESULT_ERROR;
goto exit;
}
ret = processEntry(entry, ctx);
if (ret == TW_RESULT_HAS_LOCAL_PAN)
{
- OC_LOG(INFO, TAG, "Has local PAN.");
+ OIC_LOG(INFO, TAG, "Has local PAN.");
ret = TW_RESULT_OK;
}
else if (ret == TW_RESULT_NO_LOCAL_PAN)
{
- OC_LOG(INFO, TAG, "Has no local PAN.");
+ OIC_LOG(INFO, TAG, "Has no local PAN.");
ret = TWIssueATCommand(ctx->g_plugin, AT_CMD_ESTABLISH_NETWORK);
if (ret != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "Write %s", AT_CMD_ESTABLISH_NETWORK);
+ OIC_LOG_V(ERROR, TAG, "Write %s", AT_CMD_ESTABLISH_NETWORK);
goto exit;
}
- OC_LOG_V(INFO, TAG, "Write %s", AT_CMD_ESTABLISH_NETWORK);
+ OIC_LOG_V(INFO, TAG, "Write %s", AT_CMD_ESTABLISH_NETWORK);
ret = TWDequeueEntry(ctx->g_plugin, &entry2, TW_JPAN);
if (ret != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "TWDequeueEntry - %s", AT_CMD_ESTABLISH_NETWORK);
+ OIC_LOG_V(ERROR, TAG, "TWDequeueEntry - %s", AT_CMD_ESTABLISH_NETWORK);
goto exit;
}
if (entry2 == NULL)
{
- OC_LOG_V(ERROR, TAG, "TWEntry is NULL - %s", AT_CMD_ESTABLISH_NETWORK);
+ OIC_LOG_V(ERROR, TAG, "TWEntry is NULL - %s", AT_CMD_ESTABLISH_NETWORK);
ret = TW_RESULT_ERROR;
goto exit;
}
ret = processEntry(entry2, ctx);
if (ret == TW_RESULT_OK)
{
- OC_LOG_V(INFO, TAG, "processEntry - %s", AT_CMD_ESTABLISH_NETWORK);
+ OIC_LOG_V(INFO, TAG, "processEntry - %s", AT_CMD_ESTABLISH_NETWORK);
ret = TW_RESULT_OK;
}
else
{
- OC_LOG_V(ERROR, TAG, "processEntry - %s", AT_CMD_ESTABLISH_NETWORK);
+ OIC_LOG_V(ERROR, TAG, "processEntry - %s", AT_CMD_ESTABLISH_NETWORK);
ret = TW_RESULT_ERROR;
}
}
else
{
- OC_LOG_V(ERROR, TAG, "processEntry - unexpected return code: %d", ret);
+ OIC_LOG_V(ERROR, TAG, "processEntry - unexpected return code: %d", ret);
ret = TW_RESULT_ERROR;
}
twRet1 = TWDeleteEntry(ctx->g_plugin, entry);
if(twRet1 != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "TWDeleteEntry 1 - ret=%d", twRet1);
+ OIC_LOG_V(ERROR, TAG, "TWDeleteEntry 1 - ret=%d", twRet1);
}
}
if (entry2)
twRet2 = TWDeleteEntry(ctx->g_plugin, entry2);
if(twRet2 != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "TWDeleteEntry 2 - ret=%d", twRet2);
+ OIC_LOG_V(ERROR, TAG, "TWDeleteEntry 2 - ret=%d", twRet2);
}
}
- OC_LOG_V(INFO, TAG, "Leave CreatePan with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave CreatePan with ret=%d", ret);
return ret;
}
char* cmdString = (char*)OICMalloc(size * sizeof(char));
if (cmdString == NULL)
{
- OC_LOG(ERROR, TAG, "No Memory");
+ OIC_LOG(ERROR, TAG, "No Memory");
ret = TW_RESULT_ERROR_NO_MEMORY;
goto exit;
}
ret = TWIssueATCommand(ctx->g_plugin, cmdString);
if (ret != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "Write %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "Write %s", cmdString);
ret = TW_RESULT_ERROR;
goto exit;
}
- OC_LOG_V(INFO, TAG, "Write %s", cmdString);
+ OIC_LOG_V(INFO, TAG, "Write %s", cmdString);
sleep(15); //must sleep here to permit joining for 15 seconds
exit:
OICFree(cmdString);
- OC_LOG_V(INFO, TAG, "Leave EnableJoin() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave EnableJoin() with ret=%d", ret);
return ret;
}
//AT+MATCHREQ:0104,03,0999,0999,0999,00
// OK
- OC_LOG(INFO, TAG, "Enter FindMatchNodes()");
+ OIC_LOG(INFO, TAG, "Enter FindMatchNodes()");
TWResultCode ret = TW_RESULT_UNKNOWN;
char* cmdString = (char*)OICMalloc(size * sizeof(char));
if (cmdString == NULL)
{
- OC_LOG(ERROR, TAG, "No Memory");
+ OIC_LOG(ERROR, TAG, "No Memory");
ret = TW_RESULT_ERROR_NO_MEMORY;
goto exit;
}
SEPARATOR, OUT_CLUSTER_COUNT_STRING);
if(stringRet <= 0)
{
- OC_LOG(ERROR, TAG, "Build command error.");
+ OIC_LOG(ERROR, TAG, "Build command error.");
ret = OC_STACK_ERROR;
goto exit;
}
ret = TWIssueATCommand(ctx->g_plugin, cmdString);
if (ret != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "Write %s.", cmdString);
+ OIC_LOG_V(ERROR, TAG, "Write %s.", cmdString);
goto exit;
}
- OC_LOG_V(INFO, TAG, "Write %s.", cmdString);
+ OIC_LOG_V(INFO, TAG, "Write %s.", cmdString);
exit:
OICFree(cmdString);
- OC_LOG_V(INFO, TAG, "Leave FindMatchNodes() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave FindMatchNodes() with ret=%d", ret);
return ret;
}
// ACK:97
*/
- OC_LOG(INFO, TAG, "Enter FindClusters()");
+ OIC_LOG(INFO, TAG, "Enter FindClusters()");
TWResultCode ret = TW_RESULT_UNKNOWN;
char* cmdString = (char*)OICMalloc(size * sizeof(char));
if (cmdString == NULL)
{
- OC_LOG(ERROR, TAG, "No Memory");
+ OIC_LOG(ERROR, TAG, "No Memory");
ret = TW_RESULT_ERROR_NO_MEMORY;
goto exit;
}
SEPARATOR, endpoint);
if(stringRet <= 0)
{
- OC_LOG(ERROR, TAG, "Build command error.");
+ OIC_LOG(ERROR, TAG, "Build command error.");
ret = OC_STACK_ERROR;
goto exit;
}
ret = TWIssueATCommand(ctx->g_plugin, cmdString);
if (ret != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "Write %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "Write %s", cmdString);
ret = TW_RESULT_ERROR;
goto exit;
}
- OC_LOG_V(INFO, TAG, "Write %s", cmdString);
+ OIC_LOG_V(INFO, TAG, "Write %s", cmdString);
TWEntry* entry = NULL;
ret = TWDequeueEntry(ctx->g_plugin, &entry, TW_SIMPLEDESC);
if (ret != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "TWDequeueEntry - %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "TWDequeueEntry - %s", cmdString);
goto exit;
}
if (entry == NULL)
{
- OC_LOG_V(ERROR, TAG, "TWEntry is NULL - %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "TWEntry is NULL - %s", cmdString);
ret = TW_RESULT_ERROR;
goto exit;
}
ret = processEntry(entry, ctx);
if (ret == TW_RESULT_OK)
{
- OC_LOG_V(INFO, TAG, "processEntry - %s", cmdString);
+ OIC_LOG_V(INFO, TAG, "processEntry - %s", cmdString);
}
else
{
- OC_LOG_V(ERROR, TAG, "processEntry - %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "processEntry - %s", cmdString);
}
exit:
TWDeleteEntry(ctx->g_plugin, entry);
OICFree(cmdString);
- OC_LOG_V(INFO, TAG, "Leave FindClusters() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave FindClusters() with ret=%d", ret);
return ret;
}
// AddrResp:<errorcode>[,<NodeID>,<EUI64>]
// AddrResp:00,15ED,000D6F00040574B8
- OC_LOG(INFO, TAG, "Enter GetRemoteEUI()");
+ OIC_LOG(INFO, TAG, "Enter GetRemoteEUI()");
TWResultCode ret = TW_RESULT_UNKNOWN;
int size = strlen(AT_CMD_REMOTE_EUI_REQUEST) + strlen(nodeId) +
char* cmdString = (char*)OICMalloc(size * sizeof(char));
if (cmdString == NULL)
{
- OC_LOG(ERROR, TAG, "No Memory");
+ OIC_LOG(ERROR, TAG, "No Memory");
ret = TW_RESULT_ERROR_NO_MEMORY;
goto exit;
}
SEPARATOR, nodeId);
if(stringRet <= 0)
{
- OC_LOG(ERROR, TAG, "Build command error.");
+ OIC_LOG(ERROR, TAG, "Build command error.");
ret = OC_STACK_ERROR;
goto exit;
}
ret = TWIssueATCommand(ctx->g_plugin, cmdString);
if (ret != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "Write %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "Write %s", cmdString);
ret = TW_RESULT_ERROR;
goto exit;
}
- OC_LOG_V(INFO, TAG, "Write %s", cmdString);
+ OIC_LOG_V(INFO, TAG, "Write %s", cmdString);
TWEntry* entry = NULL;
ret = TWDequeueEntry(ctx->g_plugin, &entry, TW_ADDRESS_RESPONSE);
if (ret != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "TWDequeueEntry - %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "TWDequeueEntry - %s", cmdString);
ret = TW_RESULT_ERROR;
goto exit;
}
if (entry == NULL)
{
- OC_LOG_V(ERROR, TAG, "TWEntry is NULL - %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "TWEntry is NULL - %s", cmdString);
ret = TW_RESULT_ERROR;
goto exit;
}
ret = processEntry(entry, ctx);
if (ret != TW_RESULT_OK)
{
- OC_LOG_V(ERROR, TAG, "processEntry - %s", cmdString);
+ OIC_LOG_V(ERROR, TAG, "processEntry - %s", cmdString);
ret = TW_RESULT_ERROR;
goto exit;
}
- OC_LOG_V(INFO, TAG, "Wanted eui of NodeID=%s ", nodeId);
- OC_LOG_V(INFO, TAG, "Received eui of g_WIPRemoteNodeId=%s ", ctx->g_WIPRemoteNodeId);
+ OIC_LOG_V(INFO, TAG, "Wanted eui of NodeID=%s ", nodeId);
+ OIC_LOG_V(INFO, TAG, "Received eui of g_WIPRemoteNodeId=%s ", ctx->g_WIPRemoteNodeId);
if (strcmp(nodeId, ctx->g_WIPRemoteNodeId) != 0)
{
- OC_LOG(ERROR, TAG, "Received eui for an unexpected remote node id.");
+ OIC_LOG(ERROR, TAG, "Received eui for an unexpected remote node id.");
ret = TW_RESULT_ERROR;
goto exit;
}
- OC_LOG_V(INFO, TAG, "Remote NodeId:%s has EUI: %s \n",
+ OIC_LOG_V(INFO, TAG, "Remote NodeId:%s has EUI: %s \n",
ctx->g_WIPRemoteNodeId, ctx->g_WIPRemoteEUI);
OICStrcpy(outRemoteEUI, sizeof(ctx->g_WIPRemoteEUI), ctx->g_WIPRemoteEUI);
memset(ctx->g_WIPRemoteNodeId, '\0', sizeof(ctx->g_WIPRemoteNodeId));
TWDeleteEntry(ctx->g_plugin, entry);
OICFree(cmdString);
- OC_LOG_V(INFO, TAG, "Leave GetRemoteEUI() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave GetRemoteEUI() with ret=%d", ret);
return ret;
}
TWResultCode HandleATResponse(TWEntry* entry, TWContext* ctx)
{
- OC_LOG(INFO, TAG, "Enter HandleATResponse()");
+ OIC_LOG(INFO, TAG, "Enter HandleATResponse()");
TWResultCode ret = TW_RESULT_ERROR;
}
}
- OC_LOG_V(INFO, TAG, "Leave HandleATResponse() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave HandleATResponse() with ret=%d", ret);
return ret;
}
// AddrResp:<errorcode>[,<NodeID>,<EUI64>]
// AddrResp:00,15ED,000D6F00040574B8
- OC_LOG(INFO, TAG, "Enter TelAddressResponseHandler()");
+ OIC_LOG(INFO, TAG, "Enter TelAddressResponseHandler()");
TWResultCode ret = TW_RESULT_UNKNOWN;
{
if (strcmp(tokens[TOKEN_ADDRRESP_STATUS_CODE], AT_STR_ERROR_OK) != 0)
{
- OC_LOG(ERROR, TAG, "AddrResp prompt contained error status.");
+ OIC_LOG(ERROR, TAG, "AddrResp prompt contained error status.");
ret = TW_RESULT_ERROR;
}
else
{
OICStrcpy(ctx->g_WIPRemoteNodeId, SIZE_NODEID, tokens[TOKEN_ADDRRESP_NODEID]);
OICStrcpy(ctx->g_WIPRemoteEUI, SIZE_EUI, tokens[TOKEN_ADDRRESP_EUI]);
- OC_LOG_V(INFO, TAG, "Received eui %s for g_WIPRemoteNodeId=%s ",
+ OIC_LOG_V(INFO, TAG, "Received eui %s for g_WIPRemoteNodeId=%s ",
ctx->g_WIPRemoteEUI,
ctx->g_WIPRemoteNodeId);
ret = TW_RESULT_OK;
}
}
- OC_LOG_V(INFO, TAG, "Leave TelAddressResponseHandler() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TelAddressResponseHandler() with ret=%d", ret);
return ret;
}
//
// +N=<devicetype>,<channel>,<power>,<PANID>,<EPANID>
- OC_LOG(INFO, TAG, "Enter TelNetworkInfoHandler()");
+ OIC_LOG(INFO, TAG, "Enter TelNetworkInfoHandler()");
TWResultCode ret = TW_RESULT_UNKNOWN;
{
if (tokens[i] != NULL)
{
- OC_LOG_V(INFO, TAG, "Token[%d] = %s", i, tokens[i]);
+ OIC_LOG_V(INFO, TAG, "Token[%d] = %s", i, tokens[i]);
}
}
char* temp = tokens[TOKEN_PLUS_N_DEVICE_TYPE];
if (strcmp(temp, "NoPAN") == 0)
{
- OC_LOG(INFO, TAG, "It is NoPan.");
+ OIC_LOG(INFO, TAG, "It is NoPan.");
ret = TW_RESULT_NO_LOCAL_PAN;
goto exit;
}
- OC_LOG(INFO, TAG, "Already have an established network.");
+ OIC_LOG(INFO, TAG, "Already have an established network.");
ret = AsciiHexToValue(tokens[TOKEN_PLUS_N_PANID],
strlen(tokens[TOKEN_PLUS_N_PANID]),
&(ctx->g_ZigBeeStatus.panId));
if(ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "AsciiHexToValue - panId");
+ OIC_LOG(ERROR, TAG, "AsciiHexToValue - panId");
goto exit;
}
&(ctx->g_ZigBeeStatus.extPanId));
if(ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "AsciiHexToValue - extPanId");
+ OIC_LOG(ERROR, TAG, "AsciiHexToValue - extPanId");
goto exit;
}
- OC_LOG_V(INFO, TAG, "PanId=%" PRId64 , ctx->g_ZigBeeStatus.panId);
- OC_LOG_V(INFO, TAG, "ExtPanId=%" PRId64 , ctx->g_ZigBeeStatus.extPanId);
- OC_LOG_V(INFO, TAG, "PanId=%s", tokens[TOKEN_PLUS_N_PANID]);
- OC_LOG_V(INFO, TAG, "ExtPanId=%s", tokens[TOKEN_PLUS_N_PANID_EXTENDED]);
+ OIC_LOG_V(INFO, TAG, "PanId=%" PRId64 , ctx->g_ZigBeeStatus.panId);
+ OIC_LOG_V(INFO, TAG, "ExtPanId=%" PRId64 , ctx->g_ZigBeeStatus.extPanId);
+ OIC_LOG_V(INFO, TAG, "PanId=%s", tokens[TOKEN_PLUS_N_PANID]);
+ OIC_LOG_V(INFO, TAG, "ExtPanId=%s", tokens[TOKEN_PLUS_N_PANID_EXTENDED]);
- OC_LOG_V(INFO, TAG, "TelNetworkInfoHandler set ExtPanId to %08X%08X",
+ OIC_LOG_V(INFO, TAG, "TelNetworkInfoHandler set ExtPanId to %08X%08X",
(unsigned int)(ctx->g_ZigBeeStatus.extPanId >> 32),
(unsigned int)(ctx->g_ZigBeeStatus.extPanId & 0xFFFFFFFF));
ret = TW_RESULT_HAS_LOCAL_PAN;
exit:
- OC_LOG_V(INFO, TAG, "Leave TelNetworkInfoHandler() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TelNetworkInfoHandler() with ret=%d", ret);
return ret;
}
//Ask: AT+EN:[<channel>],[<POWER>],[<PANID>]
//Response: JPAN:<channel>,<PANID>,<EPANID>
- OC_LOG(INFO, TAG, "Enter TelJpanHandler()");
+ OIC_LOG(INFO, TAG, "Enter TelJpanHandler()");
TWResultCode ret = TW_RESULT_UNKNOWN;
if(ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "AsciiHexToValue - panId");
+ OIC_LOG(ERROR, TAG, "AsciiHexToValue - panId");
goto exit;
}
&(ctx->g_ZigBeeStatus.extPanId));
if(ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "AsciiHexToValue - extPanId");
+ OIC_LOG(ERROR, TAG, "AsciiHexToValue - extPanId");
goto exit;
}
- OC_LOG_V(INFO, TAG, "PanId = %" PRId64 "\n", ctx->g_ZigBeeStatus.panId);
- OC_LOG_V(INFO, TAG, "ExtPanId = %" PRId64 "\n", ctx->g_ZigBeeStatus.extPanId);
+ OIC_LOG_V(INFO, TAG, "PanId = %" PRId64 "\n", ctx->g_ZigBeeStatus.panId);
+ OIC_LOG_V(INFO, TAG, "ExtPanId = %" PRId64 "\n", ctx->g_ZigBeeStatus.extPanId);
ret = TW_RESULT_NEW_LOCAL_PAN_ESTABLISHED;
exit:
- OC_LOG_V(INFO, TAG, "Leave TelJpanHandler() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TelJpanHandler() with ret=%d", ret);
return ret;
}
//Prompt: SED:<IEEE Address>,<NodeID>
//Prompt: ZED:<IEEE Address>,<NodeID>
- OC_LOG(INFO, TAG, "Enter TelEndDeviceJoinHandler()");
+ OIC_LOG(INFO, TAG, "Enter TelEndDeviceJoinHandler()");
TWResultCode ret = TW_RESULT_UNKNOWN;
if(!tokens || count != RESPONSE_PARAMS_COUNT_DEVICE_JOINED)
}
//TODO: Might need to add into the list if needed - log it for now.
- OC_LOG_V(INFO, TAG, "Received RFD/FFD/SED/ZED - EUI:%s; NodeID:%s.\n",
+ OIC_LOG_V(INFO, TAG, "Received RFD/FFD/SED/ZED - EUI:%s; NodeID:%s.\n",
tokens[TOKEN_PJOIN_RESPONSE_IEEE_ADDRESS],
tokens[TOKEN_PJOIN_RESPONSE_NODEID]);
ret = TW_RESULT_OK;
exit:
- OC_LOG_V(INFO, TAG, "Leave TelEndDeviceJoinHandler() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TelEndDeviceJoinHandler() with ret=%d", ret);
return ret;
}
{
//Prompt: MatchDesc:0B4A,00,01
- OC_LOG(INFO, TAG, "Enter TelMatchDescHandler()");
+ OIC_LOG(INFO, TAG, "Enter TelMatchDescHandler()");
TWResultCode ret = TW_RESULT_ERROR;
if(!tokens || count != RESPONSE_PARAMS_COUNT_MATCH_DESC)
if (strcmp(tokens[TOKEN_MATCHDESC_STATUS_CODE], AT_STR_ERROR_OK) != 0)
{
- OC_LOG(INFO, TAG, "MatchDesc prompt contained error status.");
+ OIC_LOG(INFO, TAG, "MatchDesc prompt contained error status.");
ret = TW_RESULT_ERROR;
goto exit;
}
ret = GetRemoteEUI(tokens[TOKEN_MATCHDESC_NODEID], remoteEUI, ctx);
if (ret != TW_RESULT_OK)
{
- OC_LOG(ERROR, TAG, "GetRemoteEUI()");
+ OIC_LOG(ERROR, TAG, "GetRemoteEUI()");
goto exit;
}
else
}
exit:
- OC_LOG_V(INFO, TAG, "Leave TelMatchDescHandler() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TelMatchDescHandler() with ret=%d", ret);
return ret;
}
// OutCluster:0019
// ACK:97
- OC_LOG(INFO, TAG, "Enter TelSimpleDescHandler().");
+ OIC_LOG(INFO, TAG, "Enter TelSimpleDescHandler().");
TWResultCode ret = TW_RESULT_UNKNOWN;
if(!tokens || count != RESPONSE_PARAMS_COUNT_SIMPLE_DESC)
if (ctx->g_WIPDevice == NULL)
{
- OC_LOG_V(ERROR, TAG,
+ OIC_LOG_V(ERROR, TAG,
"Receive simple descriptor unexpectedly - %s",
tokens[TOKEN_SIMPLEDESC_SIMPLEDESC_NODEID]);
ret = TW_RESULT_ERROR;
if (strcmp(tokens[TOKEN_SIMPLEDESC_SIMPLEDESC_STATUS_CODE], AT_STR_ERROR_OK) != 0)
{
- OC_LOG_V(ERROR,
+ OIC_LOG_V(ERROR,
TAG,
"SimpleDesc: prompt contained error status %s.",
tokens[TOKEN_SIMPLEDESC_SIMPLEDESC_STATUS_CODE]);
if (strcmp(tokens[TOKEN_SIMPLEDESC_SIMPLEDESC_NODEID],
ctx->g_WIPDevice->nodeId) == 0)
{
- OC_LOG_V(INFO,
+ OIC_LOG_V(INFO,
TAG,
"Got simple descriptor for nodeid %s",
tokens[TOKEN_SIMPLEDESC_SIMPLEDESC_NODEID]);
}
else
{
- OC_LOG_V(ERROR,
+ OIC_LOG_V(ERROR,
TAG,
"Finding simple descriptor for non existing nodeid %s.",
tokens[TOKEN_SIMPLEDESC_SIMPLEDESC_NODEID]);
}
exit:
- OC_LOG_V(INFO, TAG, "Leave TelSimpleDescHandler() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TelSimpleDescHandler() with ret=%d", ret);
return ret;
}
// OutCluster:0019
// ACK:97
- OC_LOG(INFO, TAG, "Enter TelSimpleDescInClusterHandler()");
+ OIC_LOG(INFO, TAG, "Enter TelSimpleDescInClusterHandler()");
TWResultCode ret = TW_RESULT_ERROR;
if (!tokens || count < RESPONSE_PARAMS_COUNT_SIMPLE_DESC_IN_CLUSTER_MIN )
{
- OC_LOG(ERROR, TAG, "Invalid Params");
+ OIC_LOG(ERROR, TAG, "Invalid Params");
ret = TW_RESULT_ERROR_INVALID_PARAMS;
goto exit;
}
if (ctx->g_WIPDevice == NULL)
{
- OC_LOG_V(ERROR, TAG,
+ OIC_LOG_V(ERROR, TAG,
"Receive simple descriptor unexpectedly - %s",
tokens[TOKEN_SIMPLEDESC_INCLUSTER_STRING]);
ret = TW_RESULT_ERROR;
if (ctx->g_WIPDevice->endpointOfInterest->clusterList != NULL)
{
- OC_LOG(ERROR, TAG, "Expected an empty cluster list.");
+ OIC_LOG(ERROR, TAG, "Expected an empty cluster list.");
ret = TW_RESULT_ERROR;
goto exit;
}
(TWClusterList*)OICMalloc(sizeof(TWClusterList));
if (ctx->g_WIPDevice->endpointOfInterest->clusterList == NULL)
{
- OC_LOG(ERROR, TAG, "No Memory - clusterList");
+ OIC_LOG(ERROR, TAG, "No Memory - clusterList");
ret = TW_RESULT_ERROR_NO_MEMORY;
goto exit;
}
if (ctx->g_WIPDevice->endpointOfInterest->clusterList->clusterIds == NULL)
{
OICFree(ctx->g_WIPDevice->endpointOfInterest->clusterList);
- OC_LOG(ERROR, TAG, "No Memory - clusterIds");
+ OIC_LOG(ERROR, TAG, "No Memory - clusterIds");
ret = TW_RESULT_ERROR_NO_MEMORY;
goto exit;
}
SIZE_CLUSTERID,
tokens[i]);
- OC_LOG_V(INFO, TAG, "ClusterIds[%d]=%s",
+ OIC_LOG_V(INFO, TAG, "ClusterIds[%d]=%s",
i,
ctx->g_WIPDevice->endpointOfInterest->clusterList->clusterIds[i].clusterId);
}
ret = TW_RESULT_HAS_CLUSTERS;
exit:
- OC_LOG_V(INFO, TAG, "Leave TelSimpleDescInClusterHandler() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TelSimpleDescInClusterHandler() with ret=%d", ret);
return ret;
}
// OK
// WRITEATTR:B826,01,0500,0010,70
- OC_LOG(INFO, TAG, "Enter TelWriteAttrHandler()");
+ OIC_LOG(INFO, TAG, "Enter TelWriteAttrHandler()");
(void)ctx;
TWResultCode ret = TW_RESULT_ERROR;
}
exit:
- OC_LOG_V(INFO, TAG, "Leave TelWriteAttrHandler() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TelWriteAttrHandler() with ret=%d", ret);
return ret;
}
// OK
// ERROR:66
- OC_LOG(INFO, TAG, "Enter TelReadAttrHandlerTemperature().");
+ OIC_LOG(INFO, TAG, "Enter TelReadAttrHandlerTemperature().");
TWResultCode ret = TW_RESULT_UNKNOWN;
if(!tokens || count != RESPONSE_PARAMS_COUNT_TEMPERATURE)
{
- OC_LOG(ERROR, TAG, "Invalid Params");
+ OIC_LOG(ERROR, TAG, "Invalid Params");
ret = TW_RESULT_ERROR_INVALID_PARAMS;
goto exit;
}
if (strcmp(tokens[TOKEN_TEMPERATURE_STATUS_CODE], AT_STR_ERROR_OK) != 0)
{
- OC_LOG(ERROR, TAG, "TEMPERATURE prompt contained error status.");
+ OIC_LOG(ERROR, TAG, "TEMPERATURE prompt contained error status.");
ret = TW_RESULT_ERROR;
goto exit;
}
OICFree(ctx->g_ZigBeeStatus.remoteAttributeValueRead);
ctx->g_ZigBeeStatus.remoteAttributeValueRead = NULL;
}
- OC_LOG_V(INFO, TAG, "Read Attribute Value: %s", tokens[TOKEN_TEMPERATURE_VALUE]);
+ OIC_LOG_V(INFO, TAG, "Read Attribute Value: %s", tokens[TOKEN_TEMPERATURE_VALUE]);
ctx->g_ZigBeeStatus.remoteAttributeValueRead =
(char*)OICMalloc(sizeof(char) * strlen(tokens[TOKEN_TEMPERATURE_VALUE]));
if (ctx->g_ZigBeeStatus.remoteAttributeValueRead == NULL)
{
- OC_LOG_V(ERROR, TAG, "No Memory");
+ OIC_LOG_V(ERROR, TAG, "No Memory");
ret = TW_RESULT_ERROR_NO_MEMORY;
}
else
}
exit:
- OC_LOG_V(INFO, TAG, "Leave TelReadAttrHandlerTemperature() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TelReadAttrHandlerTemperature() with ret=%d", ret);
return ret;
}
// OK
// ERROR:66
- OC_LOG(INFO, TAG, "Enter TelReadAttrHandler()");
+ OIC_LOG(INFO, TAG, "Enter TelReadAttrHandler()");
TWResultCode ret = TW_RESULT_UNKNOWN;
if(!tokens || count != RESPONSE_PARAMS_COUNT_RESPATTR)
{
- OC_LOG(ERROR, TAG, "Invalid Params");
+ OIC_LOG(ERROR, TAG, "Invalid Params");
ret = TW_RESULT_ERROR_INVALID_PARAMS;
goto exit;
}
if (strcmp(tokens[TOKEN_RESPATTR_STATUS_CODE], AT_STR_ERROR_OK) != 0)
{
- OC_LOG(INFO, TAG, "READATTR prompt contained error status.");
+ OIC_LOG(INFO, TAG, "READATTR prompt contained error status.");
ret = TW_RESULT_ERROR;
goto exit;
}
{
OICFree(ctx->g_ZigBeeStatus.remoteAttributeValueRead);
}
- OC_LOG_V(INFO, TAG, "Read Attribute Value: %s.", tokens[TOKEN_RESPATTR_ATTRIBUTE_VALUE]);
+ OIC_LOG_V(INFO, TAG, "Read Attribute Value: %s.", tokens[TOKEN_RESPATTR_ATTRIBUTE_VALUE]);
ctx->g_ZigBeeStatus.remoteAttributeValueRead =
(char*)OICMalloc(sizeof(char) * strlen(tokens[TOKEN_RESPATTR_ATTRIBUTE_VALUE]));
if (ctx->g_ZigBeeStatus.remoteAttributeValueRead != NULL)
}
else
{
- OC_LOG(ERROR, TAG, "No Memory");
+ OIC_LOG(ERROR, TAG, "No Memory");
ret = TW_RESULT_ERROR_NO_MEMORY;
}
exit:
- OC_LOG(INFO, TAG, "Leave TelReadAttrHandler()");
+ OIC_LOG(INFO, TAG, "Leave TelReadAttrHandler()");
return ret;
}
//AT+LCMVTOLEV:<Address>,<EP>,<SendMode>,<ON/OFF>,<LevelValue>,<TransTime>
// DFTREP:<NodeID>,<EP>,<ClusterID>,<CMD>,<Status>
- OC_LOG(INFO, TAG, "Enter TelZCLDefaultResponseHandler()");
+ OIC_LOG(INFO, TAG, "Enter TelZCLDefaultResponseHandler()");
(void)ctx;
TWResultCode ret = TW_RESULT_UNKNOWN;
if(!tokens || count != RESPONSE_PARAMS_COUNT_DFTREP)
{
- OC_LOG(ERROR, TAG, "Invalid Params");
+ OIC_LOG(ERROR, TAG, "Invalid Params");
ret = TW_RESULT_ERROR_INVALID_PARAMS;
goto exit;
}
- OC_LOG_V(INFO, TAG,
+ OIC_LOG_V(INFO, TAG,
"DFTREP prompt succeed for NodeId:%s, EP:%s, ClusterId:%s, CMD:%s.\n",
tokens[TOKEN_DFTREP_NODEID],
tokens[TOKEN_DFTREP_ENDPOINTID],
}
exit:
- OC_LOG(INFO, TAG, "Leave TelZCLDefaultResponseHandler()");
+ OIC_LOG(INFO, TAG, "Leave TelZCLDefaultResponseHandler()");
return ret;
}
// or
// DRUNLOCKRSP:<nodeID>,<ep>,<status>
- OC_LOG(INFO, TAG, "Enter TelSwitchDoorLockStateHandler()");
+ OIC_LOG(INFO, TAG, "Enter TelSwitchDoorLockStateHandler()");
(void)ctx;
TWResultCode ret = TW_RESULT_UNKNOWN;
if(!tokens || count != RESPONSE_PARAMS_COUNT_DRLOCKUNLOCKRSP)
{
- OC_LOG(ERROR, TAG, "Invalid Params");
+ OIC_LOG(ERROR, TAG, "Invalid Params");
ret = TW_RESULT_ERROR_INVALID_PARAMS;
goto exit;
}
if (strcmp(tokens[TOKEN_DRLOCKRSP_STATUS_CODE], AT_STR_ERROR_OK) != 0)
{
- OC_LOG_V(INFO,
+ OIC_LOG_V(INFO,
TAG,
"DRLOCRSP/DRUNLOCKRSP prompt contained error status %s.",
tokens[TOKEN_DRLOCKRSP_STATUS_CODE]);
}
else
{
- OC_LOG_V(INFO, TAG, "DRLOCRSP/DRUNLOCKRSP prompt succeed for nodeId:%s, ep:%s.",
+ OIC_LOG_V(INFO, TAG, "DRLOCRSP/DRUNLOCKRSP prompt succeed for nodeId:%s, ep:%s.",
tokens[TOKEN_DRLOCKRSP_NODEID],
tokens[TOKEN_DRLOCKRSP_ENDPOINTID]);
ret = TW_RESULT_OK;
}
exit:
- OC_LOG_V(INFO, TAG, "Leave TelSwitchDoorLockStateHandler() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TelSwitchDoorLockStateHandler() with ret=%d", ret);
return ret;
}
{
//ZENROLLREQ:<NodeID>,<EndPoint>,<ZoneType>,<ManufactureCode>
- OC_LOG(INFO, TAG, "Enter TelZoneEnrollRequestHandler()");
+ OIC_LOG(INFO, TAG, "Enter TelZoneEnrollRequestHandler()");
(void)ctx;
TWResultCode ret = TW_RESULT_UNKNOWN;
if(!tokens || count != RESPONSE_PARAMS_COUNT_ZENROLLREQ)
{
- OC_LOG(ERROR, TAG, "Invalid Params");
+ OIC_LOG(ERROR, TAG, "Invalid Params");
ret = TW_RESULT_ERROR_INVALID_PARAMS;
goto exit;
}
- OC_LOG(INFO, TAG, "Received zone request from:");
- OC_LOG_V(INFO, TAG, "Node:%s", tokens[TOKEN_ZENROLLREQ_NODEID]);
- OC_LOG_V(INFO, TAG, "EP:%s", tokens[TOKEN_ZENROLLREQ_ENDPOINTID]);
- OC_LOG_V(INFO, TAG, "ZoneType:%s", tokens[TOKEN_ZENROLLREQ_ZONETYPE]);
- OC_LOG_V(INFO, TAG, "ManufactureCode:%s", tokens[TOKEN_ZENROLLREQ_MANUFACTURE_CODE]);
+ OIC_LOG(INFO, TAG, "Received zone request from:");
+ OIC_LOG_V(INFO, TAG, "Node:%s", tokens[TOKEN_ZENROLLREQ_NODEID]);
+ OIC_LOG_V(INFO, TAG, "EP:%s", tokens[TOKEN_ZENROLLREQ_ENDPOINTID]);
+ OIC_LOG_V(INFO, TAG, "ZoneType:%s", tokens[TOKEN_ZENROLLREQ_ZONETYPE]);
+ OIC_LOG_V(INFO, TAG, "ManufactureCode:%s", tokens[TOKEN_ZENROLLREQ_MANUFACTURE_CODE]);
ret = TW_RESULT_OK;
exit:
- OC_LOG_V(INFO, TAG, "Leave TelZoneEnrollRequestHandler() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TelZoneEnrollRequestHandler() with ret=%d", ret);
return ret;
}
{
//ENROLLED:<ZID>,<ZoneType>,<EUI>
- OC_LOG(INFO, TAG, "Enter TelEnrolledHandler()");
+ OIC_LOG(INFO, TAG, "Enter TelEnrolledHandler()");
TWResultCode ret = TW_RESULT_OK;
if(!tokens || count != RESPONSE_PARAMS_COUNT_ENROLLED)
{
- OC_LOG(ERROR, TAG, "Invalid Params");
+ OIC_LOG(ERROR, TAG, "Invalid Params");
ret = TW_RESULT_ERROR_INVALID_PARAMS;
goto exit;
}
- OC_LOG(INFO, TAG, "Received zone enrollment for:");
- OC_LOG_V(INFO, TAG, "ZID:%s", tokens[TOKEN_ENROLLED_ZONEID]);
- OC_LOG_V(INFO, TAG, "ZoneType:%s", tokens[TOKEN_ENROLLED_ZONETYPE]);
- OC_LOG_V(INFO, TAG, "EUI:%s", tokens[TOKEN_ENROLLED_EUI]);
+ OIC_LOG(INFO, TAG, "Received zone enrollment for:");
+ OIC_LOG_V(INFO, TAG, "ZID:%s", tokens[TOKEN_ENROLLED_ZONEID]);
+ OIC_LOG_V(INFO, TAG, "ZoneType:%s", tokens[TOKEN_ENROLLED_ZONETYPE]);
+ OIC_LOG_V(INFO, TAG, "EUI:%s", tokens[TOKEN_ENROLLED_EUI]);
TWEnrollee enrollee;
OICStrcpy(enrollee.zoneId, SIZE_ZONEID, tokens[TOKEN_ENROLLED_ZONEID]);
if (ctx->g_EnrollmentSucceedCallback != NULL)
{
- OC_LOG_V(INFO, TAG, "Enrolled - Invoke callback");
+ OIC_LOG_V(INFO, TAG, "Enrolled - Invoke callback");
ctx->g_EnrollmentSucceedCallback(&enrollee, ctx->g_plugin);
}
ret = TW_RESULT_OK;
exit:
- OC_LOG_V(INFO, TAG, "Leave TelEnrolledHandler() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TelEnrolledHandler() with ret=%d", ret);
return ret;
}
//ZONESTATUS:<NodeID>,<EP>,<ZoneStatus>,<ExtendStatus>[,<ZoneID>,<Delay>]
//ZONESTATUS:5FBA,01,0021,00,01,00AF
- OC_LOG(INFO, TAG, "Enter TelZoneStatusHandler()");
+ OIC_LOG(INFO, TAG, "Enter TelZoneStatusHandler()");
TWResultCode ret = TW_RESULT_UNKNOWN;
if(!tokens ||
((count != RESPONSE_PARAMS_COUNT_ZONESTATUS_4) &&
(count != RESPONSE_PARAMS_COUNT_ZONESTATUS_6)))
{
- OC_LOG(ERROR, TAG, "Invalid Params");
+ OIC_LOG(ERROR, TAG, "Invalid Params");
ret = TW_RESULT_ERROR_INVALID_PARAMS;
goto exit;
}
if (ctx->g_DeviceStatusUpdateCallback != NULL)
{
- OC_LOG(INFO, TAG, "device status update - invoke callback");
+ OIC_LOG(INFO, TAG, "device status update - invoke callback");
ctx->g_DeviceStatusUpdateCallback(&update, ctx->g_plugin);
- OC_LOG(INFO, TAG, "device status update - callback done");
+ OIC_LOG(INFO, TAG, "device status update - callback done");
}
ret = TW_RESULT_OK;
exit:
- OC_LOG_V(INFO, TAG, "Leave TelZoneStatusHandler() with ret=%d", ret);
+ OIC_LOG_V(INFO, TAG, "Leave TelZoneStatusHandler() with ret=%d", ret);
return ret;
}
*/
int Tokenize(const char *input, const char* delimiters, char* output[])
{
- OC_LOG_V(INFO, TAG, "Enter Tokenize() - %s", input);
+ OIC_LOG_V(INFO, TAG, "Enter Tokenize() - %s", input);
if (output == NULL)
{
- OC_LOG(INFO, TAG, "Invalid parameter.");
+ OIC_LOG(INFO, TAG, "Invalid parameter.");
return -1;
}
int size = strlen(p) + 1; //for null char
output[index] = (char*)OICCalloc(size, sizeof(char));
OICStrcpy(output[index], size, p);
- OC_LOG_V(INFO, TAG, "Token[%d]=%s", index, output[index]);
+ OIC_LOG_V(INFO, TAG, "Token[%d]=%s", index, output[index]);
p = strtok_r (NULL, delimiters, &savePtr);
index++;
}
OICFree(str);
- OC_LOG(INFO, TAG, "Leave Tokenize()");
+ OIC_LOG(INFO, TAG, "Leave Tokenize()");
return index;
}
int retVal = AsciiToHex(hexString[0]);
if(retVal == -1)
{
- OC_LOG(ERROR, TAG, "Bad conversion from ASCII To Hex.");
+ OIC_LOG(ERROR, TAG, "Bad conversion from ASCII To Hex.");
return TW_RESULT_ERROR;
}
*value = (uint64_t)retVal;
retVal = AsciiToHex(hexString[i]);
if(retVal == -1)
{
- OC_LOG(ERROR, TAG, "Bad conversion from ASCII To Hex.");
+ OIC_LOG(ERROR, TAG, "Bad conversion from ASCII To Hex.");
return TW_RESULT_ERROR;
}
*value |= (uint64_t)retVal;