|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #include "PhoneDetailsImpl.h" |
|
6 |
|
7 #include "csf_common.h" |
|
8 |
|
9 namespace CSF |
|
10 { |
|
11 |
|
12 PhoneDetailsImpl::PhoneDetailsImpl() |
|
13 : model(-1), |
|
14 state(ServiceStateType::eUnknown) |
|
15 { |
|
16 } |
|
17 |
|
18 PhoneDetailsImpl::~PhoneDetailsImpl() |
|
19 { |
|
20 } |
|
21 |
|
22 static const char * _softphoneSupportedModelNames[] = { "Cisco Unified Client Services Framework", |
|
23 "Client Services Framework", |
|
24 "Client Services Core" }; |
|
25 |
|
26 bool PhoneDetailsImpl::isSoftPhone() |
|
27 { |
|
28 if(model == -1 && modelDescription != "") |
|
29 { |
|
30 // Evaluate based on model description. |
|
31 for(int i = 0; i < (int) csf_countof(_softphoneSupportedModelNames); i++) |
|
32 { |
|
33 if(modelDescription == _softphoneSupportedModelNames[i]) |
|
34 return true; |
|
35 } |
|
36 return false; |
|
37 } |
|
38 else |
|
39 { |
|
40 } |
|
41 return false; |
|
42 } |
|
43 |
|
44 void PhoneDetailsImpl::setName(const std::string& name) |
|
45 { |
|
46 this->name = name; |
|
47 } |
|
48 void PhoneDetailsImpl::setDescription(const std::string& description) |
|
49 { |
|
50 this->description = description; |
|
51 } |
|
52 // Note that setting model and model description are mutually exclusive. |
|
53 void PhoneDetailsImpl::setModel(int model) |
|
54 { |
|
55 this->model = model; |
|
56 this->modelDescription = ""; |
|
57 } |
|
58 void PhoneDetailsImpl::setModelDescription(const std::string& description) |
|
59 { |
|
60 this->model = -1; |
|
61 this->modelDescription = description; |
|
62 } |
|
63 void PhoneDetailsImpl::setLineDNs(const std::vector<std::string> & lineDNs) |
|
64 { |
|
65 this->lineDNs.assign(lineDNs.begin(), lineDNs.end()); |
|
66 } |
|
67 void PhoneDetailsImpl::setServiceState(ServiceStateType::ServiceState state) |
|
68 { |
|
69 this->state = state; |
|
70 } |
|
71 void PhoneDetailsImpl::setConfig(const std::string& config) |
|
72 { |
|
73 this->config = config; |
|
74 } |
|
75 |
|
76 } |