Merge branch 'master' of https://github.com/j123b567/scpi-parser
| | |
| | | return SCPI_RES_OK; |
| | | } |
| | | |
| | | /** |
| | | * Return 0 as OK and other number as error |
| | | */ |
| | | scpi_result_t SCPI_Test(scpi_t * context) { |
| | | (void) context; |
| | | iprintf("**Test\r\n"); |
| | | return 0; |
| | | return SCPI_RES_OK; |
| | | } |
| | | |
| | | scpi_result_t SCPI_Reset(scpi_t * context) { |
| | |
| | | return SCPI_RES_OK; |
| | | } |
| | | |
| | | /** |
| | | * Return 0 as OK and other number as error |
| | | */ |
| | | scpi_result_t SCPI_Test(scpi_t * context) { |
| | | fprintf(stderr, "**Test\r\n"); |
| | | return 0; |
| | | return SCPI_RES_OK; |
| | | } |
| | | |
| | | scpi_result_t SCPI_Reset(scpi_t * context) { |
| | |
| | | return SCPI_RES_OK; |
| | | } |
| | | |
| | | /** |
| | | * Return 0 as OK and other number as error |
| | | */ |
| | | scpi_result_t SCPI_Test(scpi_t * context) { |
| | | fprintf(stderr, "**Test\r\n"); |
| | | return 0; |
| | | return SCPI_RES_OK; |
| | | } |
| | | |
| | | scpi_result_t SCPI_Reset(scpi_t * context) { |
| | |
| | | return SCPI_RES_OK; |
| | | } |
| | | |
| | | /** |
| | | * Return 0 as OK and other number as error |
| | | */ |
| | | scpi_result_t SCPI_Test(scpi_t * context) { |
| | | fprintf(stderr, "**Test\r\n"); |
| | | return 0; |
| | | return SCPI_RES_OK; |
| | | } |
| | | |
| | | scpi_result_t SCPI_Reset(scpi_t * context) { |
| | |
| | | return SCPI_RES_OK; |
| | | } |
| | | |
| | | /** |
| | | * Return 0 as OK and other number as error |
| | | */ |
| | | scpi_result_t SCPI_Test(scpi_t * context) { |
| | | fprintf(stderr, "**Test\r\n"); |
| | | return 0; |
| | | return SCPI_RES_OK; |
| | | } |
| | | |
| | | scpi_result_t SCPI_Reset(scpi_t * context) { |
| | |
| | | * @return |
| | | */ |
| | | scpi_result_t SCPI_CoreIdnQ(scpi_t * context) { |
| | | SCPI_ResultString(context, context->idn[0]); |
| | | SCPI_ResultString(context, context->idn[1]); |
| | | SCPI_ResultString(context, context->idn[2]); |
| | | SCPI_ResultString(context, context->idn[3]); |
| | | int i; |
| | | for (i = 0; i<4; i++) { |
| | | if (context->idn[i]) { |
| | | SCPI_ResultString(context, context->idn[i]); |
| | | } else { |
| | | SCPI_ResultString(context, "0"); |
| | | } |
| | | } |
| | | return SCPI_RES_OK; |
| | | } |
| | | |
| | |
| | | scpi_result_t SCPI_CoreTstQ(scpi_t * context) { |
| | | int result = 0; |
| | | if (context && context->interface && context->interface->test) { |
| | | result = context->interface->test(context); |
| | | result = context->interface->test(context) == SCPI_RES_OK ? 0 : 1; |
| | | } |
| | | SCPI_ResultInt(context, result); |
| | | return SCPI_RES_OK; |
| | |
| | | { .pattern = "*WAI", .callback = SCPI_CoreWai,}, |
| | | |
| | | /* Required SCPI commands (SCPI std V1999.0 4.2.1) */ |
| | | {.pattern = "SYSTem:ERRor[:NEXT]?", .callback = SCPI_SystemErrorNextQ,}, |
| | | {.pattern = "SYSTem:ERRor:COUNt?", .callback = SCPI_SystemErrorCountQ,}, |
| | | {.pattern = "SYSTem:VERSion?", .callback = SCPI_SystemVersionQ,}, |
| | | { .pattern = "SYSTem:ERRor[:NEXT]?", .callback = SCPI_SystemErrorNextQ,}, |
| | | { .pattern = "SYSTem:ERRor:COUNt?", .callback = SCPI_SystemErrorCountQ,}, |
| | | { .pattern = "SYSTem:VERSion?", .callback = SCPI_SystemVersionQ,}, |
| | | |
| | | {.pattern = "STATus:QUEStionable[:EVENt]?", .callback = SCPI_StatusQuestionableEventQ,}, |
| | | {.pattern = "STATus:QUEStionable:ENABle", .callback = SCPI_StatusQuestionableEnable,}, |
| | | {.pattern = "STATus:QUEStionable:ENABle?", .callback = SCPI_StatusQuestionableEnableQ,}, |
| | | { .pattern = "STATus:QUEStionable[:EVENt]?", .callback = SCPI_StatusQuestionableEventQ,}, |
| | | { .pattern = "STATus:QUEStionable:ENABle", .callback = SCPI_StatusQuestionableEnable,}, |
| | | { .pattern = "STATus:QUEStionable:ENABle?", .callback = SCPI_StatusQuestionableEnableQ,}, |
| | | |
| | | {.pattern = "STATus:PRESet", .callback = SCPI_StatusPreset,}, |
| | | { .pattern = "STATus:PRESet", .callback = SCPI_StatusPreset,}, |
| | | |
| | | SCPI_CMD_LIST_END |
| | | }; |
| | |
| | | CU_ASSERT_STRING_EQUAL(output, output_buffer); \ |
| | | } |
| | | output_buffer_clear(); |
| | | error_buffer_clear(); |
| | | |
| | | /* Test single command */ |
| | | TEST_INPUT("*IDN?\r\n", "MA, IN, 0, VER\r\n"); |
| | |
| | | CU_ASSERT_EQUAL(RST_executed, TRUE); |
| | | |
| | | TST_executed = FALSE; |
| | | TEST_IEEE4882("*TST?\r\n", "1\r\n"); |
| | | TEST_IEEE4882("*TST?\r\n", "0\r\n"); |
| | | CU_ASSERT_EQUAL(TST_executed, TRUE); |
| | | |
| | | TEST_IEEE4882("*WAI\r\n", ""); |
| | |
| | | CU_cleanup_registry(); |
| | | return CU_get_error(); |
| | | } |
| | | |