mirror of
https://github.com/openharmony/security_deviceauth.git
synced 2026-07-21 03:15:26 -04:00
!18 Fix the problem of log printing in 32-bit and 64-bit compiling environment and deadlock in some cases.
Merge pull request !18 from 符子坤/master
This commit is contained in:
@@ -293,7 +293,7 @@ int32_t AddReqIdByAppId(const char *appId, int64_t reqId)
|
||||
}
|
||||
node->requestId = reqId;
|
||||
node->delOnFni = 0;
|
||||
LOGI("success, appid: %s, requestId: %lld", appId, reqId);
|
||||
LOGI("success, appid: %s, requestId: %lld", appId, (long long)reqId);
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ void AddIpcCbObjByReqId(int64_t reqId, int32_t objIdx, int32_t type)
|
||||
if (node != nullptr) {
|
||||
node->proxyId = objIdx;
|
||||
LOGI("ipc object add success, request id %lld, type %d, proxy id %d",
|
||||
reqId, type, node->proxyId);
|
||||
(long long)reqId, type, node->proxyId);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -348,11 +348,11 @@ int32_t AddIpcCallBackByReqId(int64_t reqId, const uint8_t *cbPtr, int32_t cbSz,
|
||||
ServiceDevAuth::ResetRemoteObject(node->proxyId);
|
||||
node->proxyId = -1;
|
||||
}
|
||||
LOGI("callback added success, request id %lld, type %d", reqId, type);
|
||||
LOGI("callback added success, request id %lld, type %d", (long long)reqId, type);
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
LOGI("new callback to add, request id %lld, type %d", reqId, type);
|
||||
LOGI("new callback to add, request id %lld, type %d", (long long)reqId, type);
|
||||
node = GetFreeIpcCallBackNode();
|
||||
if (node == nullptr) {
|
||||
LOGE("get free node failed");
|
||||
@@ -369,7 +369,7 @@ int32_t AddIpcCallBackByReqId(int64_t reqId, const uint8_t *cbPtr, int32_t cbSz,
|
||||
node->delOnFni = 1;
|
||||
node->proxyId = -1;
|
||||
g_ipcCallBackList.nodeCnt++;
|
||||
LOGI("callback added success, request id %lld, type %d", reqId, type);
|
||||
LOGI("callback added success, request id %lld, type %d", (long long)reqId, type);
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -667,11 +667,11 @@ static bool GaCbOnTransmitWithType(int64_t requestId, const uint8_t *data, uint3
|
||||
MessageParcel reply;
|
||||
IpcCallBackNode *node = nullptr;
|
||||
|
||||
LOGI("starting ... request id: %lld, type %d", requestId, type);
|
||||
LOGI("starting ... request id: %lld, type %d", (long long)requestId, type);
|
||||
std::lock_guard<std::mutex> autoLock(g_cbListLock);
|
||||
node = GetIpcCallBackByReqId(requestId, type);
|
||||
if (node == nullptr) {
|
||||
LOGE("onTransmit hook is null, request id %lld", requestId);
|
||||
LOGE("onTransmit hook is null, request id %lld", (long long)requestId);
|
||||
return false;
|
||||
}
|
||||
ret = EncodeCallData(dataParcel, PARAM_TYPE_REQID,
|
||||
@@ -683,7 +683,7 @@ static bool GaCbOnTransmitWithType(int64_t requestId, const uint8_t *data, uint3
|
||||
}
|
||||
ServiceDevAuth::ActCallback(node->proxyId, CB_ID_ON_TRANS,
|
||||
reinterpret_cast<uintptr_t>(node->cbCtx.devAuth.onTransmit), dataParcel, reply);
|
||||
LOGI("process done, request id: %lld", requestId);
|
||||
LOGI("process done, request id: %lld", (long long)requestId);
|
||||
if (reply.ReadInt32(ret) && (ret == HC_SUCCESS)) {
|
||||
return true;
|
||||
}
|
||||
@@ -707,11 +707,11 @@ static void GaCbOnSessionKeyRetWithType(int64_t requestId, const uint8_t *sessKe
|
||||
MessageParcel reply;
|
||||
IpcCallBackNode *node = nullptr;
|
||||
|
||||
LOGI("starting ... request id: %lld, type %d", requestId, type);
|
||||
LOGI("starting ... request id: %lld, type %d", (long long)requestId, type);
|
||||
std::lock_guard<std::mutex> autoLock(g_cbListLock);
|
||||
node = GetIpcCallBackByReqId(requestId, type);
|
||||
if (node == nullptr) {
|
||||
LOGE("onSessionKeyReturned hook is null, request id %lld", requestId);
|
||||
LOGE("onSessionKeyReturned hook is null, request id %lld", (long long)requestId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -723,7 +723,7 @@ static void GaCbOnSessionKeyRetWithType(int64_t requestId, const uint8_t *sessKe
|
||||
}
|
||||
ServiceDevAuth::ActCallback(node->proxyId, CB_ID_SESS_KEY_DONE,
|
||||
reinterpret_cast<uintptr_t>(node->cbCtx.devAuth.onSessionKeyReturned), dataParcel, reply);
|
||||
LOGI("process done, request id: %lld", requestId);
|
||||
LOGI("process done, request id: %lld", (long long)requestId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -746,11 +746,11 @@ static void GaCbOnFinishWithType(int64_t requestId, int32_t operationCode, const
|
||||
MessageParcel reply;
|
||||
IpcCallBackNode *node = nullptr;
|
||||
|
||||
LOGI("starting ... request id: %lld, type %d", requestId, type);
|
||||
LOGI("starting ... request id: %lld, type %d", (long long)requestId, type);
|
||||
std::lock_guard<std::mutex> autoLock(g_cbListLock);
|
||||
node = GetIpcCallBackByReqId(requestId, type);
|
||||
if (node == nullptr) {
|
||||
LOGE("onFinish hook is null, request id %lld", requestId);
|
||||
LOGE("onFinish hook is null, request id %lld", (long long)requestId);
|
||||
return;
|
||||
}
|
||||
ret = EncodeCallData(dataParcel, PARAM_TYPE_REQID, reinterpret_cast<uint8_t *>(&requestId), sizeof(requestId));
|
||||
@@ -766,7 +766,7 @@ static void GaCbOnFinishWithType(int64_t requestId, int32_t operationCode, const
|
||||
reinterpret_cast<uintptr_t>(node->cbCtx.devAuth.onFinish), dataParcel, reply);
|
||||
/* delete request id */
|
||||
DelIpcCallBackByReqId(requestId, type, false);
|
||||
LOGI("process done, request id: %lld", requestId);
|
||||
LOGI("process done, request id: %lld", (long long)requestId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -790,11 +790,11 @@ static void GaCbOnErrorWithType(int64_t requestId, int32_t operationCode,
|
||||
MessageParcel reply;
|
||||
IpcCallBackNode *node = nullptr;
|
||||
|
||||
LOGI("starting ... request id: %lld, type %d", requestId, type);
|
||||
LOGI("starting ... request id: %lld, type %d", (long long)requestId, type);
|
||||
std::lock_guard<std::mutex> autoLock(g_cbListLock);
|
||||
node = GetIpcCallBackByReqId(requestId, type);
|
||||
if (node == nullptr) {
|
||||
LOGE("onError hook is null, request id %lld", requestId);
|
||||
LOGE("onError hook is null, request id %lld", (long long)requestId);
|
||||
return;
|
||||
}
|
||||
ret = EncodeCallData(dataParcel, PARAM_TYPE_REQID, reinterpret_cast<uint8_t *>(&requestId), sizeof(requestId));
|
||||
@@ -813,7 +813,7 @@ static void GaCbOnErrorWithType(int64_t requestId, int32_t operationCode,
|
||||
reinterpret_cast<uintptr_t>(node->cbCtx.devAuth.onError), dataParcel, reply);
|
||||
/* delete request id */
|
||||
DelIpcCallBackByReqId(requestId, type, false);
|
||||
LOGI("process done, request id: %lld", requestId);
|
||||
LOGI("process done, request id: %lld", (long long)requestId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -837,11 +837,11 @@ static char *GaCbOnRequestWithType(int64_t requestId, int32_t operationCode, con
|
||||
const char *dPtr = nullptr;
|
||||
IpcCallBackNode *node = nullptr;
|
||||
|
||||
LOGI("starting ... request id: %lld, type %d", requestId, type);
|
||||
LOGI("starting ... request id: %lld, type %d", (long long)requestId, type);
|
||||
std::lock_guard<std::mutex> autoLock(g_cbListLock);
|
||||
node = GetIpcCallBackByReqId(requestId, type);
|
||||
if (node == nullptr) {
|
||||
LOGE("onRequest hook is null, request id %lld", requestId);
|
||||
LOGE("onRequest hook is null, request id %lld", (long long)requestId);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -865,7 +865,8 @@ static char *GaCbOnRequestWithType(int64_t requestId, int32_t operationCode, con
|
||||
return nullptr;
|
||||
}
|
||||
dPtr = reply.ReadCString();
|
||||
LOGI("process done, request id: %lld, %s string", requestId, (dPtr != nullptr) ? "valid" : "invalid");
|
||||
LOGI("process done, request id: %lld, %s string",
|
||||
(long long)requestId, (dPtr != nullptr) ? "valid" : "invalid");
|
||||
return (dPtr != nullptr) ? strdup(dPtr) : nullptr;
|
||||
}
|
||||
return nullptr;
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#ifndef HC_LOG_H
|
||||
#define HC_LOG_H
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifdef HILOG_ENABLE
|
||||
|
||||
#include "hilog/log.h"
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#ifndef HC_LOG_H
|
||||
#define HC_LOG_H
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "log.h"
|
||||
|
||||
#define LOGD(fmt, arg...) HILOG_DEBUG(HILOG_MODULE_SCY, fmt, ##arg)
|
||||
|
||||
@@ -495,7 +495,7 @@ int32_t AddIntToJson(CJson *jsonObj, const char *key, int value)
|
||||
int32_t AddInt64StringToJson(CJson *jsonObj, const char *key, int64_t value)
|
||||
{
|
||||
char buffer[65] = { 0 };
|
||||
if (sprintf_s(buffer, sizeof(buffer), "%lld", value) <= 0) {
|
||||
if (sprintf_s(buffer, sizeof(buffer), "%" PRId64, value) <= 0) {
|
||||
LOGE("Failed to convert int64_t to string!");
|
||||
return HAL_FAILED;
|
||||
}
|
||||
|
||||
@@ -20,18 +20,20 @@
|
||||
bool ProcessTransmitCallback(int64_t requestId, const uint8_t *data, uint32_t dataLen,
|
||||
const DeviceAuthCallback *callback)
|
||||
{
|
||||
LOGI("[OnTransmit]: We're going to notify the service! [RequestId]: %lld, [DataLen]: %d", requestId, dataLen);
|
||||
LOGI("[OnTransmit]: We're going to notify the service! [RequestId]: %" PRId64 ", [DataLen]: %d",
|
||||
requestId, dataLen);
|
||||
if ((callback != NULL) && (callback->onTransmit != NULL)) {
|
||||
if (callback->onTransmit(requestId, data, dataLen)) {
|
||||
LOGI("[OnTransmit]: We notify the service successfully! [RequestId]: %lld, [DataLen]: %d",
|
||||
LOGI("[OnTransmit]: We notify the service successfully! [RequestId]: %" PRId64 ", [DataLen]: %d",
|
||||
requestId, dataLen);
|
||||
return true;
|
||||
}
|
||||
LOGE("[OnTransmit]: An error occurs when the service channel sends data! [RequestId]: %lld, [DataLen]: %d",
|
||||
requestId, dataLen);
|
||||
LOGE("[OnTransmit]: An error occurs when the service channel sends data! "
|
||||
"[RequestId]: %" PRId64 ", [DataLen]: %d", requestId, dataLen);
|
||||
return false;
|
||||
}
|
||||
LOGE("[OnTransmit]: Currently, the service callback is NULL! [RequestId]: %lld, [DataLen]: %d", requestId, dataLen);
|
||||
LOGE("[OnTransmit]: Currently, the service callback is NULL! [RequestId]: %" PRId64 ", [DataLen]: %d",
|
||||
requestId, dataLen);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -39,60 +41,60 @@ void ProcessSessionKeyCallback(int64_t requestId, const uint8_t *sessionKey, uin
|
||||
const DeviceAuthCallback *callback)
|
||||
{
|
||||
const char *isSessionKeyExist = (sessionKeyLen > 0) ? "true" : "false";
|
||||
LOGI("[OnSessionKeyReturned]: We're going to notify the service! [RequestId]: %lld, [IsSessionKeyExist]: %s",
|
||||
LOGI("[OnSessionKeyReturned]: We're going to notify the service! [RequestId]: %" PRId64 ", [IsSessionKeyExist]: %s",
|
||||
requestId, isSessionKeyExist);
|
||||
if ((callback != NULL) && (callback->onSessionKeyReturned != NULL)) {
|
||||
(void)callback->onSessionKeyReturned(requestId, sessionKey, sessionKeyLen);
|
||||
LOGI("[OnSessionKeyReturned]: We notify the service successfully! [RequestId]: %lld, [IsSessionKeyExist]: %s",
|
||||
requestId, isSessionKeyExist);
|
||||
LOGI("[OnSessionKeyReturned]: We notify the service successfully! "
|
||||
"[RequestId]: %" PRId64 ", [IsSessionKeyExist]: %s", requestId, isSessionKeyExist);
|
||||
return;
|
||||
}
|
||||
LOGE("[OnSessionKeyReturned]: Currently, the service callback is NULL! [RequestId]: %lld, [IsSessionKeyExist]: %s",
|
||||
requestId, isSessionKeyExist);
|
||||
LOGE("[OnSessionKeyReturned]: Currently, the service callback is NULL! "
|
||||
"[RequestId]: %" PRId64 ", [IsSessionKeyExist]: %s", requestId, isSessionKeyExist);
|
||||
}
|
||||
|
||||
void ProcessFinishCallback(int64_t requestId, int operationCode, const char *returnData,
|
||||
const DeviceAuthCallback *callback)
|
||||
{
|
||||
LOGI("[OnFinish]: We're going to notify the service! [RequestId]: %lld, [OperationCode]: %d",
|
||||
LOGI("[OnFinish]: We're going to notify the service! [RequestId]: %" PRId64 ", [OperationCode]: %d",
|
||||
requestId, operationCode);
|
||||
if ((callback != NULL) && (callback->onFinish != NULL)) {
|
||||
callback->onFinish(requestId, operationCode, returnData);
|
||||
LOGI("[End]: [OnFinish]: We notify the service successfully! [RequestId]: %lld, [OperationCode]: %d",
|
||||
LOGI("[End]: [OnFinish]: We notify the service successfully! [RequestId]: %" PRId64 ", [OperationCode]: %d",
|
||||
requestId, operationCode);
|
||||
return;
|
||||
}
|
||||
LOGE("[End]: [OnFinish]: Currently, the service callback is NULL! [RequestId]: %lld, [OperationCode]: %d",
|
||||
LOGE("[End]: [OnFinish]: Currently, the service callback is NULL! [RequestId]: %" PRId64 ", [OperationCode]: %d",
|
||||
requestId, operationCode);
|
||||
}
|
||||
|
||||
void ProcessErrorCallback(int64_t requestId, int operationCode, int errorCode, const char *errorReturn,
|
||||
const DeviceAuthCallback *callback)
|
||||
{
|
||||
LOGI("[OnError]: We're going to notify the service! [RequestId]: %lld, [OperationCode]: %d, [errorCode]: %d",
|
||||
LOGI("[OnError]: We're going to notify the service! [RequestId]: %" PRId64 ", [OperationCode]: %d, [errorCode]: %d",
|
||||
requestId, operationCode, errorCode);
|
||||
if ((callback != NULL) && (callback->onError != NULL)) {
|
||||
callback->onError(requestId, operationCode, errorCode, errorReturn);
|
||||
LOGI("[End]: [OnError]: We notify the service successfully! "
|
||||
"[RequestId]: %lld, [OperationCode]: %d, [errorCode]: %d", requestId, operationCode, errorCode);
|
||||
"[RequestId]: %" PRId64 ", [OperationCode]: %d, [errorCode]: %d", requestId, operationCode, errorCode);
|
||||
return;
|
||||
}
|
||||
LOGE("[End]: [OnError]: Currently, the service callback is NULL! "
|
||||
"[RequestId]: %lld, [OperationCode]: %d, [errorCode]: %d", requestId, operationCode, errorCode);
|
||||
"[RequestId]: %" PRId64 ", [OperationCode]: %d, [errorCode]: %d", requestId, operationCode, errorCode);
|
||||
}
|
||||
|
||||
char *ProcessRequestCallback(int64_t requestId, int operationCode, const char *reqParams,
|
||||
const DeviceAuthCallback *callback)
|
||||
{
|
||||
LOGI("[OnRequest]: We're going to notify the service! [RequestId]: %lld, [OperationCode]: %d",
|
||||
LOGI("[OnRequest]: We're going to notify the service! [RequestId]: %" PRId64 ", [OperationCode]: %d",
|
||||
requestId, operationCode);
|
||||
if ((callback != NULL) && (callback->onRequest != NULL)) {
|
||||
char *returnData = callback->onRequest(requestId, operationCode, reqParams);
|
||||
LOGI("[OnRequest]: We notify the service successfully! [RequestId]: %lld, [OperationCode]: %d",
|
||||
LOGI("[OnRequest]: We notify the service successfully! [RequestId]: %" PRId64 ", [OperationCode]: %d",
|
||||
requestId, operationCode);
|
||||
return returnData;
|
||||
}
|
||||
LOGE("[OnRequest]: Currently, the service callback is NULL! [RequestId]: %lld, [OperationCode]: %d",
|
||||
LOGE("[OnRequest]: Currently, the service callback is NULL! [RequestId]: %" PRId64 ", [OperationCode]: %d",
|
||||
requestId, operationCode);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1907,22 +1907,27 @@ int32_t GetDeviceInfoForDevAuth(const char *udid, const char *groupId, DeviceInf
|
||||
TrustedDeviceEntry *deviceEntry = GetTrustedDeviceEntry(udid, groupId);
|
||||
if (deviceEntry == NULL) {
|
||||
LOGE("[DB]: The trusted device is not found!");
|
||||
g_databaseMutex->unlock(g_databaseMutex);
|
||||
return HC_ERR_DEVICE_NOT_EXIST;
|
||||
}
|
||||
if (!StringSet(&deviceInfo->authId, deviceEntry->authId)) {
|
||||
LOGE("[DB]: Failed to copy authId!");
|
||||
g_databaseMutex->unlock(g_databaseMutex);
|
||||
return HC_ERR_MEMORY_COPY;
|
||||
}
|
||||
if (!StringSet(&deviceInfo->udid, deviceEntry->udid)) {
|
||||
LOGE("[DB]: Failed to copy authId!");
|
||||
g_databaseMutex->unlock(g_databaseMutex);
|
||||
return HC_ERR_MEMORY_COPY;
|
||||
}
|
||||
if (!StringSet(&(deviceInfo->groupId), deviceEntry->groupEntry->id)) {
|
||||
LOGE("[DB]: Failed to copy groupId!");
|
||||
g_databaseMutex->unlock(g_databaseMutex);
|
||||
return HC_ERR_MEMORY_COPY;
|
||||
}
|
||||
if (!StringSet(&(deviceInfo->serviceType), deviceEntry->serviceType)) {
|
||||
LOGE("[DB]: Failed to copy serviceType!");
|
||||
g_databaseMutex->unlock(g_databaseMutex);
|
||||
return HC_ERR_MEMORY_COPY;
|
||||
}
|
||||
deviceInfo->credential = deviceEntry->credential;
|
||||
@@ -1942,22 +1947,27 @@ int32_t GetDeviceInfoByAuthId(const char *authId, const char *groupId, DeviceInf
|
||||
TrustedDeviceEntry *deviceEntry = GetTrustedDeviceEntryByAuthId(authId, groupId);
|
||||
if (deviceEntry == NULL) {
|
||||
LOGE("[DB]: The trusted device is not found!");
|
||||
g_databaseMutex->unlock(g_databaseMutex);
|
||||
return HC_ERR_DEVICE_NOT_EXIST;
|
||||
}
|
||||
if (!StringSet(&deviceInfo->authId, deviceEntry->authId)) {
|
||||
LOGE("[DB]: Failed to copy authId!");
|
||||
g_databaseMutex->unlock(g_databaseMutex);
|
||||
return HC_ERR_MEMORY_COPY;
|
||||
}
|
||||
if (!StringSet(&deviceInfo->udid, deviceEntry->udid)) {
|
||||
LOGE("[DB]: Failed to copy authId!");
|
||||
g_databaseMutex->unlock(g_databaseMutex);
|
||||
return HC_ERR_MEMORY_COPY;
|
||||
}
|
||||
if (!StringSet(&(deviceInfo->groupId), deviceEntry->groupEntry->id)) {
|
||||
LOGE("[DB]: Failed to copy groupId!");
|
||||
g_databaseMutex->unlock(g_databaseMutex);
|
||||
return HC_ERR_MEMORY_COPY;
|
||||
}
|
||||
if (!StringSet(&(deviceInfo->serviceType), deviceEntry->serviceType)) {
|
||||
LOGE("[DB]: Failed to copy serviceType!");
|
||||
g_databaseMutex->unlock(g_databaseMutex);
|
||||
return HC_ERR_MEMORY_COPY;
|
||||
}
|
||||
deviceInfo->credential = deviceEntry->credential;
|
||||
|
||||
+41
-36
@@ -111,7 +111,7 @@ static void DoCreateGroup(HcTaskBase *task)
|
||||
return;
|
||||
}
|
||||
GroupManagerTask *realTask = (GroupManagerTask *)task;
|
||||
LOGI("The task thread starts to execute group creation! [RequestId]: %lld", realTask->requestId);
|
||||
LOGI("The task thread starts to execute group creation! [RequestId]: %" PRId64, realTask->requestId);
|
||||
if (!IsGroupManagerSupported()) {
|
||||
LOGE("Group manager is not supported!");
|
||||
return;
|
||||
@@ -131,7 +131,7 @@ static void DoDeleteGroup(HcTaskBase *task)
|
||||
return;
|
||||
}
|
||||
GroupManagerTask *realTask = (GroupManagerTask *)task;
|
||||
LOGI("The task thread starts to execute group deletion! [RequestId]: %lld", realTask->requestId);
|
||||
LOGI("The task thread starts to execute group deletion! [RequestId]: %" PRId64, realTask->requestId);
|
||||
if (!IsGroupManagerSupported()) {
|
||||
LOGE("Group manager is not supported!");
|
||||
return;
|
||||
@@ -151,7 +151,7 @@ static void DoAddMember(HcTaskBase *task)
|
||||
return;
|
||||
}
|
||||
GroupManagerTask *realTask = (GroupManagerTask *)task;
|
||||
LOGI("The task thread starts to execute member addition! [RequestId]: %lld", realTask->requestId);
|
||||
LOGI("The task thread starts to execute member addition! [RequestId]: %" PRId64, realTask->requestId);
|
||||
if (!IsGroupManagerSupported()) {
|
||||
LOGE("Group manager is not supported!");
|
||||
return;
|
||||
@@ -171,7 +171,7 @@ static void DoDeleteMember(HcTaskBase *task)
|
||||
return;
|
||||
}
|
||||
GroupManagerTask *realTask = (GroupManagerTask *)task;
|
||||
LOGI("The task thread starts to execute member deletion! [RequestId]: %lld", realTask->requestId);
|
||||
LOGI("The task thread starts to execute member deletion! [RequestId]: %" PRId64, realTask->requestId);
|
||||
if (!IsGroupManagerSupported()) {
|
||||
LOGE("Group manager is not supported!");
|
||||
return;
|
||||
@@ -191,7 +191,7 @@ static void DoConfirmRequest(HcTaskBase *task)
|
||||
return;
|
||||
}
|
||||
GroupManagerTask *realTask = (GroupManagerTask *)task;
|
||||
LOGI("The task thread starts to execute request confirmation! [RequestId]: %lld", realTask->requestId);
|
||||
LOGI("The task thread starts to execute request confirmation! [RequestId]: %" PRId64, realTask->requestId);
|
||||
OnConfirmationReceived(realTask->requestId, realTask->jsonParams);
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ static void OnChannelOpenedAction(HcTaskBase *task)
|
||||
}
|
||||
GroupManagerTask *realTask = (GroupManagerTask *)task;
|
||||
LOGI("The task thread starts to execute the task that needs to be executed"
|
||||
"when the soft bus channel is open! [RequestId]: %lld", realTask->requestId);
|
||||
"when the soft bus channel is open! [RequestId]: %" PRId64, realTask->requestId);
|
||||
CJson *jsonParams = realTask->jsonParams;
|
||||
int64_t channelId = DEFAULT_CHANNEL_ID;
|
||||
if (GetByteFromJson(jsonParams, FIELD_CHANNEL_ID, (uint8_t *)&channelId, sizeof(int64_t)) != HC_SUCCESS) {
|
||||
@@ -221,14 +221,14 @@ static void DoProcessBindData(HcTaskBase *task)
|
||||
}
|
||||
GroupManagerTask *realTask = (GroupManagerTask *)task;
|
||||
if (IsRequestExist(realTask->requestId)) {
|
||||
LOGI("The task thread starts to process data! [RequestId]: %lld", realTask->requestId);
|
||||
LOGI("The task thread starts to process data! [RequestId]: %" PRId64, realTask->requestId);
|
||||
int ret = ProcessSession(realTask->requestId, BIND_TYPE, realTask->jsonParams);
|
||||
if (ret != CONTINUE) {
|
||||
DestroySession(realTask->requestId);
|
||||
}
|
||||
return;
|
||||
}
|
||||
LOGI("The task thread starts to create a server binding session! [RequestId]: %lld", realTask->requestId);
|
||||
LOGI("The task thread starts to create a server binding session! [RequestId]: %" PRId64, realTask->requestId);
|
||||
if ((BindCallbackToTask(realTask, realTask->jsonParams) != HC_SUCCESS) ||
|
||||
(CheckMsgRepeatability(realTask->jsonParams, DAS_MODULE) != HC_SUCCESS)) {
|
||||
return;
|
||||
@@ -518,7 +518,7 @@ static int32_t UnRegGroupManagerCallback(const char *appId)
|
||||
|
||||
static int32_t RequestCreateGroup(int64_t requestId, const char *appId, const char *createParams)
|
||||
{
|
||||
LOGI("[Start]: RequestCreateGroup! [AppId]: %s, [RequestId]: %lld", appId, requestId);
|
||||
LOGI("[Start]: RequestCreateGroup! [AppId]: %s, [RequestId]: %" PRId64, appId, requestId);
|
||||
if ((appId == NULL) || (createParams == NULL)) {
|
||||
LOGE("The input parameters contains NULL value!");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
@@ -551,13 +551,13 @@ static int32_t RequestCreateGroup(int64_t requestId, const char *appId, const ch
|
||||
return HC_ERR_INIT_TASK_FAIL;
|
||||
}
|
||||
g_taskThread->pushTask(g_taskThread, (HcTaskBase*)task);
|
||||
LOGI("[End]: Create the creating group task successfully! [AppId]: %s, [RequestId]: %lld", appId, requestId);
|
||||
LOGI("[End]: Create the creating group task successfully! [AppId]: %s, [RequestId]: %" PRId64, appId, requestId);
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t RequestDeleteGroup(int64_t requestId, const char *appId, const char *disbandParams)
|
||||
{
|
||||
LOGI("[Start]: RequestDeleteGroup! [AppId]: %s, [RequestId]: %lld", appId, requestId);
|
||||
LOGI("[Start]: RequestDeleteGroup! [AppId]: %s, [RequestId]: %" PRId64, appId, requestId);
|
||||
if ((appId == NULL) || (disbandParams == NULL)) {
|
||||
LOGE("The input parameters contains NULL value!");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
@@ -590,13 +590,13 @@ static int32_t RequestDeleteGroup(int64_t requestId, const char *appId, const ch
|
||||
return HC_ERR_INIT_TASK_FAIL;
|
||||
}
|
||||
g_taskThread->pushTask(g_taskThread, (HcTaskBase *)task);
|
||||
LOGI("[End]: Create the deleting group task successfully! [AppId]: %s, [RequestId]: %lld", appId, requestId);
|
||||
LOGI("[End]: Create the deleting group task successfully! [AppId]: %s, [RequestId]: %" PRId64, appId, requestId);
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t RequestAddMemberToGroup(int64_t requestId, const char *appId, const char *addParams)
|
||||
{
|
||||
LOGI("[Start]: RequestAddMemberToGroup! [AppId]: %s, [RequestId]: %lld", appId, requestId);
|
||||
LOGI("[Start]: RequestAddMemberToGroup! [AppId]: %s, [RequestId]: %" PRId64, appId, requestId);
|
||||
if ((appId == NULL) || (addParams == NULL)) {
|
||||
LOGE("The input parameters contains NULL value!");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
@@ -629,13 +629,13 @@ static int32_t RequestAddMemberToGroup(int64_t requestId, const char *appId, con
|
||||
return HC_ERR_INIT_TASK_FAIL;
|
||||
}
|
||||
g_taskThread->pushTask(g_taskThread, (HcTaskBase*)task);
|
||||
LOGI("[End]: Create the adding member task successfully! [AppId]: %s, [RequestId]: %lld", appId, requestId);
|
||||
LOGI("[End]: Create the adding member task successfully! [AppId]: %s, [RequestId]: %" PRId64, appId, requestId);
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t RequestDeleteMemberFromGroup(int64_t requestId, const char *appId, const char *deleteParams)
|
||||
{
|
||||
LOGI("[Start]: RequestDeleteMemberFromGroup! [AppId]: %s, [RequestId]: %lld", appId, requestId);
|
||||
LOGI("[Start]: RequestDeleteMemberFromGroup! [AppId]: %s, [RequestId]: %" PRId64, appId, requestId);
|
||||
if ((appId == NULL) || (deleteParams == NULL)) {
|
||||
LOGE("The input parameters contains NULL value!");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
@@ -668,13 +668,13 @@ static int32_t RequestDeleteMemberFromGroup(int64_t requestId, const char *appId
|
||||
return HC_ERR_INIT_TASK_FAIL;
|
||||
}
|
||||
g_taskThread->pushTask(g_taskThread, (HcTaskBase*)task);
|
||||
LOGI("[End]: Create the deleting member task successfully! [AppId]: %s, [RequestId]: %lld", appId, requestId);
|
||||
LOGI("[End]: Create the deleting member task successfully! [AppId]: %s, [RequestId]: %" PRId64, appId, requestId);
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t RequestProcessBindData(int64_t requestId, const uint8_t *data, uint32_t dataLen)
|
||||
{
|
||||
LOGI("[Start]: RequestProcessBindData! [RequestId]: %lld", requestId);
|
||||
LOGI("[Start]: RequestProcessBindData! [RequestId]: %" PRId64, requestId);
|
||||
if ((data == NULL) || (dataLen > MAX_DATA_BUFFER_SIZE)) {
|
||||
LOGE("The input data is invalid!");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
@@ -697,7 +697,7 @@ static int32_t RequestProcessBindData(int64_t requestId, const uint8_t *data, ui
|
||||
}
|
||||
if (tempRequestId != requestId) {
|
||||
LOGE("The requestId transferred by the service is inconsistent with that in the packet! "
|
||||
"[ServiceRequestId]: %lld, [RequestId]: %lld", requestId, tempRequestId);
|
||||
"[ServiceRequestId]: %" PRId64 ", [RequestId]: %" PRId64, requestId, tempRequestId);
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
}
|
||||
GroupManagerTask *task = (GroupManagerTask *)HcMalloc(sizeof(GroupManagerTask), 0);
|
||||
@@ -708,13 +708,13 @@ static int32_t RequestProcessBindData(int64_t requestId, const uint8_t *data, ui
|
||||
}
|
||||
InitProcessBindDataTask(task, requestId, dataJson);
|
||||
g_taskThread->pushTask(g_taskThread, (HcTaskBase*)task);
|
||||
LOGI("[End]: Create the processing data task successfully! [RequestId]: %lld", requestId);
|
||||
LOGI("[End]: Create the processing data task successfully! [RequestId]: %" PRId64, requestId);
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t ConfirmRequest(int64_t requestId, const char *appId, const char *confirmParams)
|
||||
{
|
||||
LOGI("[Start]: ConfirmRequest! [AppId]: %s, [RequestId]: %lld", appId, requestId);
|
||||
LOGI("[Start]: ConfirmRequest! [AppId]: %s, [RequestId]: %" PRId64, appId, requestId);
|
||||
if ((appId == NULL) || (confirmParams == NULL)) {
|
||||
LOGE("The input parameters contains NULL value!");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
@@ -746,7 +746,8 @@ static int32_t ConfirmRequest(int64_t requestId, const char *appId, const char *
|
||||
return HC_ERR_INIT_TASK_FAIL;
|
||||
}
|
||||
g_taskThread->pushTask(g_taskThread, (HcTaskBase*)task);
|
||||
LOGI("[End]: Create the confirming request task successfully! [AppId]: %s, [RequestId]: %lld", appId, requestId);
|
||||
LOGI("[End]: Create the confirming request task successfully! [AppId]: %s, [RequestId]: %" PRId64,
|
||||
appId, requestId);
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -837,7 +838,7 @@ static void DoProcessLiteData(HcTaskBase *task)
|
||||
return;
|
||||
}
|
||||
GroupManagerTask *realTask = (GroupManagerTask *)task;
|
||||
LOGI("The task thread starts to execute the processing lite data task! [RequestId]: %lld", realTask->requestId);
|
||||
LOGI("The task thread starts to execute the processing lite data task! [RequestId]: %" PRId64, realTask->requestId);
|
||||
if (IsRequestExist(realTask->requestId)) {
|
||||
int ret = ProcessSession(realTask->requestId, BIND_TYPE, realTask->jsonParams);
|
||||
if (ret != CONTINUE) {
|
||||
@@ -863,7 +864,7 @@ static void DoBindPeer(HcTaskBase *task)
|
||||
return;
|
||||
}
|
||||
GroupManagerTask *realTask = (GroupManagerTask *)task;
|
||||
LOGI("The task thread starts to execute the binding peer device task! [RequestId]: %lld", realTask->requestId);
|
||||
LOGI("The task thread starts to execute the binding peer device task! [RequestId]: %" PRId64, realTask->requestId);
|
||||
int32_t result;
|
||||
ChannelType channelType = GetChannelType(realTask->callback);
|
||||
do {
|
||||
@@ -897,7 +898,8 @@ static void DoUnbindPeer(HcTaskBase *task)
|
||||
return;
|
||||
}
|
||||
GroupManagerTask *realTask = (GroupManagerTask *)task;
|
||||
LOGI("The task thread starts to execute the unbinding peer device task! [RequestId]: %lld", realTask->requestId);
|
||||
LOGI("The task thread starts to execute the unbinding peer device task! [RequestId]: %" PRId64,
|
||||
realTask->requestId);
|
||||
int32_t result;
|
||||
ChannelType channelType = GetChannelType(realTask->callback);
|
||||
do {
|
||||
@@ -931,7 +933,7 @@ static void DoAuthAgreeKey(HcTaskBase *task)
|
||||
return;
|
||||
}
|
||||
GroupManagerTask *realTask = (GroupManagerTask *)task;
|
||||
LOGI("The task thread starts to execute the key agreement task! [RequestId]: %lld", realTask->requestId);
|
||||
LOGI("The task thread starts to execute the key agreement task! [RequestId]: %" PRId64, realTask->requestId);
|
||||
int32_t result;
|
||||
ChannelType channelType = GetChannelType(realTask->callback);
|
||||
do {
|
||||
@@ -965,7 +967,7 @@ static void DoProcessKeyAgreeData(HcTaskBase *task)
|
||||
return;
|
||||
}
|
||||
GroupManagerTask *realTask = (GroupManagerTask *)task;
|
||||
LOGI("The task thread starts to execute the processing key agreement data task! [RequestId]: %lld",
|
||||
LOGI("The task thread starts to execute the processing key agreement data task! [RequestId]: %" PRId64,
|
||||
realTask->requestId);
|
||||
if (IsRequestExist(realTask->requestId)) {
|
||||
int ret = ProcessSession(realTask->requestId, BIND_TYPE, realTask->jsonParams);
|
||||
@@ -1046,7 +1048,7 @@ static int32_t AddLiteDataToReceivedData(CJson *receivedData, int64_t requestId,
|
||||
|
||||
static int32_t RequestProcessLiteData(int64_t requestId, const char *appId, const uint8_t *data, uint32_t dataLen)
|
||||
{
|
||||
LOGI("[Start]: RequestProcessLiteData! [AppId]: %s, [RequestId]: %lld", appId, requestId);
|
||||
LOGI("[Start]: RequestProcessLiteData! [AppId]: %s, [RequestId]: %" PRId64, appId, requestId);
|
||||
if ((appId == NULL) || (data == NULL) || (dataLen > MAX_DATA_BUFFER_SIZE)) {
|
||||
LOGE("The input data is NULL or dataLen is beyond max size!");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
@@ -1078,13 +1080,14 @@ static int32_t RequestProcessLiteData(int64_t requestId, const char *appId, cons
|
||||
return HC_ERR_INIT_TASK_FAIL;
|
||||
}
|
||||
g_taskThread->pushTask(g_taskThread, (HcTaskBase*)task);
|
||||
LOGI("[End]: Create the processing lite data task successfully! [AppId]: %s, [RequestId]: %lld", appId, requestId);
|
||||
LOGI("[End]: Create the processing lite data task successfully! [AppId]: %s, [RequestId]: %" PRId64,
|
||||
appId, requestId);
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t RequestBindPeer(int64_t requestId, const char *appId, const char *bindParams)
|
||||
{
|
||||
LOGI("[Start]: RequestBindPeer! [AppId]: %s, [RequestId]: %lld", appId, requestId);
|
||||
LOGI("[Start]: RequestBindPeer! [AppId]: %s, [RequestId]: %" PRId64, appId, requestId);
|
||||
if ((appId == NULL) || (bindParams == NULL)) {
|
||||
LOGE("The input parameters contains NULL value!");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
@@ -1117,13 +1120,14 @@ static int32_t RequestBindPeer(int64_t requestId, const char *appId, const char
|
||||
return HC_ERR_INIT_TASK_FAIL;
|
||||
}
|
||||
g_taskThread->pushTask(g_taskThread, (HcTaskBase*)task);
|
||||
LOGI("[End]: Create the binding peer device task successfully! [AppId]: %s, [RequestId]: %lld", appId, requestId);
|
||||
LOGI("[End]: Create the binding peer device task successfully! [AppId]: %s, [RequestId]: %" PRId64,
|
||||
appId, requestId);
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t RequestUnbindPeer(int64_t requestId, const char *appId, const char *unBindParams)
|
||||
{
|
||||
LOGI("[Start]: RequestUnbindPeer, [AppId]: %s, [RequestId]: %lld", appId, requestId);
|
||||
LOGI("[Start]: RequestUnbindPeer, [AppId]: %s, [RequestId]: %" PRId64, appId, requestId);
|
||||
if ((appId == NULL) || (unBindParams == NULL)) {
|
||||
LOGE("The input parameters contains NULL value!");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
@@ -1156,13 +1160,14 @@ static int32_t RequestUnbindPeer(int64_t requestId, const char *appId, const cha
|
||||
return HC_ERR_INIT_TASK_FAIL;
|
||||
}
|
||||
g_taskThread->pushTask(g_taskThread, (HcTaskBase*)task);
|
||||
LOGI("[End]: Create the unbinding peer device task successfully! [AppId]: %s, [RequestId]: %lld", appId, requestId);
|
||||
LOGI("[End]: Create the unbinding peer device task successfully! [AppId]: %s, [RequestId]: %" PRId64,
|
||||
appId, requestId);
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t RequestAuthKeyAgree(int64_t requestId, const char *appId, const char *agreeParams)
|
||||
{
|
||||
LOGI("[Start]: RequestAuthKeyAgree! [AppId]: %s, [RequestId]: %lld", appId, requestId);
|
||||
LOGI("[Start]: RequestAuthKeyAgree! [AppId]: %s, [RequestId]: %" PRId64, appId, requestId);
|
||||
if ((appId == NULL) || (agreeParams == NULL)) {
|
||||
LOGE("The input parameters contains NULL value!");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
@@ -1195,13 +1200,13 @@ static int32_t RequestAuthKeyAgree(int64_t requestId, const char *appId, const c
|
||||
return HC_ERR_INIT_TASK_FAIL;
|
||||
}
|
||||
g_taskThread->pushTask(g_taskThread, (HcTaskBase*)task);
|
||||
LOGI("[End]: Create the key agreement task successfully! [AppId]: %s, [RequestId]: %lld", appId, requestId);
|
||||
LOGI("[End]: Create the key agreement task successfully! [AppId]: %s, [RequestId]: %" PRId64, appId, requestId);
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t RequestProcessKeyAgreeData(int64_t requestId, const char *appId, const uint8_t *data, uint32_t dataLen)
|
||||
{
|
||||
LOGI("[Start]: RequestProcessKeyAgreeData! [AppId]: %s, [RequestId]: %lld", appId, requestId);
|
||||
LOGI("[Start]: RequestProcessKeyAgreeData! [AppId]: %s, [RequestId]: %" PRId64, appId, requestId);
|
||||
if ((appId == NULL) || (data == NULL) || (dataLen > MAX_DATA_BUFFER_SIZE)) {
|
||||
LOGE("The input data is NULL or dataLen is beyond max size!");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
@@ -1233,7 +1238,7 @@ static int32_t RequestProcessKeyAgreeData(int64_t requestId, const char *appId,
|
||||
return HC_ERR_INIT_TASK_FAIL;
|
||||
}
|
||||
g_taskThread->pushTask(g_taskThread, (HcTaskBase*)task);
|
||||
LOGI("[End]: Create the processing key agreement data task successfully! [AppId]: %s, [RequestId]: %lld", appId,
|
||||
LOGI("[End]: Create the processing key agreement data task successfully! [AppId]: %s, [RequestId]: %" PRId64, appId,
|
||||
requestId);
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
+10
-10
@@ -447,7 +447,7 @@ static int32_t CheckServerStatusIfNotInvite(int operationCode, const CJson *json
|
||||
|
||||
static int32_t CreateGroup(int64_t requestId, CJson *jsonParams, const DeviceAuthCallback *callback)
|
||||
{
|
||||
LOGI("[Start]: Start to create a peer to peer group! [RequestId]: %lld", requestId);
|
||||
LOGI("[Start]: Start to create a peer to peer group! [RequestId]: %" PRId64, requestId);
|
||||
int32_t result;
|
||||
char *groupId = NULL;
|
||||
char *returnDataStr = NULL;
|
||||
@@ -465,12 +465,12 @@ static int32_t CreateGroup(int64_t requestId, CJson *jsonParams, const DeviceAut
|
||||
} while (0);
|
||||
if (result != HC_SUCCESS) {
|
||||
ProcessErrorCallback(requestId, GROUP_CREATE, result, NULL, callback);
|
||||
LOGE("[End]: Failed to create a peer to peer group! [RequestId]: %lld", requestId);
|
||||
LOGE("[End]: Failed to create a peer to peer group! [RequestId]: %" PRId64, requestId);
|
||||
return result;
|
||||
}
|
||||
ProcessFinishCallback(requestId, GROUP_CREATE, returnDataStr, callback);
|
||||
FreeJsonString(returnDataStr);
|
||||
LOGI("[End]: Create a peer to peer group successfully! [RequestId]: %lld", requestId);
|
||||
LOGI("[End]: Create a peer to peer group successfully! [RequestId]: %" PRId64, requestId);
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -481,7 +481,7 @@ static int32_t DeleteGroup(int64_t requestId, CJson *jsonParams, const DeviceAut
|
||||
const char *appId = NULL;
|
||||
char *returnDataStr = NULL;
|
||||
do {
|
||||
LOGI("[Start]: Start to delete a peer to peer group! [RequestId]: %lld", requestId);
|
||||
LOGI("[Start]: Start to delete a peer to peer group! [RequestId]: %" PRId64, requestId);
|
||||
groupId = GetStringFromJson(jsonParams, FIELD_GROUP_ID);
|
||||
if (groupId == NULL) {
|
||||
LOGE("Failed to get groupId from jsonParams!");
|
||||
@@ -507,7 +507,7 @@ static int32_t DeleteGroup(int64_t requestId, CJson *jsonParams, const DeviceAut
|
||||
} while (0);
|
||||
if (result != HC_SUCCESS) {
|
||||
ProcessErrorCallback(requestId, GROUP_DISBAND, result, NULL, callback);
|
||||
LOGE("[End]: Failed to delete a peer to peer group! [RequestId]: %lld", requestId);
|
||||
LOGE("[End]: Failed to delete a peer to peer group! [RequestId]: %" PRId64, requestId);
|
||||
return result;
|
||||
}
|
||||
/*
|
||||
@@ -520,7 +520,7 @@ static int32_t DeleteGroup(int64_t requestId, CJson *jsonParams, const DeviceAut
|
||||
}
|
||||
ProcessFinishCallback(requestId, GROUP_DISBAND, returnDataStr, callback);
|
||||
FreeJsonString(returnDataStr);
|
||||
LOGI("[End]: Delete a peer to peer group successfully! [RequestId]: %lld", requestId);
|
||||
LOGI("[End]: Delete a peer to peer group successfully! [RequestId]: %" PRId64, requestId);
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ static int32_t AddMemberToGroup(int64_t requestId, CJson *jsonParams, const Devi
|
||||
int32_t result;
|
||||
int operationCode = MEMBER_INVITE;
|
||||
do {
|
||||
LOGI("[Start]: Start to add member to a peer to peer group! [RequestId]: %lld", requestId);
|
||||
LOGI("[Start]: Start to add member to a peer to peer group! [RequestId]: %" PRId64, requestId);
|
||||
(void)GetIntFromJson(jsonParams, FIELD_OPERATION_CODE, &operationCode);
|
||||
result = CheckClientStatus(operationCode, jsonParams);
|
||||
if (result != HC_SUCCESS) {
|
||||
@@ -558,7 +558,7 @@ static int32_t AddMemberToGroup(int64_t requestId, CJson *jsonParams, const Devi
|
||||
} while (0);
|
||||
if (result != HC_SUCCESS) {
|
||||
ProcessErrorCallback(requestId, operationCode, result, NULL, callback);
|
||||
LOGE("[End]: Failed to add member to a peer to peer group! [RequestId]: %lld", requestId);
|
||||
LOGE("[End]: Failed to add member to a peer to peer group! [RequestId]: %" PRId64, requestId);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -613,11 +613,11 @@ static int32_t DeleteMemberFromGroupInner(int64_t requestId, CJson *jsonParams,
|
||||
|
||||
static int32_t DeleteMemberFromGroup(int64_t requestId, CJson *jsonParams, const DeviceAuthCallback *callback)
|
||||
{
|
||||
LOGI("[Start]: Start to delete member from a peer to peer group! [RequestId]: %lld", requestId);
|
||||
LOGI("[Start]: Start to delete member from a peer to peer group! [RequestId]: %" PRId64, requestId);
|
||||
int32_t result = DeleteMemberFromGroupInner(requestId, jsonParams, callback);
|
||||
if (result != HC_SUCCESS) {
|
||||
ProcessErrorCallback(requestId, MEMBER_DELETE, result, NULL, callback);
|
||||
LOGE("[End]: Failed to delete member from a peer to peer group! [RequestId]: %lld", requestId);
|
||||
LOGE("[End]: Failed to delete member from a peer to peer group! [RequestId]: %" PRId64, requestId);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -601,8 +601,8 @@ static int32_t UnRegListener(const char *appId)
|
||||
|
||||
static int32_t GetAccessibleGroupInfoById(const char *appId, const char *groupId, char **returnGroupInfo)
|
||||
{
|
||||
if ((appId == NULL) || (groupId == NULL)) {
|
||||
LOGE("The input appId or groupId is NULL!");
|
||||
if ((appId == NULL) || (groupId == NULL) || (returnGroupInfo == NULL)) {
|
||||
LOGE("The input parameters contains NULL value!");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
}
|
||||
if (!IsGroupExistByGroupId(groupId)) {
|
||||
@@ -647,8 +647,8 @@ static int32_t GetAccessibleGroupInfoById(const char *appId, const char *groupId
|
||||
static int32_t GetAccessibleGroupInfo(const char *appId, const char *queryParams, char **returnGroupVec,
|
||||
uint32_t *groupNum)
|
||||
{
|
||||
if ((appId == NULL) || (queryParams == NULL)) {
|
||||
LOGE("The input appId or queryParams is NULL!");
|
||||
if ((appId == NULL) || (queryParams == NULL) || (returnGroupVec == NULL) || (groupNum == NULL)) {
|
||||
LOGE("The input parameters contains NULL value!");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
}
|
||||
CJson *queryParamsJson = CreateJsonFromString(queryParams);
|
||||
@@ -687,8 +687,8 @@ static int32_t GetAccessibleGroupInfo(const char *appId, const char *queryParams
|
||||
|
||||
static int32_t GetAccessibleJoinedGroups(const char *appId, int groupType, char **returnGroupVec, uint32_t *groupNum)
|
||||
{
|
||||
if (appId == NULL) {
|
||||
LOGE("The input appId is NULL!");
|
||||
if ((appId == NULL) || (returnGroupVec == NULL) || (groupNum == NULL)) {
|
||||
LOGE("The input parameters contains NULL value!");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
}
|
||||
if (!IsGroupTypeSupported(groupType)) {
|
||||
@@ -711,8 +711,8 @@ static int32_t GetAccessibleJoinedGroups(const char *appId, int groupType, char
|
||||
static int32_t GetAccessibleRelatedGroups(const char *appId, const char *peerDeviceId,
|
||||
char **returnGroupVec, uint32_t *groupNum)
|
||||
{
|
||||
if ((appId == NULL) || (peerDeviceId == NULL)) {
|
||||
LOGE("The input appId or peerUdid is NULL!");
|
||||
if ((appId == NULL) || (peerDeviceId == NULL) || (returnGroupVec == NULL) || (groupNum == NULL)) {
|
||||
LOGE("The input parameters contains NULL value!");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
}
|
||||
LOGI("Start to get related groups! [AppId]: %s", appId);
|
||||
@@ -732,7 +732,7 @@ static int32_t GetAccessibleRelatedGroups(const char *appId, const char *peerDev
|
||||
static int32_t GetAccessibleDeviceInfoById(const char *appId, const char *deviceId,
|
||||
const char *groupId, char **returnDeviceInfo)
|
||||
{
|
||||
if ((appId == NULL) || (deviceId == NULL) || (groupId == NULL)) {
|
||||
if ((appId == NULL) || (deviceId == NULL) || (groupId == NULL) || (returnDeviceInfo == NULL)) {
|
||||
LOGE("The input parameters contains NULL value!");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
}
|
||||
@@ -778,8 +778,8 @@ static int32_t GetAccessibleDeviceInfoById(const char *appId, const char *device
|
||||
static int32_t GetAccessibleTrustedDevices(const char *appId, const char *groupId,
|
||||
char **returnDevInfoVec, uint32_t *deviceNum)
|
||||
{
|
||||
if ((appId == NULL) || (groupId == NULL)) {
|
||||
LOGE("The input appId or groupId is NULL!");
|
||||
if ((appId == NULL) || (groupId == NULL) || (returnDevInfoVec == NULL) || (deviceNum == NULL)) {
|
||||
LOGE("The input parameters contains NULL value!");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
}
|
||||
if (!IsGroupExistByGroupId(groupId)) {
|
||||
|
||||
@@ -160,7 +160,8 @@ Session *CreateClientBindSession(CJson *jsonParams, const DeviceAuthCallback *ca
|
||||
LOGE("Failed to get operationCode from jsonParams!");
|
||||
return NULL;
|
||||
}
|
||||
LOGI("Start to create client bind session! [RequestId]: %lld, [OperationCode]: %d", requestId, operationCode);
|
||||
LOGI("Start to create client bind session! [RequestId]: %" PRId64 ", [OperationCode]: %d",
|
||||
requestId, operationCode);
|
||||
/*
|
||||
* If service want to join the peer group,
|
||||
* the identity key pair of the corresponding group needs to be generated here.
|
||||
@@ -193,6 +194,7 @@ Session *CreateClientBindSession(CJson *jsonParams, const DeviceAuthCallback *ca
|
||||
DestroyBindSession((Session *)session);
|
||||
return NULL;
|
||||
}
|
||||
LOGI("Create client bind session successfully! [RequestId]: %lld, [OperationCode]: %d", requestId, operationCode);
|
||||
LOGI("Create client bind session successfully! [RequestId]: %" PRId64 ", [OperationCode]: %d",
|
||||
requestId, operationCode);
|
||||
return (Session *)session;
|
||||
}
|
||||
@@ -969,21 +969,21 @@ static int32_t AddPeerDevToGroup(const char *peerAuthId, const char *peerUdid,
|
||||
const char *groupId, const BindSession *session)
|
||||
{
|
||||
if (IsTrustedDeviceInGroupByAuthId(groupId, peerAuthId)) {
|
||||
LOGI("The peer device already exists in the group! RequestId: %lld", session->requestId);
|
||||
LOGI("The peer device already exists in the group! RequestId: %" PRId64, session->requestId);
|
||||
if (DelTrustedDeviceByAuthId(peerAuthId, groupId) != HC_SUCCESS) {
|
||||
LOGE("Failed to delete the original data! RequestId: %lld", session->requestId);
|
||||
LOGE("Failed to delete the original data! RequestId: %" PRId64, session->requestId);
|
||||
return HC_ERR_DB;
|
||||
}
|
||||
LOGI("Delete the original data successfully! RequestId: %lld", session->requestId);
|
||||
LOGI("Delete the original data successfully! RequestId: %" PRId64, session->requestId);
|
||||
}
|
||||
int peerUserType = DEVICE_TYPE_ACCESSORY;
|
||||
(void)GetIntFromJson(session->params, FIELD_PEER_USER_TYPE, &peerUserType);
|
||||
int32_t result = AddTrustDevToDatabase(peerAuthId, peerUdid, groupId, peerUserType);
|
||||
if (result != HC_SUCCESS) {
|
||||
LOGE("Failed to update the peer trusted device information! RequestId: %lld", session->requestId);
|
||||
LOGE("Failed to update the peer trusted device information! RequestId: %" PRId64, session->requestId);
|
||||
return result;
|
||||
}
|
||||
LOGI("The peer trusted device is added to the database successfully! RequestId: %lld", session->requestId);
|
||||
LOGI("The peer trusted device is added to the database successfully! RequestId: %" PRId64, session->requestId);
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1149,7 +1149,7 @@ static int32_t ProcessBindSession(Session *session, CJson *jsonParams)
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
}
|
||||
BindSession *realSession = (BindSession *)session;
|
||||
LOGI("Start to process bind session! [RequestId]: %lld, [OperationCode]: %d",
|
||||
LOGI("Start to process bind session! [RequestId]: %" PRId64 ", [OperationCode]: %d",
|
||||
realSession->requestId, realSession->operationCode);
|
||||
|
||||
bool isNeedInform = true;
|
||||
@@ -1165,7 +1165,7 @@ static int32_t ProcessBindSession(Session *session, CJson *jsonParams)
|
||||
CloseChannel(realSession->channelType, realSession->channelId);
|
||||
return result;
|
||||
}
|
||||
LOGI("Process bind session successfully! [RequestId]: %lld, [OperationCode]: %d",
|
||||
LOGI("Process bind session successfully! [RequestId]: %" PRId64 ", [OperationCode]: %d",
|
||||
realSession->requestId, realSession->operationCode);
|
||||
if (status == FINISH) {
|
||||
return status;
|
||||
|
||||
@@ -467,7 +467,8 @@ Session *CreateServerBindSession(CJson *jsonParams, const DeviceAuthCallback *ca
|
||||
LOGE("Failed to get operationCode from jsonParams!");
|
||||
return NULL;
|
||||
}
|
||||
LOGI("Start to create server bind session! [RequestId]: %lld, [OperationCode]: %d", requestId, operationCode);
|
||||
LOGI("Start to create server bind session! [RequestId]: %" PRId64 ", [OperationCode]: %d",
|
||||
requestId, operationCode);
|
||||
|
||||
BindSession *session = (BindSession *)HcMalloc(sizeof(BindSession), 0);
|
||||
if (session == NULL) {
|
||||
@@ -489,6 +490,7 @@ Session *CreateServerBindSession(CJson *jsonParams, const DeviceAuthCallback *ca
|
||||
DestroyBindSession((Session *)session);
|
||||
return NULL;
|
||||
}
|
||||
LOGI("Create server bind session successfully! [RequestId]: %lld, [OperationCode]: %d", requestId, operationCode);
|
||||
LOGI("Create server bind session successfully! [RequestId]: %" PRId64 ", [OperationCode]: %d",
|
||||
requestId, operationCode);
|
||||
return (Session *)session;
|
||||
}
|
||||
@@ -82,7 +82,8 @@ Session *CreateLiteClientBindSession(CJson *jsonParams, const DeviceAuthCallback
|
||||
LOGE("Failed to get operationCode from jsonParams!");
|
||||
return NULL;
|
||||
}
|
||||
LOGI("Start to create lite client bind session! [RequestId]: %lld, [OperationCode]: %d", requestId, operationCode);
|
||||
LOGI("Start to create lite client bind session! [RequestId]: %" PRId64 ", [OperationCode]: %d",
|
||||
requestId, operationCode);
|
||||
|
||||
LiteBindSession *session = (LiteBindSession *)HcMalloc(sizeof(LiteBindSession), 0);
|
||||
if (session == NULL) {
|
||||
@@ -100,7 +101,7 @@ Session *CreateLiteClientBindSession(CJson *jsonParams, const DeviceAuthCallback
|
||||
DestroyLiteBindSession((Session *)session);
|
||||
return NULL;
|
||||
}
|
||||
LOGI("Create lite client bind session successfully! [RequestId]: %lld, [OperationCode]: %d",
|
||||
LOGI("Create lite client bind session successfully! [RequestId]: %" PRId64 ", [OperationCode]: %d",
|
||||
requestId, operationCode);
|
||||
return (Session *)session;
|
||||
}
|
||||
@@ -164,7 +164,8 @@ Session *CreateLiteServerBindSession(CJson *jsonParams, const DeviceAuthCallback
|
||||
}
|
||||
int operationCode = OP_BIND;
|
||||
(void)(GetIntFromJson(jsonParams, FIELD_OPERATION_CODE, &operationCode));
|
||||
LOGI("Start to create lite server bind session! [RequestId]: %lld, [OperationCode]: %d", requestId, operationCode);
|
||||
LOGI("Start to create lite server bind session! [RequestId]: %" PRId64 ", [OperationCode]: %d",
|
||||
requestId, operationCode);
|
||||
|
||||
LiteBindSession *session = (LiteBindSession *)HcMalloc(sizeof(LiteBindSession), 0);
|
||||
if (session == NULL) {
|
||||
@@ -186,7 +187,7 @@ Session *CreateLiteServerBindSession(CJson *jsonParams, const DeviceAuthCallback
|
||||
DestroyLiteBindSession((Session *)session);
|
||||
return NULL;
|
||||
}
|
||||
LOGI("Create lite server bind session successfully! [RequestId]: %lld, [OperationCode]: %d",
|
||||
LOGI("Create lite server bind session successfully! [RequestId]: %" PRId64 ", [OperationCode]: %d",
|
||||
requestId, operationCode);
|
||||
return (Session *)session;
|
||||
}
|
||||
@@ -148,7 +148,7 @@ static void InformTimeOutAndDestroyRequest(const DeviceAuthCallback *callback, i
|
||||
break;
|
||||
}
|
||||
}
|
||||
LOGI("Begin to inform time out, requestId :%lld", requestId);
|
||||
LOGI("Begin to inform time out, requestId :%" PRId64, requestId);
|
||||
callback->onError(requestId, AUTH_FORM_INVALID_TYPE, HC_ERR_TIME_OUT, NULL);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user