--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 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.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FSys_SettingClient.cpp
+ * @brief This is the implementation file for _SettingClient class.
+ */
+
+#include <unique_ptr.h>
+
+#include "FSys_SystemClient.h"
+
+#include <FBaseSysLog.h>
+
+#include <FIo_AppServiceIpcMessages.h>
+#include "FSys_CommunicationDispatcherClient.h"
+
+using namespace std;
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Runtime;
+using namespace Tizen::Io;
+
+namespace Tizen { namespace System
+{
+
+static const wchar_t* _SYSTEM_SERVICE_ID = L"osp.system.service";
+static const wchar_t* _SYSTEM_COMMAND_SUPPORTED = L"osp.system.command.system.get.bool";
+
+static const wchar_t* _SYSTEM_OK = L"osp.system.result.ok";
+static const wchar_t* _SYSTEM_INVALID_ARG = L"osp.system.result.invalid_arg";
+static const wchar_t* _SYSTEM_ERROR = L"osp.system.result.error";
+
+_SystemClient* _SystemClient::__pSystemClient = null;
+
+_SystemClient*
+_SystemClient::GetInstance(void)
+{
+ if(__pSystemClient == null)
+ {
+ __pSystemClient = new (std::nothrow) _SystemClient();
+ }
+ return __pSystemClient;
+}
+
+_SystemClient::_SystemClient()
+ :__pIpcClient(null)
+{
+ result r = E_SUCCESS;
+ _CommunicationDispatcherClient* pCommunicationDispatcherClient = _CommunicationDispatcherClient::GetInstance();
+ r = pCommunicationDispatcherClient->RegisterCommunicationListener(_SYSTEM_SERVICE_ID, *this);
+ __pIpcClient = pCommunicationDispatcherClient->GetIpcClient();
+}
+
+_SystemClient::~_SystemClient()
+{
+}
+
+result
+_SystemClient::ConvertResultCode(String code)
+{
+ result r = E_SYSTEM;
+ if(code == _SYSTEM_OK)
+ {
+ r = E_SUCCESS;
+ }
+ else if(code == _SYSTEM_INVALID_ARG)
+ {
+ r = E_INVALID_ARG;
+ }
+ return r;
+}
+
+result
+_SystemClient::GetValue(const Tizen::Base::String& key, bool& value)
+{
+ result r = E_SUCCESS;
+ String requestKey(key);
+ String serviceId(_SYSTEM_SERVICE_ID);
+ String commandId(_SYSTEM_COMMAND_SUPPORTED);
+
+ _CommunicationDispatcherClient* pCommunicationDispatcherClient = _CommunicationDispatcherClient::GetInstance();
+
+ __pIpcClient = pCommunicationDispatcherClient->GetIpcClient();
+
+ ArrayList requestMessages;
+ ArrayList responseMessages;
+
+ requestMessages.Construct();
+ responseMessages.Construct();
+
+ requestMessages.Add(serviceId);
+ requestMessages.Add(commandId);
+ requestMessages.Add(requestKey);
+
+ unique_ptr<IoService_Request> pMsg(new (std::nothrow) IoService_Request(requestMessages, &responseMessages));
+
+ r = __pIpcClient->SendRequest(*pMsg);
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to send request by IPC [%s]", GetErrorMessage(r));
+
+ String* pResult = (String*)responseMessages.GetAt(2);
+ SysTryReturnResult(NID_SYS, pResult != null, E_SYSTEM, "There is no result code.");
+
+ r = ConvertResultCode(*pResult);
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, "Error is occured.");
+
+ String* pValue = (String*)responseMessages.GetAt(3);
+ SysTryReturnResult(NID_SYS, pValue != null, E_SYSTEM, "There is no result value.");
+ if(pValue->GetPointer() == L"1")
+ {
+ value = true;
+ }
+ else
+ {
+ value = false;
+ }
+
+ responseMessages.RemoveAll(true);
+ return r;
+}
+
+void
+_SystemClient::OnDataReceived(const Tizen::Base::Collection::ArrayList& data)
+{
+}
+
+} } // Tizen::System
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 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.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FSys_SystemClient.h
+ * @brief This is the header file for _SystemClient class.
+ */
+
+#ifndef _FSYSTEM_INTERNAL_SYSTEM_CLIENT_H_
+#define _FSYSTEM_INTERNAL_SYSTEM_CLIENT_H_
+
+#include <FIo_IpcClient.h>
+
+#include <FBaseColArrayList.h>
+#include <FBaseObject.h>
+#include <FBaseString.h>
+#include <FBaseInteger.h>
+#include <FSys_ICommunicationDispatcherListener.h>
+
+namespace Tizen { namespace System
+{
+
+class _SystemClient
+ : public Tizen::Base::Object
+ , public Tizen::System::_ICommunicationDispatcherListener
+{
+private:
+ _SystemClient(void);
+ virtual ~_SystemClient(void);
+
+public:
+ result GetValue(const Tizen::Base::String& key, bool& value);
+ static _SystemClient* GetInstance(void);
+
+private:
+ void OnDataReceived(const Tizen::Base::Collection::ArrayList& data);
+ result ConvertResultCode(Tizen::Base::String code);
+private:
+ Tizen::Io::_IpcClient* __pIpcClient;
+ static _SystemClient* __pSystemClient;
+};
+
+} } // Tizen::System
+
+#endif //_FSYSTEM_INTERNAL_SYSTEM_CLIENT_H_
#include <FSys_SystemInfoImpl.h>
#include <FIo_AppServiceIpcMessages.h>
#include <FIo_IpcClient.h>
-#include <FSys_Types.h>
+
+#include "FSys_Types.h"
+#include "FSys_SystemClient.h"
using namespace std;
}
else if(code == _KEYBOARD_TYPE)
{
- code == _INPUT_KEYBOARD_LAYOUT;
+ code = _INPUT_KEYBOARD_LAYOUT;
}
else if(code == _SCREEN_BITS_PER_PIXEL)
{
if(pValue != null)
{
value = *pValue;
+ r = E_SUCCESS;
}
if (key == _NETWORK_TYPE) //Compatibility
value.Append(L"CDMA");
}
-
+ r = E_SUCCESS;
}
else if (key == _OPENGL_ES_VERSION)
{
value.Append(L"2.0");
}
+ r = E_SUCCESS;
}
else if(key == _BLUETOOTH_SUPPORTED)
{
value = _SUPPORTED;
else
value = _UNSUPPORTED;
+ r = E_SUCCESS;
}
else if (key == _GPS_SUPPORTED)
{
value = _SUPPORTED;
else
value = _UNSUPPORTED;
+ r = E_SUCCESS;
}
else if (key == _WIFI_SUPPORTED)
{
value = _SUPPORTED;
else
value = _UNSUPPORTED;
+ r = E_SUCCESS;
}
else if (key == _WAC_VERSION)
{
result
_SystemInfoImpl::GetFromRegistry(const String& key, bool& value)
{
+/*
+ _SystemClient* pSystemClient = _SystemClient::GetInstance();
+ pSystemClient->GetValue(key, value);
+*/
result r = E_SUCCESS;
_RegistryImpl _reg;
String valStr;
}
return E_SUCCESS;
}
+
_SystemInfoImpl*
_SystemInfoImpl::GetInstance(SystemInfo& systeminfo)
{