00001
00002 #include "services.h"
00003
00004 using namespace OpieTooth;
00005
00006
00007 Services::ProfileDescriptor::ProfileDescriptor(){
00008
00009 }
00010 Services::ProfileDescriptor::ProfileDescriptor(const QString &id, int idInt, int version ){
00011 m_id = id;
00012 m_idInt = idInt;
00013 m_version = version;
00014 }
00015 Services::ProfileDescriptor::ProfileDescriptor( const ProfileDescriptor& rem){
00016 (*this) = rem;
00017 }
00018 QString Services::ProfileDescriptor::id() const {
00019 return m_id;
00020 }
00021 void Services::ProfileDescriptor::setId( const QString& id ){
00022 m_id = id;
00023 }
00024 void Services::ProfileDescriptor::setId(int id ){
00025 m_idInt = id;
00026 }
00027 int Services::ProfileDescriptor::idInt()const{
00028 return m_idInt;
00029 }
00030 int Services::ProfileDescriptor::version() const{
00031 return m_version;
00032 }
00033 void Services::ProfileDescriptor::setVersion(int version){
00034 m_version = version;
00035 }
00036 Services::ProfileDescriptor& Services::ProfileDescriptor::operator=( const Services::ProfileDescriptor& prof){
00037 m_id = prof.m_id;
00038 m_idInt = prof.m_idInt;
00039 m_version = prof.m_version;
00040 return *this;
00041 }
00042 bool operator==(const Services::ProfileDescriptor& first,
00043 const Services::ProfileDescriptor& second ){
00044
00045 if( (first.id() == second.id() ) &&
00046 (first.version() == second.version() ) &&
00047 (first.idInt() == second.idInt() ) )
00048 return true;
00049 return false;
00050 }
00051
00052 Services::ProtocolDescriptor::ProtocolDescriptor(){
00053 m_number = 0;
00054 m_channel = 0;
00055 }
00056 Services::ProtocolDescriptor::ProtocolDescriptor(const QString& name,
00057 int number,
00058 int channel){
00059 m_name = name;
00060 m_number = number;
00061 m_channel = channel;
00062 }
00063 Services::ProtocolDescriptor::ProtocolDescriptor( const ProtocolDescriptor& ole ){
00064 (*this) = ole;
00065 }
00066 Services::ProtocolDescriptor::~ProtocolDescriptor(){
00067
00068 }
00069 QString Services::ProtocolDescriptor::name() const{
00070 return m_name;
00071 }
00072 void Services::ProtocolDescriptor::setName(const QString& name ){
00073 m_name = name;
00074 }
00075 int Services::ProtocolDescriptor::id()const {
00076 return m_number;
00077 }
00078 void Services::ProtocolDescriptor::setId( int id ){
00079 m_number = id;
00080 }
00081 int Services::ProtocolDescriptor::port()const {
00082 return m_channel;
00083 }
00084 void Services::ProtocolDescriptor::setPort( int port ){
00085 m_channel = port;
00086 }
00087 Services::ProtocolDescriptor &Services::ProtocolDescriptor::operator=( const Services::ProtocolDescriptor& desc ){
00088 m_name = desc.m_name;
00089 m_channel = desc.m_channel;
00090 m_number = desc.m_number;
00091 return *this;
00092 }
00093 bool operator==( const Services::ProtocolDescriptor &first,
00094 const Services::ProtocolDescriptor &second ){
00095 if( ( first.name() == second.name() ) &&
00096 ( first.id() == second.id() ) &&
00097 ( first.port() == second.port() ) )
00098 return true;
00099
00100 return false;
00101
00102 }
00103
00104 Services::Services(){
00105
00106 }
00107 Services::Services(const Services& service ){
00108 (*this) = service;
00109 }
00110 Services::~Services(){
00111
00112 }
00113 Services &Services::operator=( const Services& ser){
00114 m_name = ser.m_name;
00115 m_recHandle = ser.m_recHandle;
00116 m_classIds = ser.m_classIds;
00117 m_protocols = ser.m_protocols;
00118 m_profiles = ser.m_profiles;
00119 return *this;
00120 }
00121 bool operator==( const Services& one,
00122 const Services& two){
00123 if ( ( one.recHandle() == two.recHandle() ) &&
00124 ( one.serviceName() == two.serviceName() ) &&
00125 ( one.protocolDescriptorList() == two.protocolDescriptorList() ) &&
00126 ( one.profileDescriptor() == two.profileDescriptor() )
00127 )
00128 return true;
00129 return false;
00130 }
00131 QString Services::serviceName() const{
00132 return m_name;
00133 }
00134 void Services::setServiceName( const QString& service ){
00135 m_name = service;
00136 }
00137 int Services::recHandle() const{
00138 return m_recHandle;
00139 }
00140 void Services::setRecHandle( int handle){
00141 m_recHandle = handle;
00142 }
00143 QMap<int, QString> Services::classIdList()const {
00144 return m_classIds;
00145 };
00146 void Services::insertClassId( int id, const QString& str ) {
00147 m_classIds.insert( id, str );
00148 }
00149 void Services::removeClassId(int id) {
00150 m_classIds.remove( id );
00151 }
00152 void Services::clearClassId() {
00153 m_classIds.clear();
00154 }
00155 void Services::insertProtocolDescriptor( const ProtocolDescriptor& prot){
00156 m_protocols.append( prot );
00157 }
00158 void Services::clearProtocolDescriptorList(){
00159 m_protocols.clear();
00160 }
00161 void Services::removeProtocolDescriptor( const ProtocolDescriptor& prot){
00162 m_protocols.remove( prot );
00163 }
00164 Services::ProtocolDescriptor::ValueList Services::protocolDescriptorList()const{
00165 return m_protocols;
00166 }
00167
00168
00169 void Services::insertProfileDescriptor( const ProfileDescriptor& prof){
00170 m_profiles.append( prof );
00171 }
00172 void Services::clearProfileDescriptorList(){
00173 m_profiles.clear();
00174 }
00175 void Services::removeProfileDescriptor( const ProfileDescriptor& prof){
00176 m_profiles.remove(prof );
00177 }
00178 Services::ProfileDescriptor::ValueList Services::profileDescriptor() const{
00179 return m_profiles;
00180 }