Example #1
0
int main(int argc, const char **argv)
{
    PortalSocketParam paramSocket = {};
    PortalMuxParam param = {};

    Portal *mcommon = new Portal(0, sizeof(uint32_t), NULL, NULL, &socketfuncInit, &paramSocket, 0);
    param.pint = &mcommon->pint;
    EchoIndication *sIndication = new EchoIndication(IfcNames_EchoIndication, &muxfunc, &param);
    sEcho = new EchoRequestSWProxy(IfcNames_EchoRequest, &muxfunc, &param);
    SecondIndication *sSecondIndication = new SecondIndication(IfcNames_SecondIndication, &muxfunc, &param);
    sSecond = new SecondRequestProxy(IfcNames_SecondRequest, &muxfunc, &param);
    ThirdIndication *sThirdIndication = new ThirdIndication(IfcNames_ThirdIndication, &muxfunc, &param);
    sThird = new ThirdRequestProxy(IfcNames_ThirdRequest, &muxfunc, &param);

    portalExec_start();

    int v = 42;
    fprintf(stderr, "Saying %d\n", v);
    call_say(v);
sSecond->say(v*99, v * 1000000000L, v*55);
    call_say(v*5);
sThird->say();
    call_say(v*17);
    call_say(v*93);
    call_say2(v, v*3);
    printf("TEST TYPE: SEM\n");
    sEcho->setLeds(9);
    portalExec_end();
    return 0;
}
Example #2
0
int main(int argc, const char **argv)
{
    PortalSocketParam param = {0};
//#define USE_UNIX_SOCKET
#ifdef USE_UNIX_SOCKET
#define PARAM NULL
#else
#define PARAM &param
#endif

    int rc = getaddrinfo("127.0.0.1", "5000", NULL, &param.addr);
    EchoIndication *sIndication = new EchoIndication(IfcNames_EchoIndicationH2S, &transportSocketInit, PARAM);
    rc = getaddrinfo("127.0.0.1", "5001", NULL, &param.addr);
    sRequestProxy = new EchoRequestProxy(IfcNames_EchoRequestS2H, &transportSocketInit, PARAM, &EchoRequestJsonProxyReq, 1000);

    int v = 42;
    fprintf(stderr, "Saying %d\n", v);
    call_say(v);
    call_say(v*5);
    call_say(v*17);
    call_say(v*93);
    call_say2(v, v*3);
    printf("TEST TYPE: SEM\n");
    sRequestProxy->setLeds(9);
    return 0;
}
Example #3
0
int main(int argc, const char **argv)
{
    int alloc_sz = 64-4;
//1000;

    MMURequestProxy *dmap = new MMURequestProxy(IfcNames_MMURequest, &socketfuncInit, NULL);
    DmaManager *dma = new DmaManager(dmap);
    MMUIndication *mIndication = new MMUIndication(dma, IfcNames_MMUIndication, &socketfuncInit, NULL);

    portalExec_start();

    PortalSharedParam param = {dma, alloc_sz};
    EchoIndication *sIndication = new EchoIndication(IfcNames_EchoIndication, &sharedfunc, &param);
    sRequestProxy = new EchoRequestProxy(IfcNames_EchoRequest, &sharedfunc, &param);

for (int i = 0; i < 10; i++) {
    int v = 42;
    fprintf(stderr, "Saying %d\n", v);
    call_say(v);
    call_say(v*5);
    call_say(v*17);
    call_say(v*93);
    call_say2(v, v*3);
}
    sRequestProxy->setLeds(9);

    while (1) {
      sleep(1);
    }
    return 0;
}
Example #4
0
int main(int argc, const char **argv)
{
    poller = new PortalPoller();
    EchoIndication *echoIndication = new EchoIndication(IfcNames_EchoIndication, poller);
    DisplayInd *dispIndication = new DisplayInd(IfcNames_DisplayInd, poller);
    // these use the default poller
    SwallowProxy *swallowProxy = new SwallowProxy(IfcNames_Swallow);
    echoRequestProxy = new EchoRequestProxy(IfcNames_EchoRequest);

    poller->portalExec_init();
    init_thread();
    portalExec_start();

#if 0
    printf("Timer tests\n");
    portalTimerInit();
    for (int i = 0; i < 1000; i++) {
      portalTimerStart(0);
      portalTimerCatch(1);
      portalTimerCatch(2);
      portalTimerCatch(3);
      portalTimerCatch(4);
      portalTimerCatch(5);
      portalTimerCatch(6);
      portalTimerCatch(7);
      portalTimerCatch(8);
    }
    portalTimerPrint(1000);
#endif

    int v = 42;
    fprintf(stderr, "Saying %d\n", v);
    call_say(v);
    call_say(v*5);
    call_say(v*17);
    call_say(v*93);
    printf("[%s:%d] run %d loops\n\n", __FUNCTION__, __LINE__, LOOP_COUNT);
    portalTimerInit();
    portalTimerStart(1);
    for (int i = 0; i < LOOP_COUNT; i++)
        call_say2(v, v*3);
uint64_t elapsed = portalTimerLap(1);
    printf("TEST TYPE: "
#ifndef SEPARATE_EVENT_THREAD
       "INLINE"
#elif defined(USE_MUTEX_SYNC)
       "MUTEX"
#else
       "SEM"
#endif
       "\n");
    portalTimerPrint(LOOP_COUNT);
    printf("call_say: elapsed %g average %g\n", (double) elapsed, (double) elapsed/ (double) LOOP_COUNT);
    echoRequestProxy->setLeds(9);
    poller->portalExec_end();
    portalExec_end();
    return 0;
}