summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/lib/services.cc
blob: 23b760b654622035b2c39900f3e5a6adec407efe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180

#include "services.h"

using namespace OpieTooth;


Services::ProfileDescriptor::ProfileDescriptor(){

}
Services::ProfileDescriptor::ProfileDescriptor(const QString &id, int idInt, int version ){
  m_id = id;
  m_idInt = idInt;
  m_version = version;
}
Services::ProfileDescriptor::ProfileDescriptor( const ProfileDescriptor& rem){
  (*this) = rem;
}
QString Services::ProfileDescriptor::id() const {
  return m_id;
}
void Services::ProfileDescriptor::setId( const QString& id ){
  m_id = id;
}
void Services::ProfileDescriptor::setId(int id ){
  m_idInt = id;
}
int Services::ProfileDescriptor::idInt()const{
  return m_idInt;
}
int Services::ProfileDescriptor::version() const{
  return m_version;
}
void Services::ProfileDescriptor::setVersion(int version){
  m_version = version;
}
Services::ProfileDescriptor& Services::ProfileDescriptor::operator=( const Services::ProfileDescriptor& prof){
  m_id = prof.m_id;
  m_idInt = prof.m_idInt;
  m_version = prof.m_version;
  return *this;
}
bool operator==(const Services::ProfileDescriptor& first,
		const Services::ProfileDescriptor& second ){

  if( (first.id() == second.id() ) &&
      (first.version() == second.version() ) &&
      (first.idInt() == second.idInt() ) )
    return true;
  return false;
}

Services::ProtocolDescriptor::ProtocolDescriptor(){
  m_number = 0;
  m_channel = 0;
}
Services::ProtocolDescriptor::ProtocolDescriptor(const QString& name,
						 int number,
						 int channel){
  m_name = name;
  m_number = number;
  m_channel = channel;
}
Services::ProtocolDescriptor::ProtocolDescriptor( const ProtocolDescriptor& ole ){
  (*this) = ole;
}
Services::ProtocolDescriptor::~ProtocolDescriptor(){

}
QString Services::ProtocolDescriptor::name() const{
  return m_name;
}
void Services::ProtocolDescriptor::setName(const QString& name ){
  m_name = name;
}
int Services::ProtocolDescriptor::id()const {
  return m_number;
}
void Services::ProtocolDescriptor::setId( int id ){
  m_number = id;
}
int Services::ProtocolDescriptor::port()const {
  return m_channel;
}
void Services::ProtocolDescriptor::setPort( int port ){
  m_channel = port;
}
Services::ProtocolDescriptor &Services::ProtocolDescriptor::operator=( const Services::ProtocolDescriptor& desc ){
  m_name = desc.m_name;
  m_channel = desc.m_channel;
  m_number = desc.m_number;
  return *this;
}
bool operator==( const Services::ProtocolDescriptor &first,
		 const Services::ProtocolDescriptor &second ){
  if( ( first.name() == second.name() ) &&
      ( first.id() == second.id() ) &&
      ( first.port() == second.port() ) )
    return true;

    return false;

}

Services::Services(){

}
Services::Services(const Services& service ){
    (*this) = service;
}
Services::~Services(){

}
Services &Services::operator=( const Services& ser){
    m_name =  ser.m_name;
    m_recHandle = ser.m_recHandle;
    m_classIds = ser.m_classIds;
    m_protocols = ser.m_protocols;
    m_profiles = ser.m_profiles;
  return *this;
}
bool operator==( const Services& one,
		 const Services& two){
    if ( ( one.recHandle() == two.recHandle() ) &&
         ( one.serviceName() == two.serviceName() ) &&
         ( one.protocolDescriptorList() == two.protocolDescriptorList() ) &&
         ( one.profileDescriptor() == two.profileDescriptor() )
         /* ( one.classIdList() == two.classIdList() ) */ )
        return true;
  return false;
}
QString Services::serviceName() const{
    return m_name;
}
void Services::setServiceName( const QString& service ){
    m_name = service;
}
int Services::recHandle() const{
    return m_recHandle;
}
void Services::setRecHandle( int handle){
    m_recHandle = handle;
}
QMap<int, QString> Services::classIdList()const {
    return m_classIds;
};
void Services::insertClassId( int id, const QString& str ) {
    m_classIds.insert( id, str );
}
void Services::removeClassId(int id) {
    m_classIds.remove( id );
}
void Services::clearClassId() {
    m_classIds.clear();
}
void Services::insertProtocolDescriptor( const ProtocolDescriptor& prot){
    m_protocols.append( prot );
}
void Services::clearProtocolDescriptorList(){
    m_protocols.clear();
}
void Services::removeProtocolDescriptor( const ProtocolDescriptor& prot){
    m_protocols.remove( prot );
}
Services::ProtocolDescriptor::ValueList Services::protocolDescriptorList()const{
    return m_protocols;
}


void Services::insertProfileDescriptor( const ProfileDescriptor& prof){
    m_profiles.append( prof );
}
void Services::clearProfileDescriptorList(){
    m_profiles.clear();
}
void Services::removeProfileDescriptor( const ProfileDescriptor& prof){
    m_profiles.remove(prof );
}
Services::ProfileDescriptor::ValueList Services::profileDescriptor() const{
    return m_profiles;
}