#include #include #include #include "DeviceView.h" #include "../field/CharString.h" #include "../field/BigCharString.h" #include "../field/UnsignedInt.h" #include "../field/SegSupported.h" #include "../field/ObjSupported.h" #include "../field/enum.properties.h" DeviceView::DeviceView(QWidget *parent, QSqlDatabase *dbh, int id, QString name, int type, int num) : ObjectView(parent, dbh, id, name, type, num) { leftFields = new QGridLayout(NULL); rightFields = new QGridLayout(NULL); // Assign default values fields[OBJECT_NAME] = new CharString(parent, id, OBJECT_NAME, "DEV_1000", tr("Device Name:"), leftFields, 0); fields[MODEL_NAME] = new CharString(parent, id, MODEL_NAME, "New Device", tr("Model Name:"), leftFields, 1); fields[VENDOR_NAME] = new CharString(parent, id, VENDOR_NAME, "", tr("Vendor Name:"), leftFields, 2); fields[VENDOR_ID] = new UnsignedInt(parent, id, VENDOR_ID, 0, tr("Vendor ID:"), leftFields, 3); fields[FIRMWARE_REV] = new CharString(parent, id, FIRMWARE_REV, "000", tr("Firmware:"), leftFields, 4); fields[SOFTWARE_VER] = new CharString(parent, id, SOFTWARE_VER, "000", tr("Software:"), leftFields, 5); fields[LOCATION] = new CharString(parent, id, LOCATION, "Canada", tr("Location:"), leftFields, 6); fields[BAC_ADDRESS] = new UnsignedInt(parent, id, 0, 777, tr("Address:"), rightFields, 0); fields[APDU_LENGTH] = new UnsignedInt(parent, id, APDU_LENGTH, 1024, tr("Max. APDU Length:"), rightFields, 1); fields[APDU_TIMEOUT] = new UnsignedInt(parent, id, APDU_TIMEOUT, 3000, tr("APDU Timeout:"), rightFields, 2); fields[APDU_RETRIES] = new UnsignedInt(parent, id, APDU_RETRIES, 3, tr("APDU Retries:"), rightFields, 3); fields[SEGMENTATION_SUPPORTED] = new SegSupported(parent, id, SEGMENTATION_SUPPORTED, tr("Segmentation:"), rightFields, 4); fields[MAX_SEGMENTS_ACCEPTED] = new UnsignedInt(parent, id, MAX_SEGMENTS_ACCEPTED, 1024, tr("Max. Segments:"), rightFields, 5); fields[APDU_SEGMENT_TIMEOUT] = new UnsignedInt(parent, id, APDU_SEGMENT_TIMEOUT, 5000, tr("Segment Timeout:"), rightFields, 6); fields[DATABASE_REV] = new UnsignedInt(parent, id, DATABASE_REV, 5000, tr("Database Rev.:"), rightFields, 7); fields[PROTOCOL_OBJECT_TYPES_SUPPORTED] = new ObjSupported(parent, id, PROTOCOL_OBJECT_TYPES_SUPPORTED, 0x100, tr("Objects Supported")); fields[DESCRIPTION] = new BigCharString(parent, id, DESCRIPTION, "", tr("Description")); // Protocol version/revision domain of Magic DAC. Ditto for ServicesSupported. // Terminal services not supported, nor is MS/TP and associated fields // Time/date to be taken from system // TimeSync, BBMD, COV target Future DBLoad(); Draw(); } void DeviceView::Draw() { // Add blank space to fix alignment with rightLayout leftFields->addWidget(new QLabel(""), 7, 0); // Place everything mainLayout = new QGridLayout(this); mainLayout->addLayout(leftFields, 0, 0); mainLayout->addLayout(rightFields, 0, 1); mainLayout->addWidget(fields[PROTOCOL_OBJECT_TYPES_SUPPORTED]->Input(), 1, 0, 1, 2); mainLayout->addWidget(fields[DESCRIPTION]->Label(), 2, 0); mainLayout->addWidget(fields[DESCRIPTION]->Input(), 3, 0, 1, 2); }