1 //******************************************************************
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #include "RequestObject.h"
28 RequestObject::RequestObject()
29 : pSetRequestCB(nullptr)
33 RequestObject::RequestObject(SetRequestCallback cb)
38 RequestObject::~RequestObject()
43 void RequestObject::invokeRequest(RemoteObjectPtr remoteObject, RequestMethod method,
44 const RCSResourceAttributes & resourceAttibutes)
48 case RequestMethod::Set:
50 if(pSetRequestCB == nullptr)
52 remoteObject->setRemoteAttributes(resourceAttibutes,
53 std::bind(&RequestObject::setRequestCB, this,
54 std::placeholders::_1, resourceAttibutes));
58 remoteObject->setRemoteAttributes(resourceAttibutes,
59 std::bind(pSetRequestCB,
60 std::placeholders::_1, resourceAttibutes));
64 case RequestMethod::Get:
65 case RequestMethod::Delete:
67 // unknown type of method.
72 void RequestObject::setRequestCB(const RCSResourceAttributes & returnedAttributes,
73 const RCSResourceAttributes & putAttibutes)
75 if(putAttibutes != returnedAttributes)
77 // TODO fail set attributes
81 } /* namespace Service */