예제 #1
0
파일: ext_qnx_svr.c 프로젝트: kyak/qnx_ert
/* Function: ProcessCancelLoggingPkt ===========================================
 * Receive and process the EXT_CANCEL_LOGGING packet.
 */
PRIVATE boolean_T ProcessCancelLoggingPkt(const int pktSize)
{
    const char *pkt;
    int32_T    upInfoIdx;
    boolean_T  error = EXT_NO_ERROR;

    pkt = GetPkt(pktSize);
    if (pkt == NULL) {
        SendResponseStatus(EXT_CANCEL_LOGGING_RESPONSE,
                           NOT_ENOUGH_MEMORY,
                           -1);
        error = EXT_ERROR;
        goto EXIT_POINT;
    }
            
    /* Extract upInfoIdx */
    (void)memcpy(&upInfoIdx, pkt, sizeof(int32_T));
            
    PRINT_VERBOSE(
        ("got EXT_CANCEL_LOGGING packet for upInfoIdx : %d\n", upInfoIdx));

    UploadCancelLogging(upInfoIdx);

    error = SendResponseStatus(EXT_CANCEL_LOGGING_RESPONSE,
                               STATUS_OK,
                               upInfoIdx);
    if (error != EXT_NO_ERROR) goto EXIT_POINT;

  EXIT_POINT:
    return(error);
} /* end ProcessCancelLoggingPkt */
예제 #2
0
파일: ext_qnx_svr.c 프로젝트: kyak/qnx_ert
/* Function: ProcessArmTriggerPkt ==============================================
 * Receive and process the EXT_ARM_TRIGGER packet.
 */
PRIVATE boolean_T ProcessArmTriggerPkt(const int pktSize, int_T numSampTimes)
{
    const char *pkt;
    int32_T    upInfoIdx;
    boolean_T  error = EXT_NO_ERROR;

    pkt = GetPkt(pktSize);
    if (pkt == NULL) {
        SendResponseStatus(EXT_ARM_TRIGGER_RESPONSE,
                           NOT_ENOUGH_MEMORY,
                           -1);
        error = EXT_ERROR;
        goto EXIT_POINT;
    }

    /* Extract upInfoIdx */
    (void)memcpy(&upInfoIdx, pkt, sizeof(int32_T));

    PRINT_VERBOSE(
        ("got EXT_ARM_TRIGGER packet for upInfoIdx : %d\n", upInfoIdx));

    UploadArmTrigger(upInfoIdx, numSampTimes);

    error = SendResponseStatus(EXT_ARM_TRIGGER_RESPONSE,
                               STATUS_OK,
                               upInfoIdx);
    if (error != EXT_NO_ERROR) goto EXIT_POINT;

  EXIT_POINT:
    return(error);
} /* end ProcessArmTriggerPkt */
/* Function: ProcessSelectTriggerSignalPkt ===========================================
 * Receive and process the EXT_SELECT_TRIGGER or EXT_SELECT_SIGNALS packet.
 */
PRIVATE boolean_T ProcessSelectTriggerSignalPkt(const ExtModeAction ACTION_ID, 
                                                RTWExtModeInfo *ei,
                                                const int pktSize,
                                                int_T numSampTimes,
                                                char* errMsg)
{
    const char *pkt;
    int32_T    upInfoIdx;
    boolean_T  error = EXT_NO_ERROR;
     printf("Inside ProcessSelectTriggerSignalPkt \n");  //DAREN :added this here
    pkt = GetPkt(pktSize);
    if (pkt == NULL) {
        SendResponseStatus(ACTION_ID, NOT_ENOUGH_MEMORY, -1);
        return(EXT_ERROR);
    }

    (void)memcpy(&upInfoIdx, pkt, sizeof(int32_T)); /* Extract upInfoIdx */
    switch(ACTION_ID) {
    case EXT_SELECT_TRIGGER_RESPONSE:
#ifndef EXTMODE_DISABLEPRINTF  
        PRINT_VERBOSE(
                    ("got EXT_SELECT_TRIGGER packet for upInfoIdx : %d\n", upInfoIdx));
#endif
        error = UploadInitTrigger(ei, pkt+sizeof(int32_T), upInfoIdx);
        break;
    case EXT_SELECT_SIGNALS_RESPONSE:
#ifndef EXTMODE_DISABLEPRINTF  
        PRINT_VERBOSE(
                    ("got EXT_SELECT_SIGNALS packet for upInfoIdx : %d\n", upInfoIdx));
#endif
        error = UploadLogInfoInit(ei, numSampTimes, pkt+sizeof(int32_T), upInfoIdx);
        break;
    default:
        break;
    }

    if (error != EXT_NO_ERROR) {
        SendResponseStatus(ACTION_ID, NOT_ENOUGH_MEMORY, upInfoIdx);
#ifndef EXTMODE_DISABLEPRINTF            
        printf("%s\n", errMsg);
#endif
        return(error);
    }

    error = SendResponseStatus(ACTION_ID, STATUS_OK, upInfoIdx);
    return(error); /* Can be EXT_NO_ERROR */
} /* end ProcessSelectTriggerSignalPkt */
예제 #4
0
파일: ext_qnx_svr.c 프로젝트: kyak/qnx_ert
/* Function: ProcessSelectSignalsPkt ===========================================
 * Receive and process the EXT_SELECT_SIGNALS packet.
 */
