|
| 1 | +#ifndef _OBJECT_RADSTAR2_SETTINGS_H_ |
| 2 | +#define _OBJECT_RADSTAR2_SETTINGS_H_ |
| 3 | + |
| 4 | +#include <Python.h> |
| 5 | +#include <structmember.h> |
| 6 | +#if (defined(_WIN32) || defined(__WIN32__)) |
| 7 | + #ifndef USING_STUDIO_8 |
| 8 | + #define USING_STUDIO_8 1 |
| 9 | + #endif |
| 10 | + #include <icsnVC40.h> |
| 11 | +#else |
| 12 | + #include <icsnVC40.h> |
| 13 | +#endif |
| 14 | + |
| 15 | +#include "defines.h" |
| 16 | +#include "object_can_settings.h" |
| 17 | +#include "object_lin_settings.h" |
| 18 | +#include "object_swcan_settings.h" |
| 19 | +#include "object_textapi_settings.h" |
| 20 | +#include "object_uart_settings.h" |
| 21 | +#include "object_iso9141_keyword2000_settings.h" |
| 22 | +#include "object_canfd_settings.h" |
| 23 | +#include "object_op_eth_general_settings.h" |
| 24 | +#include "object_op_eth_settings.h" |
| 25 | +#include "object_timesync_settings.h" |
| 26 | + |
| 27 | +#define RADSTAR2_SETTINGS_OBJECT_NAME "RadStar2Settings" |
| 28 | + |
| 29 | +typedef struct { |
| 30 | + PyObject_HEAD |
| 31 | + PyObject* opEthGen; |
| 32 | + PyObject* opEth1; |
| 33 | + PyObject* opEth2; |
| 34 | + PyObject* can1; |
| 35 | + PyObject* can2; |
| 36 | + PyObject* canfd1; |
| 37 | + PyObject* canfd2; |
| 38 | + PyObject* lin1; |
| 39 | + PyObject* iso9141_kw1; |
| 40 | + |
| 41 | + PyObject* textapi; |
| 42 | + PyObject* timesync; |
| 43 | + |
| 44 | + SRADStar2Settings s; |
| 45 | +} rad_star2_settings_object; |
| 46 | + |
| 47 | +static PyMemberDef rad_star2_settings_object_members[] = { |
| 48 | + { "perf_en", T_USHORT, offsetof(rad_star2_settings_object, s.perf_en), 0, "" }, |
| 49 | + |
| 50 | + { "opEthGen", T_OBJECT_EX, offsetof(rad_star2_settings_object, opEthGen), 0, MODULE_NAME "." OP_ETH_GENERAL_SETTINGS_OBJECT_NAME" Object" }, |
| 51 | + { "opEth1", T_OBJECT_EX, offsetof(rad_star2_settings_object, opEth1), 0, MODULE_NAME "." OP_ETH_SETTINGS_OBJECT_NAME" Object" }, |
| 52 | + { "opEth2", T_OBJECT_EX, offsetof(rad_star2_settings_object, opEth2), 0, MODULE_NAME "." OP_ETH_SETTINGS_OBJECT_NAME" Object" }, |
| 53 | + |
| 54 | + { "can1", T_OBJECT_EX, offsetof(rad_star2_settings_object, can1), 0, MODULE_NAME "." CAN_SETTINGS_OBJECT_NAME" Object" }, |
| 55 | + { "can2", T_OBJECT_EX, offsetof(rad_star2_settings_object, can2), 0, MODULE_NAME "." CAN_SETTINGS_OBJECT_NAME" Object" }, |
| 56 | + |
| 57 | + { "canfd1", T_OBJECT_EX, offsetof(rad_star2_settings_object, canfd1), 0, MODULE_NAME "." CANFD_SETTINGS_OBJECT_NAME" Object" }, |
| 58 | + { "canfd2", T_OBJECT_EX, offsetof(rad_star2_settings_object, canfd2), 0, MODULE_NAME "." CANFD_SETTINGS_OBJECT_NAME" Object" }, |
| 59 | + |
| 60 | + { "lin1", T_OBJECT_EX, offsetof(rad_star2_settings_object, lin1), 0, MODULE_NAME "." LIN_SETTINGS_OBJECT_NAME" Object" }, |
| 61 | + |
| 62 | + { "network_enables", T_USHORT, offsetof(rad_star2_settings_object, s.network_enables), 0, "" }, |
| 63 | + { "network_enables_2", T_USHORT, offsetof(rad_star2_settings_object, s.network_enables_2), 0, "" }, |
| 64 | + |
| 65 | + { "misc_io_initial_ddr", T_USHORT, offsetof(rad_star2_settings_object, s.misc_io_initial_ddr), 0, "" }, |
| 66 | + { "misc_io_initial_latch", T_USHORT, offsetof(rad_star2_settings_object, s.misc_io_initial_latch), 0, "" }, |
| 67 | + { "misc_io_report_period", T_USHORT, offsetof(rad_star2_settings_object, s.misc_io_report_period), 0, "" }, |
| 68 | + { "misc_io_on_report_events", T_USHORT, offsetof(rad_star2_settings_object, s.misc_io_on_report_events), 0, "" }, |
| 69 | + { "misc_io_analog_enable", T_USHORT, offsetof(rad_star2_settings_object, s.misc_io_analog_enable), 0, "" }, |
| 70 | + { "ain_sample_period", T_USHORT, offsetof(rad_star2_settings_object, s.ain_sample_period), 0, "" }, |
| 71 | + { "ain_threshold", T_USHORT, offsetof(rad_star2_settings_object, s.ain_threshold), 0, "" }, |
| 72 | + |
| 73 | + { "pwr_man_enable", T_USHORT, offsetof(rad_star2_settings_object, s.pwr_man_enable), 0, "" }, |
| 74 | + { "pwr_man_timeout", T_UINT, offsetof(rad_star2_settings_object, s.pwr_man_timeout), 0, "" }, |
| 75 | + |
| 76 | + { "network_enabled_on_boot", T_USHORT, offsetof(rad_star2_settings_object, s.network_enabled_on_boot), 0, "" }, |
| 77 | + |
| 78 | + { "iso15765_separation_time_offset", T_USHORT, offsetof(rad_star2_settings_object, s.iso15765_separation_time_offset), 0, "" }, |
| 79 | + |
| 80 | + { "iso_9141_kwp_enable_reserved", T_USHORT, offsetof(rad_star2_settings_object, s.iso_9141_kwp_enable_reserved), 0, "" }, |
| 81 | + { "iso9141_kwp_settings_1", T_OBJECT_EX, offsetof(rad_star2_settings_object, iso9141_kw1), 0, ISO9141KEYWORD2000_SETTINGS_OBJECT_NAME" Object" }, |
| 82 | + { "iso_parity_1", T_USHORT, offsetof(rad_star2_settings_object, s.iso_parity_1), 0, "0 - no parity, 1 - event, 2 - odd" }, |
| 83 | + |
| 84 | + { "iso_msg_termination_1", T_USHORT, offsetof(rad_star2_settings_object, s.iso_msg_termination_1), 0, "0 - use inner frame time, 1 - GME CIM-SCL" }, |
| 85 | + |
| 86 | + { "idle_wakeup_network_enables_1", T_USHORT, offsetof(rad_star2_settings_object, s.idle_wakeup_network_enables_1), 0, "" }, |
| 87 | + { "idle_wakeup_network_enables_2", T_USHORT, offsetof(rad_star2_settings_object, s.idle_wakeup_network_enables_2), 0, "" }, |
| 88 | + |
| 89 | + { "network_enables_3", T_USHORT, offsetof(rad_star2_settings_object, s.network_enables_3), 0, "" }, |
| 90 | + { "idle_wakeup_network_enables_3", T_USHORT, offsetof(rad_star2_settings_object, s.idle_wakeup_network_enables_3), 0, "" }, |
| 91 | + |
| 92 | + { "can_switch_mode", T_USHORT, offsetof(rad_star2_settings_object, s.can_switch_mode), 0, "" }, |
| 93 | + { "text_api", T_OBJECT_EX, offsetof(rad_star2_settings_object, textapi), 0, MODULE_NAME "." TEXTAPI_SETTINGS_OBJECT_NAME" Object" }, |
| 94 | + { "pc_com_mode", T_USHORT, offsetof(rad_star2_settings_object, s.pc_com_mode), 0, "" }, |
| 95 | + { "timeSyncSettings", T_OBJECT_EX, offsetof(rad_star2_settings_object, timesync), 0, MODULE_NAME "." TIMESYNC_SETTINGS_OBJECT_NAME" Object" }, |
| 96 | + { "hwComLatencyTestEn", T_USHORT, offsetof(rad_star2_settings_object, s.hwComLatencyTestEn), 0, "" }, |
| 97 | + |
| 98 | + { NULL, 0, 0, 0, 0 }, |
| 99 | +}; |
| 100 | + |
| 101 | +static int rad_star2_settings_object_init(rad_star2_settings_object* self, PyObject* args, PyObject* kwds) |
| 102 | +{ |
| 103 | + // Initialize all struct values to 0 |
| 104 | + memset(&(self->s), 0, sizeof(self->s)); |
| 105 | + // Initialize Ethernet Objects |
| 106 | + self->opEthGen = PyObject_CallObject((PyObject*)&op_eth_general_settings_object_type, NULL); |
| 107 | + self->opEth1 = PyObject_CallObject((PyObject*)&op_eth_settings_object_type, NULL); |
| 108 | + self->opEth2 = PyObject_CallObject((PyObject*)&op_eth_settings_object_type, NULL); |
| 109 | + // Initialize Can Objects |
| 110 | + self->can1 = PyObject_CallObject((PyObject*)&can_settings_object_type, NULL); |
| 111 | + self->can2 = PyObject_CallObject((PyObject*)&can_settings_object_type, NULL); |
| 112 | + self->canfd1 = PyObject_CallObject((PyObject*)&canfd_settings_object_type, NULL); |
| 113 | + self->canfd2 = PyObject_CallObject((PyObject*)&canfd_settings_object_type, NULL); |
| 114 | + // Initialize LIN Objects |
| 115 | + self->lin1 = PyObject_CallObject((PyObject*)&lin_settings_object_type, NULL); |
| 116 | + // Initialize ISO9141Keyword2000 Objects |
| 117 | + self->iso9141_kw1 = PyObject_CallObject((PyObject*)&iso9141keyword2000_settings_object_type, NULL); |
| 118 | + // Initialize TextAPI Objects |
| 119 | + self->textapi = PyObject_CallObject((PyObject*)&textapi_settings_object_type, NULL); |
| 120 | + // Initialize TIMESYNC Objects |
| 121 | + self->timesync = PyObject_CallObject((PyObject*)×ync_settings_object_type, NULL); |
| 122 | + return 0; |
| 123 | +} |
| 124 | + |
| 125 | +extern PyTypeObject rad_star2_settings_object_type; |
| 126 | + |
| 127 | +// Copied from tupleobject.h |
| 128 | +#define PyRADStar2Settings_Check(op) \ |
| 129 | + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BASETYPE) |
| 130 | +#define PyRADStar2Settings_CheckExact(op) (Py_TYPE(op) == &rad_star2_settings_object_type) |
| 131 | + |
| 132 | +bool setup_rad_star2_settings_object(PyObject* module); |
| 133 | + |
| 134 | +void rad_star2_settings_object_update_from_struct(PyObject* settings); |
| 135 | +void rad_star2_settings_object_update_from_objects(PyObject* settings); |
| 136 | + |
| 137 | +#endif // _OBJECT_RADSTAR2_SETTINGS_H_ |
0 commit comments