|
Lines 1137-1143
TQString tdeIBTransportToNMIBTransport(TDENetworkInfinibandTransportMode::TDENet
Link Here
|
| 1137 |
return ret; |
1137 |
return ret; |
| 1138 |
} |
1138 |
} |
| 1139 |
|
1139 |
|
| 1140 |
TQString TDENetworkConnectionManager_BackendNM::deviceInterfaceString(TQString macAddress) { |
1140 |
TQString TDENetworkConnectionManager_BackendNM::deviceInterfaceString(TQString deviceNode) { |
| 1141 |
if (d->m_networkManagerProxy) { |
1141 |
if (d->m_networkManagerProxy) { |
| 1142 |
TQT_DBusObjectPathList devices; |
1142 |
TQT_DBusObjectPathList devices; |
| 1143 |
TQT_DBusError error; |
1143 |
TQT_DBusError error; |
|
Lines 1148-1221
TQString TDENetworkConnectionManager_BackendNM::deviceInterfaceString(TQString m
Link Here
|
| 1148 |
for (it = devices.begin(); it != devices.end(); ++it) { |
1148 |
for (it = devices.begin(); it != devices.end(); ++it) { |
| 1149 |
DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, (*it)); |
1149 |
DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, (*it)); |
| 1150 |
genericDevice.setConnection(TQT_DBusConnection::systemBus()); |
1150 |
genericDevice.setConnection(TQT_DBusConnection::systemBus()); |
| 1151 |
TDENetworkDeviceType::TDENetworkDeviceType deviceType = nmDeviceTypeToTDEDeviceType(genericDevice.getDeviceType(error)); |
1151 |
TQString deviceInterface = genericDevice.getInterface(error); |
| 1152 |
if (error.isValid()) { |
1152 |
if (error.isValid()) { |
| 1153 |
// Error! |
1153 |
// Error! |
| 1154 |
PRINT_ERROR((error.name() + ": " + error.message())) |
1154 |
PRINT_ERROR((error.name() + ": " + error.message())) |
| 1155 |
break; |
1155 |
break; |
| 1156 |
} |
1156 |
} |
| 1157 |
else if (deviceType == TDENetworkDeviceType::WiredEthernet) { |
1157 |
else if (deviceInterface == deviceNode) { |
| 1158 |
DBus::EthernetDeviceProxy ethernetDevice(NM_DBUS_SERVICE, (*it)); |
1158 |
return (*it); |
| 1159 |
ethernetDevice.setConnection(TQT_DBusConnection::systemBus()); |
|
|
| 1160 |
TQString candidateMACAddress = ethernetDevice.getPermHwAddress(error); |
| 1161 |
if (!error.isValid()) { |
| 1162 |
if (candidateMACAddress.lower() == macAddress.lower()) { |
| 1163 |
return (*it); |
| 1164 |
} |
| 1165 |
} |
| 1166 |
} |
| 1167 |
else if (deviceType == TDENetworkDeviceType::Infiniband) { |
| 1168 |
DBus::InfinibandDeviceProxy infinibandDevice(NM_DBUS_SERVICE, (*it)); |
| 1169 |
infinibandDevice.setConnection(TQT_DBusConnection::systemBus()); |
| 1170 |
TQString candidateMACAddress = infinibandDevice.getHwAddress(error); |
| 1171 |
if (!error.isValid()) { |
| 1172 |
if (candidateMACAddress.lower() == macAddress.lower()) { |
| 1173 |
return (*it); |
| 1174 |
} |
| 1175 |
} |
| 1176 |
} |
| 1177 |
else if (deviceType == TDENetworkDeviceType::WiFi) { |
| 1178 |
DBus::WiFiDeviceProxy wiFiDevice(NM_DBUS_SERVICE, (*it)); |
| 1179 |
wiFiDevice.setConnection(TQT_DBusConnection::systemBus()); |
| 1180 |
TQString candidateMACAddress = wiFiDevice.getPermHwAddress(error); |
| 1181 |
if (!error.isValid()) { |
| 1182 |
if (candidateMACAddress.lower() == macAddress.lower()) { |
| 1183 |
return (*it); |
| 1184 |
} |
| 1185 |
} |
| 1186 |
} |
| 1187 |
else if (deviceType == TDENetworkDeviceType::WiMax) { |
| 1188 |
DBus::WiMaxDeviceProxy wiMaxDevice(NM_DBUS_SERVICE, (*it)); |
| 1189 |
wiMaxDevice.setConnection(TQT_DBusConnection::systemBus()); |
| 1190 |
TQString candidateMACAddress = wiMaxDevice.getHwAddress(error); |
| 1191 |
if (!error.isValid()) { |
| 1192 |
if (candidateMACAddress.lower() == macAddress.lower()) { |
| 1193 |
return (*it); |
| 1194 |
} |
| 1195 |
} |
| 1196 |
} |
1159 |
} |
| 1197 |
else if (deviceType == TDENetworkDeviceType::OLPCMesh) { |
|
|
| 1198 |
DBus::OlpcMeshDeviceProxy olpcMeshDevice(NM_DBUS_SERVICE, (*it)); |
| 1199 |
olpcMeshDevice.setConnection(TQT_DBusConnection::systemBus()); |
| 1200 |
TQString candidateMACAddress = olpcMeshDevice.getHwAddress(error); |
| 1201 |
if (!error.isValid()) { |
| 1202 |
if (candidateMACAddress.lower() == macAddress.lower()) { |
| 1203 |
return (*it); |
| 1204 |
} |
| 1205 |
} |
| 1206 |
} |
| 1207 |
else if (deviceType == TDENetworkDeviceType::Bluetooth) { |
| 1208 |
DBus::BluetoothDeviceProxy bluetoothDevice(NM_DBUS_SERVICE, (*it)); |
| 1209 |
bluetoothDevice.setConnection(TQT_DBusConnection::systemBus()); |
| 1210 |
TQString candidateMACAddress = bluetoothDevice.getHwAddress(error); |
| 1211 |
if (!error.isValid()) { |
| 1212 |
if (candidateMACAddress.lower() == macAddress.lower()) { |
| 1213 |
return (*it); |
| 1214 |
} |
| 1215 |
} |
| 1216 |
} |
| 1217 |
// FIXME |
| 1218 |
// Add other supported device types here |
| 1219 |
} |
1160 |
} |
| 1220 |
return ""; |
1161 |
return ""; |
| 1221 |
} |
1162 |
} |
|
Lines 1230-1301
TQString TDENetworkConnectionManager_BackendNM::deviceInterfaceString(TQString m
Link Here
|
| 1230 |
} |
1171 |
} |
| 1231 |
} |
1172 |
} |
| 1232 |
|
1173 |
|
| 1233 |
TQString macAddressForGenericDevice(TQT_DBusObjectPath path) { |
1174 |
TQString tdeDeviceUUIDForGenericDevice(TQT_DBusObjectPath path) { |
| 1234 |
TQT_DBusError error; |
1175 |
TQT_DBusError error; |
| 1235 |
|
|
|
| 1236 |
DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, path); |
1176 |
DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, path); |
| 1237 |
genericDevice.setConnection(TQT_DBusConnection::systemBus()); |
1177 |
genericDevice.setConnection(TQT_DBusConnection::systemBus()); |
| 1238 |
TQ_UINT32 deviceType = genericDevice.getDeviceType(error); |
1178 |
TQString deviceInterface = genericDevice.getInterface(error); |
| 1239 |
if (error.isValid()) { |
1179 |
if (error.isValid()) { |
| 1240 |
// Error! |
1180 |
return TQString::null; |
| 1241 |
PRINT_ERROR((error.name() + ": " + error.message())) |
|
|
| 1242 |
return TQString(); |
| 1243 |
} |
| 1244 |
else if (deviceType == NM_DEVICE_TYPE_ETHERNET) { |
| 1245 |
DBus::EthernetDeviceProxy ethernetDevice(NM_DBUS_SERVICE, path); |
| 1246 |
ethernetDevice.setConnection(TQT_DBusConnection::systemBus()); |
| 1247 |
TQString candidateMACAddress = ethernetDevice.getPermHwAddress(error); |
| 1248 |
if (!error.isValid()) { |
| 1249 |
return candidateMACAddress.lower(); |
| 1250 |
} |
| 1251 |
} |
| 1252 |
else if (deviceType == NM_DEVICE_TYPE_INFINIBAND) { |
| 1253 |
DBus::InfinibandDeviceProxy infinibandDevice(NM_DBUS_SERVICE, path); |
| 1254 |
infinibandDevice.setConnection(TQT_DBusConnection::systemBus()); |
| 1255 |
TQString candidateMACAddress = infinibandDevice.getHwAddress(error); |
| 1256 |
if (!error.isValid()) { |
| 1257 |
return candidateMACAddress.lower(); |
| 1258 |
} |
| 1259 |
} |
| 1260 |
else if (deviceType == NM_DEVICE_TYPE_WIFI) { |
| 1261 |
DBus::WiFiDeviceProxy wiFiDevice(NM_DBUS_SERVICE, path); |
| 1262 |
wiFiDevice.setConnection(TQT_DBusConnection::systemBus()); |
| 1263 |
TQString candidateMACAddress = wiFiDevice.getPermHwAddress(error); |
| 1264 |
if (!error.isValid()) { |
| 1265 |
return candidateMACAddress.lower(); |
| 1266 |
} |
| 1267 |
} |
| 1268 |
else if (deviceType == NM_DEVICE_TYPE_WIMAX) { |
| 1269 |
DBus::WiMaxDeviceProxy wiMaxDevice(NM_DBUS_SERVICE, path); |
| 1270 |
wiMaxDevice.setConnection(TQT_DBusConnection::systemBus()); |
| 1271 |
TQString candidateMACAddress = wiMaxDevice.getHwAddress(error); |
| 1272 |
if (!error.isValid()) { |
| 1273 |
return candidateMACAddress.lower(); |
| 1274 |
} |
| 1275 |
} |
| 1276 |
else if (deviceType == NM_DEVICE_TYPE_OLPC_MESH) { |
| 1277 |
DBus::OlpcMeshDeviceProxy olpcMeshDevice(NM_DBUS_SERVICE, path); |
| 1278 |
olpcMeshDevice.setConnection(TQT_DBusConnection::systemBus()); |
| 1279 |
TQString candidateMACAddress = olpcMeshDevice.getHwAddress(error); |
| 1280 |
if (!error.isValid()) { |
| 1281 |
return candidateMACAddress.lower(); |
| 1282 |
} |
| 1283 |
} |
| 1284 |
else if (deviceType == NM_DEVICE_TYPE_BT) { |
| 1285 |
DBus::BluetoothDeviceProxy bluetoothDevice(NM_DBUS_SERVICE, path); |
| 1286 |
bluetoothDevice.setConnection(TQT_DBusConnection::systemBus()); |
| 1287 |
TQString candidateMACAddress = bluetoothDevice.getHwAddress(error); |
| 1288 |
if (!error.isValid()) { |
| 1289 |
return candidateMACAddress.lower(); |
| 1290 |
} |
| 1291 |
} |
1181 |
} |
| 1292 |
// FIXME |
|
|
| 1293 |
// Add other supported device types here |
| 1294 |
|
| 1295 |
return TQString::null; |
| 1296 |
} |
| 1297 |
|
1182 |
|
| 1298 |
TQString tdeDeviceUUIDForMACAddress(TQString macAddress) { |
|
|
| 1299 |
TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); |
1183 |
TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); |
| 1300 |
if (!hwdevices) { |
1184 |
if (!hwdevices) { |
| 1301 |
return TQString::null; |
1185 |
return TQString::null; |
|
Lines 1305-1311
TQString tdeDeviceUUIDForMACAddress(TQString macAddress) {
Link Here
|
| 1305 |
for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it) { |
1189 |
for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it) { |
| 1306 |
TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(*it); |
1190 |
TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(*it); |
| 1307 |
if (dev) { |
1191 |
if (dev) { |
| 1308 |
if (macAddress.lower() == dev->macAddress().lower()) { |
1192 |
if (deviceInterface == dev->deviceNode()) { |
| 1309 |
return dev->uniqueID(); |
1193 |
return dev->uniqueID(); |
| 1310 |
} |
1194 |
} |
| 1311 |
} |
1195 |
} |
|
Lines 1355-1361
void TDENetworkConnectionManager_BackendNM_DBusSignalReceiver::dbusSignal(const
Link Here
|
| 1355 |
} |
1239 |
} |
| 1356 |
} |
1240 |
} |
| 1357 |
|
1241 |
|
| 1358 |
TDENetworkConnectionManager_BackendNM::TDENetworkConnectionManager_BackendNM(TQString macAddress) : TDENetworkConnectionManager(macAddress) { |
1242 |
TDENetworkConnectionManager_BackendNM::TDENetworkConnectionManager_BackendNM(TDENetworkDevice* networkDevice) : TDENetworkConnectionManager(networkDevice) { |
| 1359 |
d = new TDENetworkConnectionManager_BackendNMPrivate(this); |
1243 |
d = new TDENetworkConnectionManager_BackendNMPrivate(this); |
| 1360 |
|
1244 |
|
| 1361 |
// Set up proxy interfaces |
1245 |
// Set up proxy interfaces |
|
Lines 1366-1372
TDENetworkConnectionManager_BackendNM::TDENetworkConnectionManager_BackendNM(TQS
Link Here
|
| 1366 |
d->m_vpnProxy = new DBus::VPNPluginProxy(NM_VPN_DBUS_PLUGIN_SERVICE, NM_VPN_DBUS_PLUGIN_PATH); |
1250 |
d->m_vpnProxy = new DBus::VPNPluginProxy(NM_VPN_DBUS_PLUGIN_SERVICE, NM_VPN_DBUS_PLUGIN_PATH); |
| 1367 |
d->m_vpnProxy->setConnection(TQT_DBusConnection::systemBus()); |
1251 |
d->m_vpnProxy->setConnection(TQT_DBusConnection::systemBus()); |
| 1368 |
|
1252 |
|
| 1369 |
d->m_dbusDeviceString = deviceInterfaceString(macAddress); |
1253 |
d->m_dbusDeviceString = deviceInterfaceString(deviceNode()); |
| 1370 |
if (d->m_dbusDeviceString != "") { |
1254 |
if (d->m_dbusDeviceString != "") { |
| 1371 |
d->m_networkDeviceProxy = new DBus::DeviceProxy(NM_DBUS_SERVICE, d->m_dbusDeviceString); |
1255 |
d->m_networkDeviceProxy = new DBus::DeviceProxy(NM_DBUS_SERVICE, d->m_dbusDeviceString); |
| 1372 |
d->m_networkDeviceProxy->setConnection(TQT_DBusConnection::systemBus()); |
1256 |
d->m_networkDeviceProxy->setConnection(TQT_DBusConnection::systemBus()); |
|
Lines 1618-1624
void TDENetworkConnectionManager_BackendNMPrivate::internalProcessDeviceStateCha
Link Here
|
| 1618 |
m_parent->internalNetworkDeviceEvent(TDENetworkDeviceEventType::Failure, errorString); |
1502 |
m_parent->internalNetworkDeviceEvent(TDENetworkDeviceEventType::Failure, errorString); |
| 1619 |
} |
1503 |
} |
| 1620 |
|
1504 |
|
| 1621 |
m_parent->internalNetworkDeviceStateChanged(nmDeviceStateToTDEDeviceState(newState), m_parent->m_macAddress); |
1505 |
m_parent->internalNetworkDeviceStateChanged(nmDeviceStateToTDEDeviceState(newState), m_parent->deviceNode()); |
| 1622 |
} |
1506 |
} |
| 1623 |
|
1507 |
|
| 1624 |
void TDENetworkConnectionManager_BackendNMPrivate::internalProcessWiFiAccessPointAdded(const TQT_DBusObjectPath& dbuspath) { |
1508 |
void TDENetworkConnectionManager_BackendNMPrivate::internalProcessWiFiAccessPointAdded(const TQT_DBusObjectPath& dbuspath) { |
|
Lines 1682-1695
void TDENetworkConnectionManager_BackendNMPrivate::internalProcessAPPropertiesCh
Link Here
|
| 1682 |
} |
1566 |
} |
| 1683 |
|
1567 |
|
| 1684 |
TDENetworkDeviceType::TDENetworkDeviceType TDENetworkConnectionManager_BackendNM::deviceType() { |
1568 |
TDENetworkDeviceType::TDENetworkDeviceType TDENetworkConnectionManager_BackendNM::deviceType() { |
| 1685 |
if (m_macAddress == "") { |
1569 |
if (m_networkDevice == NULL) { |
| 1686 |
return TDENetworkDeviceType::BackendOnly; |
1570 |
return TDENetworkDeviceType::BackendOnly; |
| 1687 |
} |
1571 |
} |
| 1688 |
else { |
1572 |
else { |
| 1689 |
if (d->m_dbusDeviceString != "") { |
1573 |
if (d->m_dbusDeviceString != "") { |
| 1690 |
// Query NM for the device type |
1574 |
// Query NM for the device type |
| 1691 |
TQT_DBusError error; |
1575 |
TQT_DBusError error; |
| 1692 |
d->m_dbusDeviceString = deviceInterfaceString(m_macAddress); |
1576 |
d->m_dbusDeviceString = deviceInterfaceString(deviceNode()); |
| 1693 |
DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, d->m_dbusDeviceString); |
1577 |
DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, d->m_dbusDeviceString); |
| 1694 |
genericDevice.setConnection(TQT_DBusConnection::systemBus()); |
1578 |
genericDevice.setConnection(TQT_DBusConnection::systemBus()); |
| 1695 |
TDENetworkDeviceType::TDENetworkDeviceType ret = nmDeviceTypeToTDEDeviceType(genericDevice.getDeviceType(error)); |
1579 |
TDENetworkDeviceType::TDENetworkDeviceType ret = nmDeviceTypeToTDEDeviceType(genericDevice.getDeviceType(error)); |
|
Lines 1981-1987
void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() {
Link Here
|
| 1981 |
d->nonReentrantCallActive = true; |
1865 |
d->nonReentrantCallActive = true; |
| 1982 |
|
1866 |
|
| 1983 |
TDEMACAddress deviceMACAddress; |
1867 |
TDEMACAddress deviceMACAddress; |
| 1984 |
deviceMACAddress.fromString(m_macAddress); |
1868 |
deviceMACAddress.fromString(this->deviceMACAddress()); |
| 1985 |
|
1869 |
|
| 1986 |
if (d->m_networkManagerSettings) { |
1870 |
if (d->m_networkManagerSettings) { |
| 1987 |
clearTDENetworkConnectionList(); |
1871 |
clearTDENetworkConnectionList(); |
|
Lines 4953-4963
TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManag
Link Here
|
| 4953 |
if ((d->m_networkManagerSettings) && (d->m_networkManagerProxy)) { |
4837 |
if ((d->m_networkManagerSettings) && (d->m_networkManagerProxy)) { |
| 4954 |
ret = d->m_networkManagerSettings->GetConnectionByUuid(uuid, existingConnection, error); |
4838 |
ret = d->m_networkManagerSettings->GetConnectionByUuid(uuid, existingConnection, error); |
| 4955 |
if (ret) { |
4839 |
if (ret) { |
| 4956 |
if (m_macAddress == "") { |
4840 |
if (m_networkDevice == NULL) { |
| 4957 |
d->m_dbusDeviceString = "/"; |
4841 |
d->m_dbusDeviceString = "/"; |
| 4958 |
} |
4842 |
} |
| 4959 |
else { |
4843 |
else { |
| 4960 |
d->m_dbusDeviceString = deviceInterfaceString(m_macAddress); |
4844 |
d->m_dbusDeviceString = deviceInterfaceString(deviceNode()); |
| 4961 |
} |
4845 |
} |
| 4962 |
#ifndef USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS |
4846 |
#ifndef USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS |
| 4963 |
TQT_DBusObjectPath active_connection; |
4847 |
TQT_DBusObjectPath active_connection; |
|
Lines 5087-5094
TQStringList TDENetworkConnectionManager_BackendNM::connectionPhysicalDeviceUUID
Link Here
|
| 5087 |
TQValueList<TQT_DBusObjectPath> deviceList = activeConnection.getDevices(error); |
4971 |
TQValueList<TQT_DBusObjectPath> deviceList = activeConnection.getDevices(error); |
| 5088 |
TQT_DBusObjectPathList::iterator it2; |
4972 |
TQT_DBusObjectPathList::iterator it2; |
| 5089 |
for (it2 = deviceList.begin(); it2 != deviceList.end(); ++it2) { |
4973 |
for (it2 = deviceList.begin(); it2 != deviceList.end(); ++it2) { |
| 5090 |
TQString macAddress = macAddressForGenericDevice(*it2); |
4974 |
TQString devUUID = tdeDeviceUUIDForGenericDevice(*it2); |
| 5091 |
TQString devUUID = tdeDeviceUUIDForMACAddress(macAddress); |
|
|
| 5092 |
if (devUUID != "") { |
4975 |
if (devUUID != "") { |
| 5093 |
ret.append(devUUID); |
4976 |
ret.append(devUUID); |
| 5094 |
} |
4977 |
} |
|
Lines 5147-5157
TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManag
Link Here
|
| 5147 |
if ((d->m_networkManagerSettings) && (d->m_networkManagerProxy)) { |
5030 |
if ((d->m_networkManagerSettings) && (d->m_networkManagerProxy)) { |
| 5148 |
existingConnection = getActiveConnectionPath(uuid); |
5031 |
existingConnection = getActiveConnectionPath(uuid); |
| 5149 |
if (existingConnection.isValid()) { |
5032 |
if (existingConnection.isValid()) { |
| 5150 |
if (m_macAddress == "") { |
5033 |
if (m_networkDevice == NULL) { |
| 5151 |
d->m_dbusDeviceString = "/"; |
5034 |
d->m_dbusDeviceString = "/"; |
| 5152 |
} |
5035 |
} |
| 5153 |
else { |
5036 |
else { |
| 5154 |
d->m_dbusDeviceString = deviceInterfaceString(m_macAddress); |
5037 |
d->m_dbusDeviceString = deviceInterfaceString(deviceNode()); |
| 5155 |
} |
5038 |
} |
| 5156 |
#ifndef USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS |
5039 |
#ifndef USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS |
| 5157 |
ret = d->m_networkManagerProxy->DeactivateConnection(existingConnection, error); |
5040 |
ret = d->m_networkManagerProxy->DeactivateConnection(existingConnection, error); |
|
Lines 5435-5441
TDENetworkHWNeighborList* TDENetworkConnectionManager_BackendNM::siteSurvey() {
Link Here
|
| 5435 |
bool ret; |
5318 |
bool ret; |
| 5436 |
|
5319 |
|
| 5437 |
TDENetworkDeviceType::TDENetworkDeviceType myDeviceType = deviceType(); |
5320 |
TDENetworkDeviceType::TDENetworkDeviceType myDeviceType = deviceType(); |
| 5438 |
d->m_dbusDeviceString = deviceInterfaceString(m_macAddress); |
5321 |
d->m_dbusDeviceString = deviceInterfaceString(deviceNode()); |
| 5439 |
clearTDENetworkHWNeighborList(); |
5322 |
clearTDENetworkHWNeighborList(); |
| 5440 |
|
5323 |
|
| 5441 |
if (myDeviceType == TDENetworkDeviceType::WiFi) { |
5324 |
if (myDeviceType == TDENetworkDeviceType::WiFi) { |