mirror of
https://github.com/openharmony/security_deviceauth.git
synced 2026-07-21 03:15:26 -04:00
@@ -167,7 +167,6 @@ static int OnChannelOpenedCb(int sessionId, int result)
|
||||
DestroySession(requestId);
|
||||
return HC_ERR_SOFT_BUS;
|
||||
}
|
||||
LOGD("[Start]: OnChannelOpened! [ReqId]: %lld, [ChannelId]: %d", requestId, sessionId);
|
||||
SoftBusTask *task = (SoftBusTask *)HcMalloc(sizeof(SoftBusTask), 0);
|
||||
if (task == NULL) {
|
||||
LOGE("Failed to allocate task memory!");
|
||||
@@ -217,7 +216,6 @@ static int32_t OpenSoftBusChannel(const char *connectParams, int64_t requestId,
|
||||
}
|
||||
LOGD("[SoftBus][In]: OpenChannel!");
|
||||
int64_t channelId = (int64_t)OpenAuthSession(GROUP_MANAGER_PACKAGE_NAME, NULL, 0, connectParams);
|
||||
LOGD("[SoftBus][Out]: OpenChannel! [channelId]: %lld", channelId);
|
||||
/* If the value of channelId is less than 0, the soft bus fails to open the channel */
|
||||
if (channelId < 0) {
|
||||
LOGE("Failed to open soft bus channel!");
|
||||
|
||||
@@ -122,90 +122,6 @@ static char *OnRequestNormal(int64_t requestId, int operationCode, const char *r
|
||||
return returnDataStr;
|
||||
}
|
||||
|
||||
static char *OnRequestError1(int64_t requestId, int operationCode, const char *reqParams)
|
||||
{
|
||||
g_messageCode = ON_REQUEST;
|
||||
g_requestId = requestId;
|
||||
g_operationCode = operationCode;
|
||||
CJson *json = CreateJson();
|
||||
AddIntToJson(json, FIELD_CONFIRMATION, REQUEST_REJECTED);
|
||||
AddStringToJson(json, FIELD_PIN_CODE, "123456");
|
||||
AddStringToJson(json, FIELD_DEVICE_ID, SERVER_AUTH_ID);
|
||||
AddIntToJson(json, FIELD_USER_TYPE, DEVICE_TYPE_ACCESSORY);
|
||||
AddIntToJson(json, FIELD_GROUP_VISIBILITY, GROUP_VISIBILITY_PUBLIC);
|
||||
AddIntToJson(json, FIELD_EXPIRE_TIME, 90);
|
||||
char *returnDataStr = PackJsonToString(json);
|
||||
FreeJson(json);
|
||||
return returnDataStr;
|
||||
}
|
||||
|
||||
static char *OnRequestError2(int64_t requestId, int operationCode, const char *reqParams)
|
||||
{
|
||||
g_messageCode = ON_REQUEST;
|
||||
g_requestId = requestId;
|
||||
g_operationCode = operationCode;
|
||||
CJson *json = CreateJson();
|
||||
AddIntToJson(json, FIELD_CONFIRMATION, REQUEST_ACCEPTED);
|
||||
AddStringToJson(json, FIELD_DEVICE_ID, SERVER_AUTH_ID);
|
||||
AddIntToJson(json, FIELD_USER_TYPE, DEVICE_TYPE_ACCESSORY);
|
||||
AddIntToJson(json, FIELD_GROUP_VISIBILITY, GROUP_VISIBILITY_PUBLIC);
|
||||
AddIntToJson(json, FIELD_EXPIRE_TIME, 90);
|
||||
char *returnDataStr = PackJsonToString(json);
|
||||
FreeJson(json);
|
||||
return returnDataStr;
|
||||
}
|
||||
|
||||
static char *OnRequestError3(int64_t requestId, int operationCode, const char *reqParams)
|
||||
{
|
||||
g_messageCode = ON_REQUEST;
|
||||
g_requestId = requestId;
|
||||
g_operationCode = operationCode;
|
||||
CJson *json = CreateJson();
|
||||
AddIntToJson(json, FIELD_CONFIRMATION, REQUEST_ACCEPTED);
|
||||
AddStringToJson(json, FIELD_PIN_CODE, "123456");
|
||||
AddStringToJson(json, FIELD_DEVICE_ID, SERVER_AUTH_ID);
|
||||
AddIntToJson(json, FIELD_USER_TYPE, -1);
|
||||
AddIntToJson(json, FIELD_GROUP_VISIBILITY, GROUP_VISIBILITY_PUBLIC);
|
||||
AddIntToJson(json, FIELD_EXPIRE_TIME, 90);
|
||||
char *returnDataStr = PackJsonToString(json);
|
||||
FreeJson(json);
|
||||
return returnDataStr;
|
||||
}
|
||||
|
||||
static char *OnRequestError4(int64_t requestId, int operationCode, const char *reqParams)
|
||||
{
|
||||
g_messageCode = ON_REQUEST;
|
||||
g_requestId = requestId;
|
||||
g_operationCode = operationCode;
|
||||
CJson *json = CreateJson();
|
||||
AddIntToJson(json, FIELD_CONFIRMATION, REQUEST_ACCEPTED);
|
||||
AddStringToJson(json, FIELD_PIN_CODE, "123456");
|
||||
AddStringToJson(json, FIELD_DEVICE_ID, SERVER_AUTH_ID);
|
||||
AddIntToJson(json, FIELD_USER_TYPE, DEVICE_TYPE_ACCESSORY);
|
||||
AddIntToJson(json, FIELD_GROUP_VISIBILITY, GROUP_VISIBILITY_SIGNATURE);
|
||||
AddIntToJson(json, FIELD_EXPIRE_TIME, 90);
|
||||
char *returnDataStr = PackJsonToString(json);
|
||||
FreeJson(json);
|
||||
return returnDataStr;
|
||||
}
|
||||
|
||||
static char *OnRequestError5(int64_t requestId, int operationCode, const char *reqParams)
|
||||
{
|
||||
g_messageCode = ON_REQUEST;
|
||||
g_requestId = requestId;
|
||||
g_operationCode = operationCode;
|
||||
CJson *json = CreateJson();
|
||||
AddIntToJson(json, FIELD_CONFIRMATION, REQUEST_ACCEPTED);
|
||||
AddStringToJson(json, FIELD_PIN_CODE, "123456");
|
||||
AddStringToJson(json, FIELD_DEVICE_ID, SERVER_AUTH_ID);
|
||||
AddIntToJson(json, FIELD_USER_TYPE, DEVICE_TYPE_ACCESSORY);
|
||||
AddIntToJson(json, FIELD_GROUP_VISIBILITY, GROUP_VISIBILITY_PUBLIC);
|
||||
AddIntToJson(json, FIELD_EXPIRE_TIME, -2);
|
||||
char *returnDataStr = PackJsonToString(json);
|
||||
FreeJson(json);
|
||||
return returnDataStr;
|
||||
}
|
||||
|
||||
static void OnError(int64_t requestId, int operationCode, int errorCode, const char *errorReturn)
|
||||
{
|
||||
(void)errorReturn;
|
||||
|
||||
Reference in New Issue
Block a user