提交 8c189c49 编写于 作者: Z zhouhouxin 提交者: Gitee

适配三方芯片

上级 50a5d7ec
...@@ -150,7 +150,24 @@ static BOOL FEATURE_OnMessage(Feature *feature, Request *request) ...@@ -150,7 +150,24 @@ static BOOL FEATURE_OnMessage(Feature *feature, Request *request)
int32 returnCode = 0;; int32 returnCode = 0;;
DemoFeature *demoFeature = (DemoFeature *)feature; DemoFeature *demoFeature = (DemoFeature *)feature;
demoFeature->featureCalledCount++; 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) { switch (request->msgId) {
case MSG_NO: case MSG_NO:
...@@ -180,7 +197,24 @@ static BOOL FEATURE_OnMessage02(Feature *feature, Request *request) ...@@ -180,7 +197,24 @@ static BOOL FEATURE_OnMessage02(Feature *feature, Request *request)
int32 returnCode = 0; int32 returnCode = 0;
DemoFeature *demoFeature = (DemoFeature *)feature; DemoFeature *demoFeature = (DemoFeature *)feature;
demoFeature->featureCalledCount++; 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) { switch (request->msgId) {
case MSG_NO: case MSG_NO:
...@@ -210,7 +244,24 @@ static BOOL FEATURE_OnMessage03(Feature *feature, Request *request) ...@@ -210,7 +244,24 @@ static BOOL FEATURE_OnMessage03(Feature *feature, Request *request)
int32 returnCode = 0; int32 returnCode = 0;
DemoFeature *demoFeature = (DemoFeature *)feature; DemoFeature *demoFeature = (DemoFeature *)feature;
demoFeature->featureCalledCount++; 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) { switch (request->msgId) {
case MSG_NO: case MSG_NO:
...@@ -513,7 +564,7 @@ LITE_TEST_CASE(SendRequestTestSuite, testSendRequest0040, LEVEL2) ...@@ -513,7 +564,7 @@ LITE_TEST_CASE(SendRequestTestSuite, testSendRequest0040, LEVEL2)
} }
Request request = {.msgId = MSG_RT, .msgValue = 0}; Request request = {.msgId = MSG_RT, .msgValue = 0};
request.len = 0; request.len = 0;
request.data = NULL; request.data = "I wanna async call good result!";
IUnknown *iUnknown = SAMGR_GetInstance()->GetFeatureApi("serviceName501", "featureName503"); IUnknown *iUnknown = SAMGR_GetInstance()->GetFeatureApi("serviceName501", "featureName503");
DemoFeature *feature = GET_OBJECT(iUnknown, DemoFeature, iUnknown); DemoFeature *feature = GET_OBJECT(iUnknown, DemoFeature, iUnknown);
...@@ -582,7 +633,7 @@ LITE_TEST_CASE(SendRequestTestSuite, testSendRequest0060, LEVEL2) ...@@ -582,7 +633,7 @@ LITE_TEST_CASE(SendRequestTestSuite, testSendRequest0060, LEVEL2)
Request request = {.msgId = MSG_NO, .msgValue = 0}; Request request = {.msgId = MSG_NO, .msgValue = 0};
char *body = "I wanna async call good result!"; char *body = "I wanna async call good result!";
request.len = 0; request.len = 0;
request.data = NULL; request.data = "I wanna async call good result!";
IUnknown *iUnknown = SAMGR_GetInstance()->GetFeatureApi("serviceName501", "featureName503"); IUnknown *iUnknown = SAMGR_GetInstance()->GetFeatureApi("serviceName501", "featureName503");
if (iUnknown == NULL) { if (iUnknown == NULL) {
TEST_FAIL(); TEST_FAIL();
......
...@@ -158,7 +158,24 @@ static BOOL FEATURE_OnMessage02(Feature *feature, Request *request) ...@@ -158,7 +158,24 @@ static BOOL FEATURE_OnMessage02(Feature *feature, Request *request)
int32 returnCode = 0; int32 returnCode = 0;
DemoFeature *demoFeature = (DemoFeature *)feature; DemoFeature *demoFeature = (DemoFeature *)feature;
demoFeature->featureCalledCount++; 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) { switch (request->msgId) {
case MSG_NO: case MSG_NO:
...@@ -188,7 +205,24 @@ static BOOL FEATURE_OnMessage03(Feature *feature, Request *request) ...@@ -188,7 +205,24 @@ static BOOL FEATURE_OnMessage03(Feature *feature, Request *request)
int32 returnCode = 0; int32 returnCode = 0;
DemoFeature *demoFeature = (DemoFeature *)feature; DemoFeature *demoFeature = (DemoFeature *)feature;
demoFeature->featureCalledCount++; 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) { switch (request->msgId) {
case MSG_NO: case MSG_NO:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册