00001 #include "bluetoothRFCOMMedit.h" 00002 #include "bluetoothRFCOMM_NNI.h" 00003 #include "bluetoothRFCOMM_NN.h" 00004 00005 ABluetoothRFCOMM::ABluetoothRFCOMM( BluetoothRFCOMMNetNode * PNN ) : 00006 ANetNodeInstance( PNN ), Data() { 00007 Data.Devices.setAutoDelete( TRUE ); 00008 GUI = 0; 00009 RT = 0; 00010 } 00011 00012 void ABluetoothRFCOMM::setSpecificAttribute( QString & A, QString & V) { 00013 00014 if( A == "bdaddress" ) { 00015 Data.Devices.resize( Data.Devices.size() + 1 ); 00016 Data.Devices.insert( Data.Devices.size() - 1, new RFCOMMChannel); 00017 Data.Devices[ Data.Devices.size() - 1 ]->BDAddress = V; 00018 } else if ( A == "channel" ) { 00019 Data.Devices[ Data.Devices.size() - 1 ]->Channel = V.toLong(); 00020 } else if ( A == "name" ) { 00021 Data.Devices[ Data.Devices.size() - 1 ]->Name = V; 00022 } 00023 } 00024 00025 void ABluetoothRFCOMM::saveSpecificAttribute( QTextStream & TS ) { 00026 for( unsigned int i = 0 ; 00027 i < Data.Devices.count(); 00028 i ++ ) { 00029 TS << "bdaddress=" << Data.Devices[i]->BDAddress << endl; 00030 TS << "name=" << quote( Data.Devices[i]->Name ) << endl; 00031 TS << "channel=" << Data.Devices[i]->Channel << endl; 00032 } 00033 } 00034 00035 00036 QWidget * ABluetoothRFCOMM::edit( QWidget * parent ) { 00037 GUI = new BluetoothRFCOMMEdit( parent ); 00038 GUI->showData( Data ); 00039 return GUI; 00040 } 00041 00042 QString ABluetoothRFCOMM::acceptable( void ) { 00043 return ( GUI ) ? GUI->acceptable( ) : QString(); 00044 } 00045 00046 void ABluetoothRFCOMM::commit( void ) { 00047 if( GUI->commit( Data ) ) 00048 setModified( 1 ); 00049 }
1.4.2