MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / testGenericCallback

Function testGenericCallback

test/test_unions/test_unions_server_impl.cpp:29–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27////////////////////////////////////////////////////////////////////////////////
28
29gapGenericEvent_t *testGenericCallback(const gapGenericEvent_t *event)
30{
31 gapGenericEvent_t *newEvent = (gapGenericEvent_t *)erpc_malloc(sizeof(gapGenericEvent_t));
32 switch (event->eventType)
33 {
34 case gInternalError_c:
35 {
36 if (event->eventData.internalError.errorCode == gBleSuccess_c &&
37 event->eventData.internalError.errorSource == gHciCommandStatus_c &&
38 event->eventData.internalError.hciCommandOpcode == 5)
39 {
40 newEvent->eventType = gWhiteListSizeReady_c;
41 }
42 else
43 {
44 newEvent->eventType = gAdvertisingSetupFailed_c;
45 }
46 break;
47 }
48 case gRandomAddressReady_c:
49 {
50 int x = 0xAA;
51 int success = 1;
52 int i = 0;
53 while (success && i < 6)
54 {
55 if (event->eventData.aAddress[i] != (x ^ 0xFF))
56 {
57 success = false;
58 }
59 ++i;
60 }
61 newEvent->eventType = gTestCaseReturn_c;
62 if (success)
63 {
64 newEvent->eventData.returnCode = 1;
65 }
66 else
67 {
68 newEvent->eventData.returnCode = 0;
69 }
70 break;
71 }
72 case gWhiteListSizeReady_c:
73 {
74 newEvent->eventType = gTestCaseReturn_c;
75 if (100 == event->eventData.whiteListSize)
76 {
77 newEvent->eventData.returnCode = 100;
78 }
79 else
80 {
81 newEvent->eventData.returnCode = 0;
82 }
83 break;
84 }
85 case gPublicAddressRead_c:
86 case gAdvertisingSetupFailed_c:

Callers 2

testGenericCallbackMethod · 0.85
TESTFunction · 0.85

Calls 1

erpc_mallocFunction · 0.50

Tested by

no test coverage detected