2 * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file popup_service_callbacks.cpp
18 * @author Zofia Abramowska (z.abramowska@samsung.com)
20 * @brief Implementation of Popup Service callbacks
23 #include "popup_service_callbacks.h"
24 #include <callback_api.h>
25 #include <ace/Request.h>
26 #include <ace-dao-ro/PromptModel.h>
27 #include <dpl/log/log.h>
28 #include "attribute_facade.h"
29 #include "popup_ace_data_types.h"
30 #include "security_controller.h"
31 #include <security_caller.h>
35 void PopupServiceCallbacks::validate(SocketConnection * connector){
38 int serializedValidity = 0;
43 connector->read(&allowed,
49 &(acedata.paramValues),
50 &(acedata.sessionId));
51 } Catch (SocketConnection::Exception::SocketConnectionException){
52 LogError("Socket connection read error");
53 ReThrowMsg(ServiceCallbackApi::Exception::ServiceCallbackException,
54 "Socket connection read error");
57 if (acedata.paramKeys.size() != acedata.paramValues.size()) {
58 ThrowMsg(ServiceCallbackApi::Exception::ServiceCallbackException,
59 "Varying sizes of parameter names vector and parameter values vector");
61 FunctionParamImpl params;
62 for (size_t i = 0; i < acedata.paramKeys.size(); ++i) {
63 params.addAttribute(acedata.paramKeys[i], acedata.paramValues[i]);
65 Request request(acedata.handle,
66 WidgetExecutionPhase_Invoke,
68 request.addDeviceCapability(acedata.resource);
70 Prompt::Validity validity = static_cast<Prompt::Validity>(serializedValidity);
72 bool response = false;
73 SecurityControllerEvents::ValidatePopupResponseEvent ev(
79 SecurityCallerSingleton::Instance().SendSyncEvent(ev);
82 connector->write(response);
83 } Catch (SocketConnection::Exception::SocketConnectionException){
84 LogError("Socket connection write error");
85 ReThrowMsg(ServiceCallbackApi::Exception::ServiceCallbackException,
86 "Socket connection write error");