Revert "[Tizen](ATSPI) Fix Native TC fails"
[platform/core/uifw/dali-adaptor.git] / dali / internal / accessibility / bridge / bridge-value.cpp
1 /*
2  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/accessibility/bridge/bridge-value.h>
20
21 // EXTERNAL INCLUDES
22 #include <iostream>
23
24 using namespace Dali::Accessibility;
25
26 BridgeValue::BridgeValue()
27 {
28 }
29
30 void BridgeValue::RegisterInterfaces()
31 {
32   DBus::DBusInterfaceDescription desc{AtspiDbusInterfaceValue};
33   AddGetSetPropertyToInterface( desc, "CurrentValue", &BridgeValue::GetCurrentValue, &BridgeValue::SetCurrentValue );
34   AddGetPropertyToInterface( desc, "MaximumValue", &BridgeValue::GetMaximumValue );
35   AddGetPropertyToInterface( desc, "MinimumIncrement", &BridgeValue::GetMinimumIncrement );
36   AddGetPropertyToInterface( desc, "MinimumValue", &BridgeValue::GetMinimumValue );
37   dbusServer.addInterface( "/", desc, true );
38 }
39
40 Value* BridgeValue::FindSelf() const
41 {
42   auto s = BridgeBase::FindSelf();
43   assert( s );
44   auto s2 = dynamic_cast< Value* >( s );
45   if( !s2 )
46     throw std::domain_error{"object " + s->GetAddress().ToString() + " doesn't have Value interface"};
47   return s2;
48 }
49 double BridgeValue::GetCurrentValue()
50 {
51   return FindSelf()->GetCurrent();
52 }
53 void BridgeValue::SetCurrentValue( double new_value )
54 {
55   FindSelf()->SetCurrent( new_value );
56 }
57 double BridgeValue::GetMaximumValue()
58 {
59   return FindSelf()->GetMaximum();
60 }
61 double BridgeValue::GetMinimumIncrement()
62 {
63   return FindSelf()->GetMinimumIncrement();
64 }
65 double BridgeValue::GetMinimumValue()
66 {
67   return FindSelf()->GetMinimum();
68 }