ImuAdis16448::ImuAdis16448(SensorId::SensorId sensor_id, IpConnection::WeakPtr config_connection): Imu(sensor_id, SensorSettings(sensor_id, SensorType::SensorType::IMU_ADIS16448,calculateBufferSize(), ImuAdis16448Defaults::NUM_OF_MSGS_IN_PACKAGE, ImuAdis16448Defaults::USE_CONST_PACKAGE_SIZE, ImuAdis16448Defaults::CALIBRATION_SIZE), config_connection) { }
/* Callback on_foreach_iter */ bool ClusterSettings::on_foreach_iter (const Gtk::TreeModel::iterator& iter) { Gtk::TreeModel::Row row = *iter; m_Sensors.push_back (SensorSettings (row[m_Columns.m_col_tag], row[m_Columns.m_col_online], row[m_Columns.m_col_x], row[m_Columns.m_col_y], row[m_Columns.m_col_adata], row[m_Columns.m_col_type])); return false; }
/* Method load_xml */ bool ClusterSettings::load_xml (const Glib::ustring& filename) { /* Create xml document */ TiXmlDocument doc (filename.c_str ()); /* Test xml file */ if (!doc.LoadFile ()) return false; /* XML handles */ TiXmlHandle hdoc (&doc); TiXmlHandle hroot (0); /* Root element */ TiXmlElement *root = hdoc.FirstChildElement ().ToElement (); Glib::ustring check_xml; check_xml.assign (root->Value ()); if (!root && !check_xml.compare ("SensorsClusterSettings")) return false; hroot = TiXmlHandle (root); /* Cluster element */ TiXmlElement *cluster = hroot.FirstChildElement ("Cluster").ToElement (); if (!cluster) return false; /* Get cluster attribute */ set_name (cluster->Attribute ("name")); /* Sensors element */ TiXmlElement *sensorsNode = hroot.FirstChildElement ("Sensors").ToElement (); if (!sensorsNode) return false; /* Get sensors and attributes */ TiXmlElement *sensor; sensor = hroot.FirstChildElement ("Sensors").FirstChild ("Sensor").ToElement (); if (!sensor) return false; for (sensor; sensor; sensor = sensor->NextSiblingElement ()) { std::string sensor_tag, sensor_type; int sensor_online, sensor_adata; double sensor_x_coord, sensor_y_coord; SensorSettings sensor_settings; sensor_tag.assign (sensor->Attribute ("tag")); if (sensor_tag.empty ()) return false; if (sensor->QueryIntAttribute ("online", &sensor_online) != TIXML_SUCCESS) return false; if (sensor->QueryDoubleAttribute ("x", &sensor_x_coord) != TIXML_SUCCESS) return false; if (sensor->QueryDoubleAttribute ("y", &sensor_y_coord) != TIXML_SUCCESS) return false; if (sensor->QueryIntAttribute ("adata", &sensor_adata) != TIXML_SUCCESS) return false; sensor_type.assign (sensor->Attribute ("type")); if (sensor_type.empty ()) return false; m_Sensors.push_back (SensorSettings (sensor_tag, sensor_online, sensor_x_coord, sensor_y_coord, sensor_adata, sensor_type)); } return true; }