PRIVATE boolean_T ProcessSelectSignalsPkt(RTWExtModeInfo *ei,
                                          int_T          numSampTimes,
                                          const int      pktSize)
{
    const char *pkt;
    int32_T    upInfoIdx;
    boolean_T  error = EXT_NO_ERROR;

    pkt = GetPkt(pktSize);
    if (pkt == NULL) {
        SendResponseStatus(EXT_SELECT_SIGNALS_RESPONSE,
                           NOT_ENOUGH_MEMORY,
                           -1);
        error = EXT_ERROR;
        goto EXIT_POINT;
    }

    /* Extract upInfoIdx */
    (void)memcpy(&upInfoIdx, pkt, sizeof(int32_T));

    PRINT_VERBOSE(
        ("got EXT_SELECT_SIGNALS packet for upInfoIdx : %d\n", upInfoIdx));

    error = UploadLogInfoInit(ei, numSampTimes, pkt+sizeof(int32_T), upInfoIdx);
    if (error != NO_ERR) {
        SendResponseStatus(EXT_SELECT_SIGNALS_RESPONSE,
                           NOT_ENOUGH_MEMORY,
                           upInfoIdx);
        printf(
            "\nError in UploadLogInfoInit(). Most likely a memory\n"
            "allocation error or an attempt to re-initialize the\n"
            "signal selection during the data logging process\n"
            "(i.e., multiple EXT_SELECT_SIGNAL packets were received\n"
            "before the logging session terminated or an\n"
            "EXT_CANCEL_LOGGING packet was received)\n");
        goto EXIT_POINT;
    }

    error = SendResponseStatus(EXT_SELECT_SIGNALS_RESPONSE,
                               STATUS_OK,
                               upInfoIdx);
    if (error != EXT_NO_ERROR) goto EXIT_POINT;

  EXIT_POINT:
    return(error);
} /* end ProcessSelectSignalsPkt */
PRIVATE boolean_T AcknowledgeSignalActionPkt(const int pktSize, const ExtModeAction ACTION_ID)
{
    const char *pkt;
    int32_T    upInfoIdx;
    boolean_T  error = EXT_NO_ERROR;
    printf("Inside AcknowledgeSignalActionPkt \n");  //DAREN :added this here
    pkt = GetPkt(pktSize);
    (void)memcpy(&upInfoIdx, pkt, sizeof(int32_T));
    error = SendResponseStatus(ACTION_ID, STATUS_OK, upInfoIdx);
    return(error);
} 
/* Function: ProcessCancelLoggingArmTriggerPkt ===========================================
 * Receive and process the EXT_CANCEL_LOGGING or EXT_ARM_TRIGGER packet.
 */
PRIVATE boolean_T ProcessCancelLoggingArmTriggerPkt(const ExtModeAction ACTION_ID, 
						const int pktSize, 
						int_T numSampTimes)
{
    const char *pkt;
    int32_T    upInfoIdx;
    boolean_T  error = EXT_NO_ERROR;
    printf("Inside ProcessCancelLoggingArmTriggerPkt \n");  //DAREN :added this here
    pkt = GetPkt(pktSize);
    if (pkt == NULL) {
        SendResponseStatus(ACTION_ID, NOT_ENOUGH_MEMORY, -1);
        return(EXT_ERROR);
    }
            
    (void)memcpy(&upInfoIdx, pkt, sizeof(int32_T)); /* Extract upInfoIdx */
        
    switch(ACTION_ID) {
    case EXT_CANCEL_LOGGING_RESPONSE:
#ifndef EXTMODE_DISABLEPRINTF   
        PRINT_VERBOSE(
                ("got EXT_CANCEL_LOGGING packet for upInfoIdx : %d\n", upInfoIdx));
#endif
        UploadCancelLogging(upInfoIdx);
        break;
    case EXT_ARM_TRIGGER_RESPONSE:
#ifndef EXTMODE_DISABLEPRINTF
        PRINT_VERBOSE(
                ("got EXT_ARM_TRIGGER packet for upInfoIdx : %d\n", upInfoIdx));
#endif
        UploadArmTrigger(upInfoIdx, numSampTimes);
        break;
    default:
        break;
    }

    error = SendResponseStatus(ACTION_ID, STATUS_OK, upInfoIdx);
    return(error); /* Can be EXT_NO_ERROR */
} /* end ProcessCancelLoggingArmTriggerPkt */