Custom IDN; correct system:version?
| | |
| | | .registers = scpi_regs, |
| | | .units = scpi_units_def, |
| | | .special_numbers = scpi_special_numbers_def, |
| | | .idn = {"MANUFACTURE", "INSTR2013", NULL, "01-02"}, |
| | | }; |
| | |
| | | /* units */ scpi_units_def, |
| | | /* special_numbers */ scpi_special_numbers_def, |
| | | /* user_context */ NULL, |
| | | /* idn */ {"MANUFACTURE", "INSTR2013", NULL, "01-02"}, |
| | | }; |
| | | |
| | |
| | | #endif |
| | | |
| | | |
| | | #define SCPI_MANUFACTURE "CTU FEE" |
| | | #define SCPI_DEV_NAME "TEST SCPI INSTRUMENT TSI3225" |
| | | #define SCPI_DEV_VERSION "v1.0" |
| | | /* 4.1.3.6 *IDN? */ |
| | | |
| | | #define SCPI_DEFAULT_1_MANUFACTURE "CTU FEE" |
| | | #define SCPI_DEFAULT_2_MODEL "TSI3225" |
| | | #define SCPI_DEFAULT_3 "0" |
| | | #define SCPI_DEFAULT_4_REVISION "01-01" |
| | | |
| | | /* 21.21 :VERSion? |
| | | * YYYY.V |
| | | * YYYY = SCPI year |
| | | * V = SCPI revision |
| | | */ |
| | | #define SCPI_STD_VERSION_REVISION "1999.0" |
| | | |
| | | #ifdef __cplusplus |
| | | } |
| | |
| | | const scpi_unit_def_t * units; |
| | | const scpi_special_number_def_t * special_numbers; |
| | | void * user_context; |
| | | const char * idn[4]; |
| | | }; |
| | | |
| | | #ifdef __cplusplus |
| | |
| | | |
| | | /** |
| | | * *IDN? |
| | | * |
| | | * field1: MANUFACTURE |
| | | * field2: MODEL |
| | | * field4: SUBSYSTEMS REVISIONS |
| | | * |
| | | * example: MANUFACTURE,MODEL,0,01-02-01 |
| | | * @param context |
| | | * @return |
| | | */ |
| | | scpi_result_t SCPI_CoreIdnQ(scpi_t * context) { |
| | | SCPI_ResultString(context, SCPI_MANUFACTURE); |
| | | SCPI_ResultString(context, SCPI_DEV_NAME); |
| | | SCPI_ResultString(context, SCPI_DEV_VERSION); |
| | | SCPI_ResultString(context, context->idn[0]); |
| | | SCPI_ResultString(context, context->idn[1]); |
| | | SCPI_ResultString(context, context->idn[2]); |
| | | SCPI_ResultString(context, context->idn[3]); |
| | | return SCPI_RES_OK; |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | scpi_result_t SCPI_SystemVersionQ(scpi_t * context) { |
| | | SCPI_ResultString(context, SCPI_DEV_VERSION); |
| | | SCPI_ResultString(context, SCPI_STD_VERSION_REVISION); |
| | | return SCPI_RES_OK; |
| | | } |
| | | |
| | |
| | | #include "scpi/parser.h" |
| | | #include "utils.h" |
| | | #include "scpi/error.h" |
| | | #include "scpi/constants.h" |
| | | |
| | | |
| | | static size_t cmdTerminatorPos(const char * cmd, size_t len); |
| | |
| | | * @param interface |
| | | */ |
| | | void SCPI_Init(scpi_t * context) { |
| | | if (context->idn[0] == NULL) { |
| | | context->idn[0] = SCPI_DEFAULT_1_MANUFACTURE; |
| | | } |
| | | if (context->idn[1] == NULL) { |
| | | context->idn[1] = SCPI_DEFAULT_2_MODEL; |
| | | } |
| | | if (context->idn[2] == NULL) { |
| | | context->idn[2] = SCPI_DEFAULT_3; |
| | | } |
| | | if (context->idn[3] == NULL) { |
| | | context->idn[3] = SCPI_DEFAULT_4_REVISION; |
| | | } |
| | | |
| | | context->buffer.position = 0; |
| | | SCPI_ErrorInit(context); |
| | | } |