提交 9d5ad488 编写于 作者: O openharmony_ci 提交者: Gitee

!22 适配三方芯片

Merge pull request !22 from zhouhouxin/master
......@@ -150,7 +150,24 @@ static BOOL FEATURE_OnMessage(Feature *feature, Request *request)
int32 returnCode = 0;;
DemoFeature *demoFeature = (DemoFeature *)feature;
demoFeature->featureCalledCount++;
demoFeature->latestRequest = (char *)request->data;
if (demoFeature->latestRequest != NULL) {
free(demoFeature->latestRequest);
}
int requestLen;
if (request->len > 0) {
requestLen = request->len;
} else {
requestLen = strlen((char *)request->data) + 1;
}
demoFeature->latestRequest = (char *)malloc(requestLen * sizeof(char));
if (demoFeature->latestRequest == NULL) {
TEST_FAIL();
}
errno_t error = strcpy_s(demoFeature->latestRequest, requestLen, (char *)request->data);
if (error != EOK) {
TEST_FAIL();
}
switch (request->msgId) {
case MSG_NO:
......@@ -180,7 +197,24 @@ static BOOL FEATURE_OnMessage02(Feature *feature, Request *request)
int32 returnCode = 0;
DemoFeature *demoFeature = (DemoFeature *)feature;
demoFeature->featureCalledCount++;
demoFeature->latestRequest = (char *)request->data;
if (demoFeature->latestRequest != NULL) {
free(demoFeature->latestRequest);
}
int requestLen;
if (request->len > 0) {
requestLen = request->len;
} else {
requestLen = strlen((char *)request->data) + 1;
}
demoFeature->latestRequest = (char *)malloc(requestLen * sizeof(char));
if (demoFeature->latestRequest == NULL) {
TEST_FAIL();
}
errno_t error = strcpy_s(demoFeature->latestRequest, requestLen, (char *)request->data);
if (error != EOK) {
TEST_FAIL();
}
switch (request->msgId) {
case MSG_NO:
......@@ -210,7 +244,24 @@ static BOOL FEATURE_OnMessage03(Feature *feature, Request *request)
int32 returnCode = 0;
DemoFeature *demoFeature = (DemoFeature *)feature;
demoFeature->featureCalledCount++;
demoFeature->latestRequest = (char *)request->data;
if (demoFeature->latestRequest != NULL) {
free(demoFeature->latestRequest);
}
int requestLen;
if (request->len > 0) {
requestLen = request->len;
} else {
requestLen = strlen((char *)request->data) + 1;
}
demoFeature->latestRequest = (char *)malloc(requestLen * sizeof(char));
if (demoFeature->latestRequest == NULL) {
TEST_FAIL();
}
errno_t error = strcpy_s(demoFeature->latestRequest, requestLen, (char *)request->data);
if (error != EOK) {
TEST_FAIL();
}
switch (request->msgId) {
case MSG_NO:
......@@ -513,7 +564,7 @@ LITE_TEST_CASE(SendRequestTestSuite, testSendRequest0040, LEVEL2)
}
Request request = {.msgId = MSG_RT, .msgValue = 0};
request.len = 0;
request.data = NULL;
request.data = "I wanna async call good result!";
IUnknown *iUnknown = SAMGR_GetInstance()->GetFeatureApi("serviceName501", "featureName503");
DemoFeature *feature = GET_OBJECT(iUnknown, DemoFeature, iUnknown);
......@@ -582,7 +633,7 @@ LITE_TEST_CASE(SendRequestTestSuite, testSendRequest0060, LEVEL2)
Request request = {.msgId = MSG_NO, .msgValue = 0};
char *body = "I wanna async call good result!";
request.len = 0;
request.data = NULL;
request.data = "I wanna async call good result!";
IUnknown *iUnknown = SAMGR_GetInstance()->GetFeatureApi("serviceName501", "featureName503");
if (iUnknown == NULL) {
TEST_FAIL();
......
......@@ -158,7 +158,24 @@ static BOOL FEATURE_OnMessage02(Feature *feature, Request *request)
int32 returnCode = 0;
DemoFeature *demoFeature = (DemoFeature *)feature;
demoFeature->featureCalledCount++;
demoFeature->latestRequest = (char *)request->data;
if (demoFeature->latestRequest != NULL) {
free(demoFeature->latestRequest);
}
int requestLen;
if (request->len > 0) {
requestLen = request->len;
} else {
requestLen = strlen((char *)request->data) + 1;
}
demoFeature->latestRequest = (char *)malloc(requestLen * sizeof(char));
if (demoFeature->latestRequest == NULL) {
TEST_FAIL();
}
errno_t error = strcpy_s(demoFeature->latestRequest, requestLen, (char *)request->data);
if (error != EOK) {
TEST_FAIL();
}
switch (request->msgId) {
case MSG_NO:
......@@ -188,7 +205,24 @@ static BOOL FEATURE_OnMessage03(Feature *feature, Request *request)
int32 returnCode = 0;
DemoFeature *demoFeature = (DemoFeature *)feature;
demoFeature->featureCalledCount++;
demoFeature->latestRequest = (char *)request->data;
if (demoFeature->latestRequest != NULL) {
free(demoFeature->latestRequest);
}
int requestLen;
if (request->len > 0) {
requestLen = request->len;
} else {
requestLen = strlen((char *)request->data) + 1;
}
demoFeature->latestRequest = (char *)malloc(requestLen * sizeof(char));
if (demoFeature->latestRequest == NULL) {
TEST_FAIL();
}
errno_t error = strcpy_s(demoFeature->latestRequest, requestLen, (char *)request->data);
if (error != EOK) {
TEST_FAIL();
}
switch (request->msgId) {
case MSG_NO:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册