[AT-SPI] Fix not working screen reader when rerunning it
[platform/core/uifw/dali-adaptor.git] / dali / internal / accessibility / bridge / bridge-value.cpp
index aa1a34c..7f81a32 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -30,38 +30,45 @@ BridgeValue::BridgeValue()
 void BridgeValue::RegisterInterfaces()
 {
   DBus::DBusInterfaceDescription desc{AtspiDbusInterfaceValue};
-  AddGetSetPropertyToInterface( desc, "CurrentValue", &BridgeValue::GetCurrentValue, &BridgeValue::SetCurrentValue );
-  AddGetPropertyToInterface( desc, "MaximumValue", &BridgeValue::GetMaximumValue );
-  AddGetPropertyToInterface( desc, "MinimumIncrement", &BridgeValue::GetMinimumIncrement );
-  AddGetPropertyToInterface( desc, "MinimumValue", &BridgeValue::GetMinimumValue );
-  dbusServer.addInterface( "/", desc, true );
+  AddGetSetPropertyToInterface(desc, "CurrentValue", &BridgeValue::GetCurrentValue, &BridgeValue::SetCurrentValue);
+  AddGetPropertyToInterface(desc, "MaximumValue", &BridgeValue::GetMaximumValue);
+  AddGetPropertyToInterface(desc, "MinimumIncrement", &BridgeValue::GetMinimumIncrement);
+  AddGetPropertyToInterface(desc, "MinimumValue", &BridgeValue::GetMinimumValue);
+  mDbusServer.addInterface("/", desc, true);
 }
 
 Value* BridgeValue::FindSelf() const
 {
-  auto s = BridgeBase::FindSelf();
-  assert( s );
-  auto s2 = dynamic_cast< Value* >( s );
-  if( !s2 )
-    throw std::domain_error{"object " + s->GetAddress().ToString() + " doesn't have Value interface"};
-  return s2;
+  auto self = BridgeBase::FindSelf();
+  assert(self);
+  auto valueInterface = dynamic_cast<Value*>(self);
+  if(!valueInterface)
+  {
+    throw std::domain_error{"object " + self->GetAddress().ToString() + " doesn't have Value interface"};
+  }
+  return valueInterface;
 }
+
 double BridgeValue::GetCurrentValue()
 {
   return FindSelf()->GetCurrent();
 }
-void BridgeValue::SetCurrentValue( double new_value )
+
+void BridgeValue::SetCurrentValue(double newValue)
 {
-  FindSelf()->SetCurrent( new_value );
+  FindSelf()->SetCurrent(newValue);
 }
+
 double BridgeValue::GetMaximumValue()
 {
   return FindSelf()->GetMaximum();
 }
+
 double BridgeValue::GetMinimumIncrement()
 {
   return FindSelf()->GetMinimumIncrement();
 }
+
 double BridgeValue::GetMinimumValue()
 {
   return FindSelf()->GetMinimum();