diff options
Diffstat (limited to 'SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI')
177 files changed, 18439 insertions, 0 deletions
diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddCommand.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddCommand.cpp new file mode 100644 index 000000000..26b38541c --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddCommand.cpp @@ -0,0 +1,131 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AddCommand.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +AddCommand& AddCommand::operator =(const AddCommand& c) +{ + cmdId=c.cmdId; + menuParams=c.menuParams; + if(cmdIcon) delete cmdIcon; + cmdIcon= c.cmdIcon ? new NsSmartDeviceLinkRPCV2::Image(c.cmdIcon[0]) : 0; + appId=c.appId; + return *this; +} + + +AddCommand::~AddCommand(void) +{ + if(cmdIcon) delete cmdIcon; +} + + +AddCommand::AddCommand(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ADDCOMMAND), + cmdIcon(0) +{ +} + + +AddCommand::AddCommand(const AddCommand& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ADDCOMMAND,c.getId()) +{ + *this=c; +} + + +unsigned int AddCommand::get_cmdId(void) +{ + return cmdId; +} + +bool AddCommand::set_cmdId(unsigned int cmdId_) +{ + cmdId=cmdId_; + return true; +} + +const NsSmartDeviceLinkRPCV2::MenuParams& AddCommand::get_menuParams(void) +{ + return menuParams; +} + +bool AddCommand::set_menuParams(const NsSmartDeviceLinkRPCV2::MenuParams& menuParams_) +{ + menuParams=menuParams_; + return true; +} + +const NsSmartDeviceLinkRPCV2::Image* AddCommand::get_cmdIcon(void) +{ + return cmdIcon; +} + +bool AddCommand::set_cmdIcon(const NsSmartDeviceLinkRPCV2::Image& cmdIcon_) +{ + if(cmdIcon) delete cmdIcon; + cmdIcon=new NsSmartDeviceLinkRPCV2::Image(cmdIcon_); + return true; +} + +void AddCommand::reset_cmdIcon(void) +{ + if(cmdIcon) delete cmdIcon; + cmdIcon=0; +} + +int AddCommand::get_appId(void) +{ + return appId; +} + +bool AddCommand::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool AddCommand::checkIntegrity(void) +{ + return AddCommandMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddCommandMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddCommandMarshaller.cpp new file mode 100644 index 000000000..3f91cbf9c --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddCommandMarshaller.cpp @@ -0,0 +1,148 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AddCommand.h" +#include "../src/SDLRPCObjectsImpl/V2/MenuParamsMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ImageMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/AddCommandMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool AddCommandMarshaller::checkIntegrity(AddCommand& s) +{ + return checkIntegrityConst(s); +} + + +bool AddCommandMarshaller::fromString(const std::string& s,AddCommand& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string AddCommandMarshaller::toString(const AddCommand& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool AddCommandMarshaller::checkIntegrityConst(const AddCommand& s) +{ + if(s.cmdId>2000000000) return false; + + if(!NsSmartDeviceLinkRPCV2::MenuParamsMarshaller::checkIntegrityConst(s.menuParams)) return false; + + if(s.cmdIcon && (!NsSmartDeviceLinkRPCV2::ImageMarshaller::checkIntegrityConst(s.cmdIcon[0]))) return false; + + return true; +} + + +Json::Value AddCommandMarshaller::toJSON(const AddCommand& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.AddCommand"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["cmdId"]=Json::Value(e.cmdId);; + json["params"]["menuParams"]=NsSmartDeviceLinkRPCV2::MenuParamsMarshaller::toJSON(e.menuParams);; + if(e.cmdIcon) + json["params"]["cmdIcon"]=NsSmartDeviceLinkRPCV2::ImageMarshaller::toJSON(e.cmdIcon[0]);; + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool AddCommandMarshaller::fromJSON(const Json::Value& json,AddCommand& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.AddCommand")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(!js.isMember("cmdId") || !js["cmdId"].isInt()) return false; + c.cmdId=js["cmdId"].asInt(); + if(c.cmdId>2000000000) return false; + + if(!js.isMember("menuParams") || !NsSmartDeviceLinkRPCV2::MenuParamsMarshaller::fromJSON(js["menuParams"],c.menuParams)) return false; + + if(c.cmdIcon) delete c.cmdIcon; + c.cmdIcon=0; + if(js.isMember("cmdIcon")) + { + c.cmdIcon=new NsSmartDeviceLinkRPCV2::Image(); + if(!NsSmartDeviceLinkRPCV2::ImageMarshaller::fromJSON(js["cmdIcon"],c.cmdIcon[0])) return false; + } + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddCommandMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddCommandMarshaller.h new file mode 100644 index 000000000..1548cc356 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddCommandMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_ADDCOMMANDMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_ADDCOMMANDMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AddCommand.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct AddCommandMarshaller + { + static bool checkIntegrity(AddCommand& e); + static bool checkIntegrityConst(const AddCommand& e); + + static bool fromString(const std::string& s,AddCommand& e); + static const std::string toString(const AddCommand& e); + + static bool fromJSON(const Json::Value& s,AddCommand& e); + static Json::Value toJSON(const AddCommand& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddCommandResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddCommandResponse.cpp new file mode 100644 index 000000000..cf40a9e31 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddCommandResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AddCommandResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +AddCommandResponse& AddCommandResponse::operator =(const AddCommandResponse& c) +{ + return *this; +} + + +AddCommandResponse::~AddCommandResponse(void) +{ +} + + +AddCommandResponse::AddCommandResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ADDCOMMANDRESPONSE) +{ +} + + +AddCommandResponse::AddCommandResponse(const AddCommandResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ADDCOMMANDRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool AddCommandResponse::checkIntegrity(void) +{ + return AddCommandResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddCommandResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddCommandResponseMarshaller.cpp new file mode 100644 index 000000000..d23e3c1b0 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddCommandResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AddCommandResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/AddCommandResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool AddCommandResponseMarshaller::checkIntegrity(AddCommandResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool AddCommandResponseMarshaller::fromString(const std::string& s,AddCommandResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string AddCommandResponseMarshaller::toString(const AddCommandResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool AddCommandResponseMarshaller::checkIntegrityConst(const AddCommandResponse& s) +{ + return true; +} + + +Json::Value AddCommandResponseMarshaller::toJSON(const AddCommandResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.AddCommandResponse"); + + return json; +} + + +bool AddCommandResponseMarshaller::fromJSON(const Json::Value& json,AddCommandResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.AddCommandResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddCommandResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddCommandResponseMarshaller.h new file mode 100644 index 000000000..5d4845e41 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddCommandResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_ADDCOMMANDRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_ADDCOMMANDRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AddCommandResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct AddCommandResponseMarshaller + { + static bool checkIntegrity(AddCommandResponse& e); + static bool checkIntegrityConst(const AddCommandResponse& e); + + static bool fromString(const std::string& s,AddCommandResponse& e); + static const std::string toString(const AddCommandResponse& e); + + static bool fromJSON(const Json::Value& s,AddCommandResponse& e); + static Json::Value toJSON(const AddCommandResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddSubMenu.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddSubMenu.cpp new file mode 100644 index 000000000..77a87d230 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddSubMenu.cpp @@ -0,0 +1,131 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AddSubMenu.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +AddSubMenu& AddSubMenu::operator =(const AddSubMenu& c) +{ + menuId=c.menuId; + if(position) delete position; + position= c.position ? new unsigned int(c.position[0]) : 0; + menuName=c.menuName; + appId=c.appId; + return *this; +} + + +AddSubMenu::~AddSubMenu(void) +{ + if(position) delete position; +} + + +AddSubMenu::AddSubMenu(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ADDSUBMENU), + position(0) +{ +} + + +AddSubMenu::AddSubMenu(const AddSubMenu& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ADDSUBMENU,c.getId()) +{ + *this=c; +} + + +unsigned int AddSubMenu::get_menuId(void) +{ + return menuId; +} + +bool AddSubMenu::set_menuId(unsigned int menuId_) +{ + menuId=menuId_; + return true; +} + +const unsigned int* AddSubMenu::get_position(void) +{ + return position; +} + +bool AddSubMenu::set_position(const unsigned int& position_) +{ + if(position) delete position; + position=new unsigned int(position_); + return true; +} + +void AddSubMenu::reset_position(void) +{ + if(position) delete position; + position=0; +} + +const std::string& AddSubMenu::get_menuName(void) +{ + return menuName; +} + +bool AddSubMenu::set_menuName(const std::string& menuName_) +{ + menuName=menuName_; + return true; +} + +int AddSubMenu::get_appId(void) +{ + return appId; +} + +bool AddSubMenu::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool AddSubMenu::checkIntegrity(void) +{ + return AddSubMenuMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddSubMenuMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddSubMenuMarshaller.cpp new file mode 100644 index 000000000..0a17ac478 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddSubMenuMarshaller.cpp @@ -0,0 +1,151 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AddSubMenu.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/AddSubMenuMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool AddSubMenuMarshaller::checkIntegrity(AddSubMenu& s) +{ + return checkIntegrityConst(s); +} + + +bool AddSubMenuMarshaller::fromString(const std::string& s,AddSubMenu& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string AddSubMenuMarshaller::toString(const AddSubMenu& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool AddSubMenuMarshaller::checkIntegrityConst(const AddSubMenu& s) +{ + if(s.menuId>2000000000) return false; + + if(s.position && (s.position[0]>1000)) return false; + + if(s.menuName.length()>500) return false; + + return true; +} + + +Json::Value AddSubMenuMarshaller::toJSON(const AddSubMenu& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.AddSubMenu"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["menuId"]=Json::Value(e.menuId);; + if(e.position) + json["params"]["position"]=Json::Value(e.position[0]);; + json["params"]["menuName"]=Json::Value(e.menuName);; + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool AddSubMenuMarshaller::fromJSON(const Json::Value& json,AddSubMenu& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.AddSubMenu")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(!js.isMember("menuId") || !js["menuId"].isInt()) return false; + c.menuId=js["menuId"].asInt(); + if(c.menuId>2000000000) return false; + + if(c.position) delete c.position; + c.position=0; + if(js.isMember("position")) + { + if(!js["position"].isInt()) return false; + c.position=new unsigned int(); + c.position[0]=js["position"].asInt(); + if(c.position[0]>1000) return false; + + } + + if(!js.isMember("menuName") || !js["menuName"].isString()) return false; + c.menuName=js["menuName"].asString(); + if(c.menuName.length()>500) return false; + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddSubMenuMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddSubMenuMarshaller.h new file mode 100644 index 000000000..bb48df5d0 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddSubMenuMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_ADDSUBMENUMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_ADDSUBMENUMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AddSubMenu.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct AddSubMenuMarshaller + { + static bool checkIntegrity(AddSubMenu& e); + static bool checkIntegrityConst(const AddSubMenu& e); + + static bool fromString(const std::string& s,AddSubMenu& e); + static const std::string toString(const AddSubMenu& e); + + static bool fromJSON(const Json::Value& s,AddSubMenu& e); + static Json::Value toJSON(const AddSubMenu& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddSubMenuResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddSubMenuResponse.cpp new file mode 100644 index 000000000..213f08085 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddSubMenuResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AddSubMenuResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +AddSubMenuResponse& AddSubMenuResponse::operator =(const AddSubMenuResponse& c) +{ + return *this; +} + + +AddSubMenuResponse::~AddSubMenuResponse(void) +{ +} + + +AddSubMenuResponse::AddSubMenuResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ADDSUBMENURESPONSE) +{ +} + + +AddSubMenuResponse::AddSubMenuResponse(const AddSubMenuResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ADDSUBMENURESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool AddSubMenuResponse::checkIntegrity(void) +{ + return AddSubMenuResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddSubMenuResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddSubMenuResponseMarshaller.cpp new file mode 100644 index 000000000..4a6f7c872 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddSubMenuResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AddSubMenuResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/AddSubMenuResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool AddSubMenuResponseMarshaller::checkIntegrity(AddSubMenuResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool AddSubMenuResponseMarshaller::fromString(const std::string& s,AddSubMenuResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string AddSubMenuResponseMarshaller::toString(const AddSubMenuResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool AddSubMenuResponseMarshaller::checkIntegrityConst(const AddSubMenuResponse& s) +{ + return true; +} + + +Json::Value AddSubMenuResponseMarshaller::toJSON(const AddSubMenuResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.AddSubMenuResponse"); + + return json; +} + + +bool AddSubMenuResponseMarshaller::fromJSON(const Json::Value& json,AddSubMenuResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.AddSubMenuResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddSubMenuResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddSubMenuResponseMarshaller.h new file mode 100644 index 000000000..40f5d2e1b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AddSubMenuResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_ADDSUBMENURESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_ADDSUBMENURESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AddSubMenuResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct AddSubMenuResponseMarshaller + { + static bool checkIntegrity(AddSubMenuResponse& e); + static bool checkIntegrityConst(const AddSubMenuResponse& e); + + static bool fromString(const std::string& s,AddSubMenuResponse& e); + static const std::string toString(const AddSubMenuResponse& e); + + static bool fromJSON(const Json::Value& s,AddSubMenuResponse& e); + static Json::Value toJSON(const AddSubMenuResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/Alert.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/Alert.cpp new file mode 100644 index 000000000..000ff4dec --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/Alert.cpp @@ -0,0 +1,239 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/Alert.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +Alert& Alert::operator =(const Alert& c) +{ + if(AlertText1) delete AlertText1; + AlertText1= c.AlertText1 ? new std::string(c.AlertText1[0]) : 0; + if(AlertText2) delete AlertText2; + AlertText2= c.AlertText2 ? new std::string(c.AlertText2[0]) : 0; + if(AlertText3) delete AlertText3; + AlertText3= c.AlertText3 ? new std::string(c.AlertText3[0]) : 0; + if(ttsChunks) delete ttsChunks; + ttsChunks= c.ttsChunks ? new std::vector<NsSmartDeviceLinkRPCV2::TTSChunk>(c.ttsChunks[0]) : 0; + if(duration) delete duration; + duration= c.duration ? new unsigned int(c.duration[0]) : 0; + if(playTone) delete playTone; + playTone= c.playTone ? new bool(c.playTone[0]) : 0; + if(softButtons) delete softButtons; + softButtons= c.softButtons ? new std::vector<NsSmartDeviceLinkRPCV2::SoftButton>(c.softButtons[0]) : 0; + appId=c.appId; + return *this; +} + + +Alert::~Alert(void) +{ + if(AlertText1) delete AlertText1; + if(AlertText2) delete AlertText2; + if(AlertText3) delete AlertText3; + if(ttsChunks) delete ttsChunks; + if(duration) delete duration; + if(playTone) delete playTone; + if(softButtons) delete softButtons; +} + + +Alert::Alert(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ALERT), + AlertText1(0), + AlertText2(0), + AlertText3(0), + ttsChunks(0), + duration(0), + playTone(0), + softButtons(0) +{ +} + + +Alert::Alert(const Alert& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ALERT,c.getId()) +{ + *this=c; +} + + +const std::string* Alert::get_AlertText1(void) +{ + return AlertText1; +} + +bool Alert::set_AlertText1(const std::string& AlertText1_) +{ + if(AlertText1) delete AlertText1; + AlertText1=new std::string(AlertText1_); + return true; +} + +void Alert::reset_AlertText1(void) +{ + if(AlertText1) delete AlertText1; + AlertText1=0; +} + +const std::string* Alert::get_AlertText2(void) +{ + return AlertText2; +} + +bool Alert::set_AlertText2(const std::string& AlertText2_) +{ + if(AlertText2) delete AlertText2; + AlertText2=new std::string(AlertText2_); + return true; +} + +void Alert::reset_AlertText2(void) +{ + if(AlertText2) delete AlertText2; + AlertText2=0; +} + +const std::string* Alert::get_AlertText3(void) +{ + return AlertText3; +} + +bool Alert::set_AlertText3(const std::string& AlertText3_) +{ + if(AlertText3) delete AlertText3; + AlertText3=new std::string(AlertText3_); + return true; +} + +void Alert::reset_AlertText3(void) +{ + if(AlertText3) delete AlertText3; + AlertText3=0; +} + +const std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>* Alert::get_ttsChunks(void) +{ + return ttsChunks; +} + +bool Alert::set_ttsChunks(const std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>& ttsChunks_) +{ + if(ttsChunks) delete ttsChunks; + ttsChunks=new std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>(ttsChunks_); + return true; +} + +void Alert::reset_ttsChunks(void) +{ + if(ttsChunks) delete ttsChunks; + ttsChunks=0; +} + +const unsigned int* Alert::get_duration(void) +{ + return duration; +} + +bool Alert::set_duration(const unsigned int& duration_) +{ + if(duration) delete duration; + duration=new unsigned int(duration_); + return true; +} + +void Alert::reset_duration(void) +{ + if(duration) delete duration; + duration=0; +} + +const bool* Alert::get_playTone(void) +{ + return playTone; +} + +bool Alert::set_playTone(const bool& playTone_) +{ + if(playTone) delete playTone; + playTone=new bool(playTone_); + return true; +} + +void Alert::reset_playTone(void) +{ + if(playTone) delete playTone; + playTone=0; +} + +const std::vector< NsSmartDeviceLinkRPCV2::SoftButton>* Alert::get_softButtons(void) +{ + return softButtons; +} + +bool Alert::set_softButtons(const std::vector< NsSmartDeviceLinkRPCV2::SoftButton>& softButtons_) +{ + if(softButtons) delete softButtons; + softButtons=new std::vector< NsSmartDeviceLinkRPCV2::SoftButton>(softButtons_); + return true; +} + +void Alert::reset_softButtons(void) +{ + if(softButtons) delete softButtons; + softButtons=0; +} + +int Alert::get_appId(void) +{ + return appId; +} + +bool Alert::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool Alert::checkIntegrity(void) +{ + return AlertMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertManeuver.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertManeuver.cpp new file mode 100644 index 000000000..834fdebd3 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertManeuver.cpp @@ -0,0 +1,109 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AlertManeuver.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +AlertManeuver& AlertManeuver::operator =(const AlertManeuver& c) +{ + ttsChunks=c.ttsChunks; + softButtons=c.softButtons; + appId=c.appId; + return *this; +} + + +AlertManeuver::~AlertManeuver(void) +{ +} + + +AlertManeuver::AlertManeuver(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ALERTMANEUVER) +{ +} + + +AlertManeuver::AlertManeuver(const AlertManeuver& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ALERTMANEUVER,c.getId()) +{ + *this=c; +} + + +const std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>& AlertManeuver::get_ttsChunks(void) +{ + return ttsChunks; +} + +bool AlertManeuver::set_ttsChunks(const std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>& ttsChunks_) +{ + ttsChunks=ttsChunks_; + return true; +} + +const std::vector< NsSmartDeviceLinkRPCV2::SoftButton>& AlertManeuver::get_softButtons(void) +{ + return softButtons; +} + +bool AlertManeuver::set_softButtons(const std::vector< NsSmartDeviceLinkRPCV2::SoftButton>& softButtons_) +{ + softButtons=softButtons_; + return true; +} + +int AlertManeuver::get_appId(void) +{ + return appId; +} + +bool AlertManeuver::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool AlertManeuver::checkIntegrity(void) +{ + return AlertManeuverMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertManeuverMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertManeuverMarshaller.cpp new file mode 100644 index 000000000..377012d59 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertManeuverMarshaller.cpp @@ -0,0 +1,184 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AlertManeuver.h" +#include "../src/SDLRPCObjectsImpl/V2/TTSChunkMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/SoftButtonMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/AlertManeuverMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool AlertManeuverMarshaller::checkIntegrity(AlertManeuver& s) +{ + return checkIntegrityConst(s); +} + + +bool AlertManeuverMarshaller::fromString(const std::string& s,AlertManeuver& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string AlertManeuverMarshaller::toString(const AlertManeuver& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool AlertManeuverMarshaller::checkIntegrityConst(const AlertManeuver& s) +{ + { + unsigned int i=s.ttsChunks.size(); + if(i<1) return false; + if(i>100) return false; + } + + { + unsigned int i=s.softButtons.size(); + if(i<0) return false; + if(i>3) return false; + } + + return true; +} + + +Json::Value AlertManeuverMarshaller::toJSON(const AlertManeuver& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.AlertManeuver"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + { + unsigned int i=e.ttsChunks.size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::TTSChunkMarshaller::toJSON(e.ttsChunks[i]); + + json["params"]["ttsChunks"]=j; + } + { + unsigned int i=e.softButtons.size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::SoftButtonMarshaller::toJSON(e.softButtons[i]); + + json["params"]["softButtons"]=j; + } + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool AlertManeuverMarshaller::fromJSON(const Json::Value& json,AlertManeuver& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.AlertManeuver")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(!js.isMember("ttsChunks") || !js["ttsChunks"].isArray()) return false; + { + unsigned int i=js["ttsChunks"].size(); + if(i<1) return false; + if(i>100) return false; + c.ttsChunks.resize(i); + while(i--) + { + NsSmartDeviceLinkRPCV2::TTSChunk t; + if(!NsSmartDeviceLinkRPCV2::TTSChunkMarshaller::fromJSON(js["ttsChunks"][i],t)) + return false; + c.ttsChunks[i]=t; + } + } + + if(!js.isMember("softButtons") || !js["softButtons"].isArray()) return false; + { + unsigned int i=js["softButtons"].size(); + if(i<0) return false; + if(i>3) return false; + c.softButtons.resize(i); + while(i--) + { + NsSmartDeviceLinkRPCV2::SoftButton t; + if(!NsSmartDeviceLinkRPCV2::SoftButtonMarshaller::fromJSON(js["softButtons"][i],t)) + return false; + c.softButtons[i]=t; + } + } + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertManeuverMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertManeuverMarshaller.h new file mode 100644 index 000000000..79b357cbe --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertManeuverMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_ALERTMANEUVERMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_ALERTMANEUVERMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AlertManeuver.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct AlertManeuverMarshaller + { + static bool checkIntegrity(AlertManeuver& e); + static bool checkIntegrityConst(const AlertManeuver& e); + + static bool fromString(const std::string& s,AlertManeuver& e); + static const std::string toString(const AlertManeuver& e); + + static bool fromJSON(const Json::Value& s,AlertManeuver& e); + static Json::Value toJSON(const AlertManeuver& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertManeuverResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertManeuverResponse.cpp new file mode 100644 index 000000000..98128676b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertManeuverResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AlertManeuverResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +AlertManeuverResponse& AlertManeuverResponse::operator =(const AlertManeuverResponse& c) +{ + return *this; +} + + +AlertManeuverResponse::~AlertManeuverResponse(void) +{ +} + + +AlertManeuverResponse::AlertManeuverResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ALERTMANEUVERRESPONSE) +{ +} + + +AlertManeuverResponse::AlertManeuverResponse(const AlertManeuverResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ALERTMANEUVERRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool AlertManeuverResponse::checkIntegrity(void) +{ + return AlertManeuverResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertManeuverResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertManeuverResponseMarshaller.cpp new file mode 100644 index 000000000..c55f9122c --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertManeuverResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AlertManeuverResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/AlertManeuverResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool AlertManeuverResponseMarshaller::checkIntegrity(AlertManeuverResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool AlertManeuverResponseMarshaller::fromString(const std::string& s,AlertManeuverResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string AlertManeuverResponseMarshaller::toString(const AlertManeuverResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool AlertManeuverResponseMarshaller::checkIntegrityConst(const AlertManeuverResponse& s) +{ + return true; +} + + +Json::Value AlertManeuverResponseMarshaller::toJSON(const AlertManeuverResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.AlertManeuverResponse"); + + return json; +} + + +bool AlertManeuverResponseMarshaller::fromJSON(const Json::Value& json,AlertManeuverResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.AlertManeuverResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertManeuverResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertManeuverResponseMarshaller.h new file mode 100644 index 000000000..08c41d425 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertManeuverResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_ALERTMANEUVERRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_ALERTMANEUVERRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AlertManeuverResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct AlertManeuverResponseMarshaller + { + static bool checkIntegrity(AlertManeuverResponse& e); + static bool checkIntegrityConst(const AlertManeuverResponse& e); + + static bool fromString(const std::string& s,AlertManeuverResponse& e); + static const std::string toString(const AlertManeuverResponse& e); + + static bool fromJSON(const Json::Value& s,AlertManeuverResponse& e); + static Json::Value toJSON(const AlertManeuverResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertMarshaller.cpp new file mode 100644 index 000000000..ab2b1607e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertMarshaller.cpp @@ -0,0 +1,264 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/Alert.h" +#include "../src/SDLRPCObjectsImpl/V2/TTSChunkMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/SoftButtonMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/AlertMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool AlertMarshaller::checkIntegrity(Alert& s) +{ + return checkIntegrityConst(s); +} + + +bool AlertMarshaller::fromString(const std::string& s,Alert& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string AlertMarshaller::toString(const Alert& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool AlertMarshaller::checkIntegrityConst(const Alert& s) +{ + if(s.AlertText1 && (s.AlertText1[0].length()>500)) return false; + + if(s.AlertText2 && (s.AlertText2[0].length()>500)) return false; + + if(s.AlertText3 && (s.AlertText3[0].length()>500)) return false; + + if(s.ttsChunks) + { + unsigned int i=s.ttsChunks[0].size(); + if(i<1) return false; + if(i>100) return false; + } + + if(s.duration && (s.duration[0]<3000 || s.duration[0]>10000)) return false; + + if(s.softButtons) + { + unsigned int i=s.softButtons[0].size(); + if(i<0) return false; + if(i>4) return false; + } + + return true; +} + + +Json::Value AlertMarshaller::toJSON(const Alert& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.Alert"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + if(e.AlertText1) + json["params"]["AlertText1"]=Json::Value(e.AlertText1[0]);; + if(e.AlertText2) + json["params"]["AlertText2"]=Json::Value(e.AlertText2[0]);; + if(e.AlertText3) + json["params"]["AlertText3"]=Json::Value(e.AlertText3[0]);; + if(e.ttsChunks) + { + unsigned int i=e.ttsChunks[0].size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::TTSChunkMarshaller::toJSON(e.ttsChunks[0][i]); + + json["params"]["ttsChunks"]=j; + } + if(e.duration) + json["params"]["duration"]=Json::Value(e.duration[0]);; + if(e.playTone) + json["params"]["playTone"]=Json::Value(e.playTone[0]);; + if(e.softButtons) + { + unsigned int i=e.softButtons[0].size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::SoftButtonMarshaller::toJSON(e.softButtons[0][i]); + + json["params"]["softButtons"]=j; + } + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool AlertMarshaller::fromJSON(const Json::Value& json,Alert& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.Alert")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(c.AlertText1) delete c.AlertText1; + c.AlertText1=0; + if(js.isMember("AlertText1")) + { + if(!js["AlertText1"].isString()) return false; + c.AlertText1=new std::string(); + c.AlertText1[0]=js["AlertText1"].asString(); + if(c.AlertText1[0].length()>500) return false; + + } + + if(c.AlertText2) delete c.AlertText2; + c.AlertText2=0; + if(js.isMember("AlertText2")) + { + if(!js["AlertText2"].isString()) return false; + c.AlertText2=new std::string(); + c.AlertText2[0]=js["AlertText2"].asString(); + if(c.AlertText2[0].length()>500) return false; + + } + + if(c.AlertText3) delete c.AlertText3; + c.AlertText3=0; + if(js.isMember("AlertText3")) + { + if(!js["AlertText3"].isString()) return false; + c.AlertText3=new std::string(); + c.AlertText3[0]=js["AlertText3"].asString(); + if(c.AlertText3[0].length()>500) return false; + + } + + if(c.ttsChunks) delete c.ttsChunks; + c.ttsChunks=0; + if(js.isMember("ttsChunks")) + { + if(!js["ttsChunks"].isArray()) return false; + unsigned int i=js["ttsChunks"].size(); + if(i<1) return false; + if(i>100) return false; + + c.ttsChunks=new std::vector<NsSmartDeviceLinkRPCV2::TTSChunk>(); + c.ttsChunks->resize(js["ttsChunks"].size()); + + while(i--) + if(!NsSmartDeviceLinkRPCV2::TTSChunkMarshaller::fromJSON(js["ttsChunks"][i],c.ttsChunks[0][i])) return false; + } + + + if(c.duration) delete c.duration; + c.duration=0; + if(js.isMember("duration")) + { + if(!js["duration"].isInt()) return false; + c.duration=new unsigned int(); + c.duration[0]=js["duration"].asInt(); + if(c.duration[0]<3000 || c.duration[0]>10000) return false; + + } + + if(c.playTone) delete c.playTone; + c.playTone=0; + if(js.isMember("playTone")) + { + if(!js["playTone"].isBool()) return false; + c.playTone=new bool(); + c.playTone[0]=js["playTone"].asBool(); + + } + + if(c.softButtons) delete c.softButtons; + c.softButtons=0; + if(js.isMember("softButtons")) + { + if(!js["softButtons"].isArray()) return false; + unsigned int i=js["softButtons"].size(); + if(i<0) return false; + if(i>4) return false; + + c.softButtons=new std::vector<NsSmartDeviceLinkRPCV2::SoftButton>(); + c.softButtons->resize(js["softButtons"].size()); + + while(i--) + if(!NsSmartDeviceLinkRPCV2::SoftButtonMarshaller::fromJSON(js["softButtons"][i],c.softButtons[0][i])) return false; + } + + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertMarshaller.h new file mode 100644 index 000000000..bc88d7eb6 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_ALERTMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_ALERTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/Alert.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct AlertMarshaller + { + static bool checkIntegrity(Alert& e); + static bool checkIntegrityConst(const Alert& e); + + static bool fromString(const std::string& s,Alert& e); + static const std::string toString(const Alert& e); + + static bool fromJSON(const Json::Value& s,Alert& e); + static Json::Value toJSON(const Alert& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertResponse.cpp new file mode 100644 index 000000000..212651c2a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertResponse.cpp @@ -0,0 +1,95 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AlertResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +AlertResponse& AlertResponse::operator =(const AlertResponse& c) +{ + if(tryAgainTime) delete tryAgainTime; + tryAgainTime= c.tryAgainTime ? new unsigned int(c.tryAgainTime[0]) : 0; + return *this; +} + + +AlertResponse::~AlertResponse(void) +{ + if(tryAgainTime) delete tryAgainTime; +} + + +AlertResponse::AlertResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ALERTRESPONSE), + tryAgainTime(0) +{ +} + + +AlertResponse::AlertResponse(const AlertResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ALERTRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +const unsigned int* AlertResponse::get_tryAgainTime(void) +{ + return tryAgainTime; +} + +bool AlertResponse::set_tryAgainTime(const unsigned int& tryAgainTime_) +{ + if(tryAgainTime) delete tryAgainTime; + tryAgainTime=new unsigned int(tryAgainTime_); + return true; +} + +void AlertResponse::reset_tryAgainTime(void) +{ + if(tryAgainTime) delete tryAgainTime; + tryAgainTime=0; +} + +bool AlertResponse::checkIntegrity(void) +{ + return AlertResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertResponseMarshaller.cpp new file mode 100644 index 000000000..82e6454bc --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertResponseMarshaller.cpp @@ -0,0 +1,142 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AlertResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/AlertResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool AlertResponseMarshaller::checkIntegrity(AlertResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool AlertResponseMarshaller::fromString(const std::string& s,AlertResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string AlertResponseMarshaller::toString(const AlertResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool AlertResponseMarshaller::checkIntegrityConst(const AlertResponse& s) +{ + if(s.tryAgainTime && (s.tryAgainTime[0]>2000000000)) return false; + + return true; +} + + +Json::Value AlertResponseMarshaller::toJSON(const AlertResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.AlertResponse"); + + if(e.tryAgainTime) + json["result"]["tryAgainTime"]=Json::Value(e.tryAgainTime[0]);; + return json; +} + + +bool AlertResponseMarshaller::fromJSON(const Json::Value& json,AlertResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.AlertResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + if(c.tryAgainTime) delete c.tryAgainTime; + c.tryAgainTime=0; + if(js.isMember("tryAgainTime")) + { + if(!js["tryAgainTime"].isInt()) return false; + c.tryAgainTime=new unsigned int(); + c.tryAgainTime[0]=js["tryAgainTime"].asInt(); + if(c.tryAgainTime[0]>2000000000) return false; + + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertResponseMarshaller.h new file mode 100644 index 000000000..b8675ff0f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/AlertResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_ALERTRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_ALERTRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/AlertResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct AlertResponseMarshaller + { + static bool checkIntegrity(AlertResponse& e); + static bool checkIntegrityConst(const AlertResponse& e); + + static bool fromString(const std::string& s,AlertResponse& e); + static const std::string toString(const AlertResponse& e); + + static bool fromJSON(const Json::Value& s,AlertResponse& e); + static Json::Value toJSON(const AlertResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ChangeRegistration.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ChangeRegistration.cpp new file mode 100644 index 000000000..e388d44bb --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ChangeRegistration.cpp @@ -0,0 +1,97 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ChangeRegistration.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +ChangeRegistration& ChangeRegistration::operator =(const ChangeRegistration& c) +{ + hmiDisplayLanguage=c.hmiDisplayLanguage; + appId=c.appId; + return *this; +} + + +ChangeRegistration::~ChangeRegistration(void) +{ +} + + +ChangeRegistration::ChangeRegistration(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__CHANGEREGISTRATION) +{ +} + + +ChangeRegistration::ChangeRegistration(const ChangeRegistration& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__CHANGEREGISTRATION,c.getId()) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::Language& ChangeRegistration::get_hmiDisplayLanguage(void) +{ + return hmiDisplayLanguage; +} + +bool ChangeRegistration::set_hmiDisplayLanguage(const NsSmartDeviceLinkRPCV2::Language& hmiDisplayLanguage_) +{ + hmiDisplayLanguage=hmiDisplayLanguage_; + return true; +} + +int ChangeRegistration::get_appId(void) +{ + return appId; +} + +bool ChangeRegistration::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool ChangeRegistration::checkIntegrity(void) +{ + return ChangeRegistrationMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ChangeRegistrationMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ChangeRegistrationMarshaller.cpp new file mode 100644 index 000000000..bd918ce48 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ChangeRegistrationMarshaller.cpp @@ -0,0 +1,128 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ChangeRegistration.h" +#include "../src/SDLRPCObjectsImpl/V2/LanguageMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/ChangeRegistrationMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool ChangeRegistrationMarshaller::checkIntegrity(ChangeRegistration& s) +{ + return checkIntegrityConst(s); +} + + +bool ChangeRegistrationMarshaller::fromString(const std::string& s,ChangeRegistration& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string ChangeRegistrationMarshaller::toString(const ChangeRegistration& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool ChangeRegistrationMarshaller::checkIntegrityConst(const ChangeRegistration& s) +{ + if(!NsSmartDeviceLinkRPCV2::LanguageMarshaller::checkIntegrityConst(s.hmiDisplayLanguage)) return false; + + return true; +} + + +Json::Value ChangeRegistrationMarshaller::toJSON(const ChangeRegistration& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.ChangeRegistration"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["hmiDisplayLanguage"]=NsSmartDeviceLinkRPCV2::LanguageMarshaller::toJSON(e.hmiDisplayLanguage);; + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool ChangeRegistrationMarshaller::fromJSON(const Json::Value& json,ChangeRegistration& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.ChangeRegistration")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(!js.isMember("hmiDisplayLanguage") || !NsSmartDeviceLinkRPCV2::LanguageMarshaller::fromJSON(js["hmiDisplayLanguage"],c.hmiDisplayLanguage)) return false; + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ChangeRegistrationMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ChangeRegistrationMarshaller.h new file mode 100644 index 000000000..56bb52b0c --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ChangeRegistrationMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_CHANGEREGISTRATIONMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_CHANGEREGISTRATIONMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ChangeRegistration.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct ChangeRegistrationMarshaller + { + static bool checkIntegrity(ChangeRegistration& e); + static bool checkIntegrityConst(const ChangeRegistration& e); + + static bool fromString(const std::string& s,ChangeRegistration& e); + static const std::string toString(const ChangeRegistration& e); + + static bool fromJSON(const Json::Value& s,ChangeRegistration& e); + static Json::Value toJSON(const ChangeRegistration& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ChangeRegistrationResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ChangeRegistrationResponse.cpp new file mode 100644 index 000000000..ba7203fc3 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ChangeRegistrationResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ChangeRegistrationResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +ChangeRegistrationResponse& ChangeRegistrationResponse::operator =(const ChangeRegistrationResponse& c) +{ + return *this; +} + + +ChangeRegistrationResponse::~ChangeRegistrationResponse(void) +{ +} + + +ChangeRegistrationResponse::ChangeRegistrationResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__CHANGEREGISTRATIONRESPONSE) +{ +} + + +ChangeRegistrationResponse::ChangeRegistrationResponse(const ChangeRegistrationResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__CHANGEREGISTRATIONRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool ChangeRegistrationResponse::checkIntegrity(void) +{ + return ChangeRegistrationResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ChangeRegistrationResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ChangeRegistrationResponseMarshaller.cpp new file mode 100644 index 000000000..8f04e5d7d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ChangeRegistrationResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ChangeRegistrationResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/ChangeRegistrationResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool ChangeRegistrationResponseMarshaller::checkIntegrity(ChangeRegistrationResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool ChangeRegistrationResponseMarshaller::fromString(const std::string& s,ChangeRegistrationResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string ChangeRegistrationResponseMarshaller::toString(const ChangeRegistrationResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool ChangeRegistrationResponseMarshaller::checkIntegrityConst(const ChangeRegistrationResponse& s) +{ + return true; +} + + +Json::Value ChangeRegistrationResponseMarshaller::toJSON(const ChangeRegistrationResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.ChangeRegistrationResponse"); + + return json; +} + + +bool ChangeRegistrationResponseMarshaller::fromJSON(const Json::Value& json,ChangeRegistrationResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.ChangeRegistrationResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ChangeRegistrationResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ChangeRegistrationResponseMarshaller.h new file mode 100644 index 000000000..f7848921d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ChangeRegistrationResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_CHANGEREGISTRATIONRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_CHANGEREGISTRATIONRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ChangeRegistrationResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct ChangeRegistrationResponseMarshaller + { + static bool checkIntegrity(ChangeRegistrationResponse& e); + static bool checkIntegrityConst(const ChangeRegistrationResponse& e); + + static bool fromString(const std::string& s,ChangeRegistrationResponse& e); + static const std::string toString(const ChangeRegistrationResponse& e); + + static bool fromJSON(const Json::Value& s,ChangeRegistrationResponse& e); + static Json::Value toJSON(const ChangeRegistrationResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/CreateInteractionChoiceSet.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/CreateInteractionChoiceSet.cpp new file mode 100644 index 000000000..ca1b1ce4b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/CreateInteractionChoiceSet.cpp @@ -0,0 +1,109 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/CreateInteractionChoiceSet.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +CreateInteractionChoiceSet& CreateInteractionChoiceSet::operator =(const CreateInteractionChoiceSet& c) +{ + interactionChoiceSetID=c.interactionChoiceSetID; + choiceSet=c.choiceSet; + appId=c.appId; + return *this; +} + + +CreateInteractionChoiceSet::~CreateInteractionChoiceSet(void) +{ +} + + +CreateInteractionChoiceSet::CreateInteractionChoiceSet(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__CREATEINTERACTIONCHOICESET) +{ +} + + +CreateInteractionChoiceSet::CreateInteractionChoiceSet(const CreateInteractionChoiceSet& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__CREATEINTERACTIONCHOICESET,c.getId()) +{ + *this=c; +} + + +unsigned int CreateInteractionChoiceSet::get_interactionChoiceSetID(void) +{ + return interactionChoiceSetID; +} + +bool CreateInteractionChoiceSet::set_interactionChoiceSetID(unsigned int interactionChoiceSetID_) +{ + interactionChoiceSetID=interactionChoiceSetID_; + return true; +} + +const std::vector< NsSmartDeviceLinkRPCV2::Choice>& CreateInteractionChoiceSet::get_choiceSet(void) +{ + return choiceSet; +} + +bool CreateInteractionChoiceSet::set_choiceSet(const std::vector< NsSmartDeviceLinkRPCV2::Choice>& choiceSet_) +{ + choiceSet=choiceSet_; + return true; +} + +int CreateInteractionChoiceSet::get_appId(void) +{ + return appId; +} + +bool CreateInteractionChoiceSet::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool CreateInteractionChoiceSet::checkIntegrity(void) +{ + return CreateInteractionChoiceSetMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/CreateInteractionChoiceSetMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/CreateInteractionChoiceSetMarshaller.cpp new file mode 100644 index 000000000..680b2785e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/CreateInteractionChoiceSetMarshaller.cpp @@ -0,0 +1,160 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/CreateInteractionChoiceSet.h" +#include "../src/SDLRPCObjectsImpl/V2/ChoiceMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/CreateInteractionChoiceSetMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool CreateInteractionChoiceSetMarshaller::checkIntegrity(CreateInteractionChoiceSet& s) +{ + return checkIntegrityConst(s); +} + + +bool CreateInteractionChoiceSetMarshaller::fromString(const std::string& s,CreateInteractionChoiceSet& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string CreateInteractionChoiceSetMarshaller::toString(const CreateInteractionChoiceSet& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool CreateInteractionChoiceSetMarshaller::checkIntegrityConst(const CreateInteractionChoiceSet& s) +{ + if(s.interactionChoiceSetID>2000000000) return false; + + { + unsigned int i=s.choiceSet.size(); + if(i<1) return false; + if(i>100) return false; + } + + return true; +} + + +Json::Value CreateInteractionChoiceSetMarshaller::toJSON(const CreateInteractionChoiceSet& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.CreateInteractionChoiceSet"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["interactionChoiceSetID"]=Json::Value(e.interactionChoiceSetID);; + { + unsigned int i=e.choiceSet.size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::ChoiceMarshaller::toJSON(e.choiceSet[i]); + + json["params"]["choiceSet"]=j; + } + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool CreateInteractionChoiceSetMarshaller::fromJSON(const Json::Value& json,CreateInteractionChoiceSet& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.CreateInteractionChoiceSet")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(!js.isMember("interactionChoiceSetID") || !js["interactionChoiceSetID"].isInt()) return false; + c.interactionChoiceSetID=js["interactionChoiceSetID"].asInt(); + if(c.interactionChoiceSetID>2000000000) return false; + + if(!js.isMember("choiceSet") || !js["choiceSet"].isArray()) return false; + { + unsigned int i=js["choiceSet"].size(); + if(i<1) return false; + if(i>100) return false; + c.choiceSet.resize(i); + while(i--) + { + NsSmartDeviceLinkRPCV2::Choice t; + if(!NsSmartDeviceLinkRPCV2::ChoiceMarshaller::fromJSON(js["choiceSet"][i],t)) + return false; + c.choiceSet[i]=t; + } + } + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/CreateInteractionChoiceSetMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/CreateInteractionChoiceSetMarshaller.h new file mode 100644 index 000000000..d087969d2 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/CreateInteractionChoiceSetMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_CREATEINTERACTIONCHOICESETMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_CREATEINTERACTIONCHOICESETMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/CreateInteractionChoiceSet.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct CreateInteractionChoiceSetMarshaller + { + static bool checkIntegrity(CreateInteractionChoiceSet& e); + static bool checkIntegrityConst(const CreateInteractionChoiceSet& e); + + static bool fromString(const std::string& s,CreateInteractionChoiceSet& e); + static const std::string toString(const CreateInteractionChoiceSet& e); + + static bool fromJSON(const Json::Value& s,CreateInteractionChoiceSet& e); + static Json::Value toJSON(const CreateInteractionChoiceSet& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/CreateInteractionChoiceSetResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/CreateInteractionChoiceSetResponse.cpp new file mode 100644 index 000000000..282b3bdc5 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/CreateInteractionChoiceSetResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/CreateInteractionChoiceSetResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +CreateInteractionChoiceSetResponse& CreateInteractionChoiceSetResponse::operator =(const CreateInteractionChoiceSetResponse& c) +{ + return *this; +} + + +CreateInteractionChoiceSetResponse::~CreateInteractionChoiceSetResponse(void) +{ +} + + +CreateInteractionChoiceSetResponse::CreateInteractionChoiceSetResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__CREATEINTERACTIONCHOICESETRESPONSE) +{ +} + + +CreateInteractionChoiceSetResponse::CreateInteractionChoiceSetResponse(const CreateInteractionChoiceSetResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__CREATEINTERACTIONCHOICESETRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool CreateInteractionChoiceSetResponse::checkIntegrity(void) +{ + return CreateInteractionChoiceSetResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/CreateInteractionChoiceSetResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/CreateInteractionChoiceSetResponseMarshaller.cpp new file mode 100644 index 000000000..84f492f9f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/CreateInteractionChoiceSetResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/CreateInteractionChoiceSetResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/CreateInteractionChoiceSetResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool CreateInteractionChoiceSetResponseMarshaller::checkIntegrity(CreateInteractionChoiceSetResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool CreateInteractionChoiceSetResponseMarshaller::fromString(const std::string& s,CreateInteractionChoiceSetResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string CreateInteractionChoiceSetResponseMarshaller::toString(const CreateInteractionChoiceSetResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool CreateInteractionChoiceSetResponseMarshaller::checkIntegrityConst(const CreateInteractionChoiceSetResponse& s) +{ + return true; +} + + +Json::Value CreateInteractionChoiceSetResponseMarshaller::toJSON(const CreateInteractionChoiceSetResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.CreateInteractionChoiceSetResponse"); + + return json; +} + + +bool CreateInteractionChoiceSetResponseMarshaller::fromJSON(const Json::Value& json,CreateInteractionChoiceSetResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.CreateInteractionChoiceSetResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/CreateInteractionChoiceSetResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/CreateInteractionChoiceSetResponseMarshaller.h new file mode 100644 index 000000000..33348682d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/CreateInteractionChoiceSetResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_CREATEINTERACTIONCHOICESETRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_CREATEINTERACTIONCHOICESETRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/CreateInteractionChoiceSetResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct CreateInteractionChoiceSetResponseMarshaller + { + static bool checkIntegrity(CreateInteractionChoiceSetResponse& e); + static bool checkIntegrityConst(const CreateInteractionChoiceSetResponse& e); + + static bool fromString(const std::string& s,CreateInteractionChoiceSetResponse& e); + static const std::string toString(const CreateInteractionChoiceSetResponse& e); + + static bool fromJSON(const Json::Value& s,CreateInteractionChoiceSetResponse& e); + static Json::Value toJSON(const CreateInteractionChoiceSetResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteCommand.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteCommand.cpp new file mode 100644 index 000000000..54eab8d85 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteCommand.cpp @@ -0,0 +1,97 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DeleteCommand.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +DeleteCommand& DeleteCommand::operator =(const DeleteCommand& c) +{ + cmdId=c.cmdId; + appId=c.appId; + return *this; +} + + +DeleteCommand::~DeleteCommand(void) +{ +} + + +DeleteCommand::DeleteCommand(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__DELETECOMMAND) +{ +} + + +DeleteCommand::DeleteCommand(const DeleteCommand& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__DELETECOMMAND,c.getId()) +{ + *this=c; +} + + +unsigned int DeleteCommand::get_cmdId(void) +{ + return cmdId; +} + +bool DeleteCommand::set_cmdId(unsigned int cmdId_) +{ + cmdId=cmdId_; + return true; +} + +int DeleteCommand::get_appId(void) +{ + return appId; +} + +bool DeleteCommand::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool DeleteCommand::checkIntegrity(void) +{ + return DeleteCommandMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteCommandMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteCommandMarshaller.cpp new file mode 100644 index 000000000..5ea174123 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteCommandMarshaller.cpp @@ -0,0 +1,129 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DeleteCommand.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/DeleteCommandMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool DeleteCommandMarshaller::checkIntegrity(DeleteCommand& s) +{ + return checkIntegrityConst(s); +} + + +bool DeleteCommandMarshaller::fromString(const std::string& s,DeleteCommand& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string DeleteCommandMarshaller::toString(const DeleteCommand& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool DeleteCommandMarshaller::checkIntegrityConst(const DeleteCommand& s) +{ + if(s.cmdId>2000000000) return false; + + return true; +} + + +Json::Value DeleteCommandMarshaller::toJSON(const DeleteCommand& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.DeleteCommand"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["cmdId"]=Json::Value(e.cmdId);; + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool DeleteCommandMarshaller::fromJSON(const Json::Value& json,DeleteCommand& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.DeleteCommand")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(!js.isMember("cmdId") || !js["cmdId"].isInt()) return false; + c.cmdId=js["cmdId"].asInt(); + if(c.cmdId>2000000000) return false; + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteCommandMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteCommandMarshaller.h new file mode 100644 index 000000000..7ce55f67f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteCommandMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_DELETECOMMANDMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_DELETECOMMANDMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DeleteCommand.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct DeleteCommandMarshaller + { + static bool checkIntegrity(DeleteCommand& e); + static bool checkIntegrityConst(const DeleteCommand& e); + + static bool fromString(const std::string& s,DeleteCommand& e); + static const std::string toString(const DeleteCommand& e); + + static bool fromJSON(const Json::Value& s,DeleteCommand& e); + static Json::Value toJSON(const DeleteCommand& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteCommandResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteCommandResponse.cpp new file mode 100644 index 000000000..e1dff2f5e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteCommandResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DeleteCommandResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +DeleteCommandResponse& DeleteCommandResponse::operator =(const DeleteCommandResponse& c) +{ + return *this; +} + + +DeleteCommandResponse::~DeleteCommandResponse(void) +{ +} + + +DeleteCommandResponse::DeleteCommandResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__DELETECOMMANDRESPONSE) +{ +} + + +DeleteCommandResponse::DeleteCommandResponse(const DeleteCommandResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__DELETECOMMANDRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool DeleteCommandResponse::checkIntegrity(void) +{ + return DeleteCommandResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteCommandResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteCommandResponseMarshaller.cpp new file mode 100644 index 000000000..a1c4962c9 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteCommandResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DeleteCommandResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/DeleteCommandResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool DeleteCommandResponseMarshaller::checkIntegrity(DeleteCommandResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool DeleteCommandResponseMarshaller::fromString(const std::string& s,DeleteCommandResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string DeleteCommandResponseMarshaller::toString(const DeleteCommandResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool DeleteCommandResponseMarshaller::checkIntegrityConst(const DeleteCommandResponse& s) +{ + return true; +} + + +Json::Value DeleteCommandResponseMarshaller::toJSON(const DeleteCommandResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.DeleteCommandResponse"); + + return json; +} + + +bool DeleteCommandResponseMarshaller::fromJSON(const Json::Value& json,DeleteCommandResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.DeleteCommandResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteCommandResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteCommandResponseMarshaller.h new file mode 100644 index 000000000..5555926d7 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteCommandResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_DELETECOMMANDRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_DELETECOMMANDRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DeleteCommandResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct DeleteCommandResponseMarshaller + { + static bool checkIntegrity(DeleteCommandResponse& e); + static bool checkIntegrityConst(const DeleteCommandResponse& e); + + static bool fromString(const std::string& s,DeleteCommandResponse& e); + static const std::string toString(const DeleteCommandResponse& e); + + static bool fromJSON(const Json::Value& s,DeleteCommandResponse& e); + static Json::Value toJSON(const DeleteCommandResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteInteractionChoiceSet.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteInteractionChoiceSet.cpp new file mode 100644 index 000000000..fb0659300 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteInteractionChoiceSet.cpp @@ -0,0 +1,97 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DeleteInteractionChoiceSet.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +DeleteInteractionChoiceSet& DeleteInteractionChoiceSet::operator =(const DeleteInteractionChoiceSet& c) +{ + interactionChoiceSetID=c.interactionChoiceSetID; + appId=c.appId; + return *this; +} + + +DeleteInteractionChoiceSet::~DeleteInteractionChoiceSet(void) +{ +} + + +DeleteInteractionChoiceSet::DeleteInteractionChoiceSet(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__DELETEINTERACTIONCHOICESET) +{ +} + + +DeleteInteractionChoiceSet::DeleteInteractionChoiceSet(const DeleteInteractionChoiceSet& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__DELETEINTERACTIONCHOICESET,c.getId()) +{ + *this=c; +} + + +unsigned int DeleteInteractionChoiceSet::get_interactionChoiceSetID(void) +{ + return interactionChoiceSetID; +} + +bool DeleteInteractionChoiceSet::set_interactionChoiceSetID(unsigned int interactionChoiceSetID_) +{ + interactionChoiceSetID=interactionChoiceSetID_; + return true; +} + +int DeleteInteractionChoiceSet::get_appId(void) +{ + return appId; +} + +bool DeleteInteractionChoiceSet::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool DeleteInteractionChoiceSet::checkIntegrity(void) +{ + return DeleteInteractionChoiceSetMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteInteractionChoiceSetMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteInteractionChoiceSetMarshaller.cpp new file mode 100644 index 000000000..02beef484 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteInteractionChoiceSetMarshaller.cpp @@ -0,0 +1,129 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DeleteInteractionChoiceSet.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/DeleteInteractionChoiceSetMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool DeleteInteractionChoiceSetMarshaller::checkIntegrity(DeleteInteractionChoiceSet& s) +{ + return checkIntegrityConst(s); +} + + +bool DeleteInteractionChoiceSetMarshaller::fromString(const std::string& s,DeleteInteractionChoiceSet& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string DeleteInteractionChoiceSetMarshaller::toString(const DeleteInteractionChoiceSet& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool DeleteInteractionChoiceSetMarshaller::checkIntegrityConst(const DeleteInteractionChoiceSet& s) +{ + if(s.interactionChoiceSetID>2000000000) return false; + + return true; +} + + +Json::Value DeleteInteractionChoiceSetMarshaller::toJSON(const DeleteInteractionChoiceSet& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.DeleteInteractionChoiceSet"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["interactionChoiceSetID"]=Json::Value(e.interactionChoiceSetID);; + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool DeleteInteractionChoiceSetMarshaller::fromJSON(const Json::Value& json,DeleteInteractionChoiceSet& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.DeleteInteractionChoiceSet")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(!js.isMember("interactionChoiceSetID") || !js["interactionChoiceSetID"].isInt()) return false; + c.interactionChoiceSetID=js["interactionChoiceSetID"].asInt(); + if(c.interactionChoiceSetID>2000000000) return false; + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteInteractionChoiceSetMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteInteractionChoiceSetMarshaller.h new file mode 100644 index 000000000..79c27127b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteInteractionChoiceSetMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_DELETEINTERACTIONCHOICESETMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_DELETEINTERACTIONCHOICESETMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DeleteInteractionChoiceSet.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct DeleteInteractionChoiceSetMarshaller + { + static bool checkIntegrity(DeleteInteractionChoiceSet& e); + static bool checkIntegrityConst(const DeleteInteractionChoiceSet& e); + + static bool fromString(const std::string& s,DeleteInteractionChoiceSet& e); + static const std::string toString(const DeleteInteractionChoiceSet& e); + + static bool fromJSON(const Json::Value& s,DeleteInteractionChoiceSet& e); + static Json::Value toJSON(const DeleteInteractionChoiceSet& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteInteractionChoiceSetResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteInteractionChoiceSetResponse.cpp new file mode 100644 index 000000000..d5d3d6b16 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteInteractionChoiceSetResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DeleteInteractionChoiceSetResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +DeleteInteractionChoiceSetResponse& DeleteInteractionChoiceSetResponse::operator =(const DeleteInteractionChoiceSetResponse& c) +{ + return *this; +} + + +DeleteInteractionChoiceSetResponse::~DeleteInteractionChoiceSetResponse(void) +{ +} + + +DeleteInteractionChoiceSetResponse::DeleteInteractionChoiceSetResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__DELETEINTERACTIONCHOICESETRESPONSE) +{ +} + + +DeleteInteractionChoiceSetResponse::DeleteInteractionChoiceSetResponse(const DeleteInteractionChoiceSetResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__DELETEINTERACTIONCHOICESETRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool DeleteInteractionChoiceSetResponse::checkIntegrity(void) +{ + return DeleteInteractionChoiceSetResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteInteractionChoiceSetResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteInteractionChoiceSetResponseMarshaller.cpp new file mode 100644 index 000000000..568cfe8fd --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteInteractionChoiceSetResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DeleteInteractionChoiceSetResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/DeleteInteractionChoiceSetResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool DeleteInteractionChoiceSetResponseMarshaller::checkIntegrity(DeleteInteractionChoiceSetResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool DeleteInteractionChoiceSetResponseMarshaller::fromString(const std::string& s,DeleteInteractionChoiceSetResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string DeleteInteractionChoiceSetResponseMarshaller::toString(const DeleteInteractionChoiceSetResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool DeleteInteractionChoiceSetResponseMarshaller::checkIntegrityConst(const DeleteInteractionChoiceSetResponse& s) +{ + return true; +} + + +Json::Value DeleteInteractionChoiceSetResponseMarshaller::toJSON(const DeleteInteractionChoiceSetResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.DeleteInteractionChoiceSetResponse"); + + return json; +} + + +bool DeleteInteractionChoiceSetResponseMarshaller::fromJSON(const Json::Value& json,DeleteInteractionChoiceSetResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.DeleteInteractionChoiceSetResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteInteractionChoiceSetResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteInteractionChoiceSetResponseMarshaller.h new file mode 100644 index 000000000..2cf4fca55 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteInteractionChoiceSetResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_DELETEINTERACTIONCHOICESETRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_DELETEINTERACTIONCHOICESETRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DeleteInteractionChoiceSetResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct DeleteInteractionChoiceSetResponseMarshaller + { + static bool checkIntegrity(DeleteInteractionChoiceSetResponse& e); + static bool checkIntegrityConst(const DeleteInteractionChoiceSetResponse& e); + + static bool fromString(const std::string& s,DeleteInteractionChoiceSetResponse& e); + static const std::string toString(const DeleteInteractionChoiceSetResponse& e); + + static bool fromJSON(const Json::Value& s,DeleteInteractionChoiceSetResponse& e); + static Json::Value toJSON(const DeleteInteractionChoiceSetResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteSubMenu.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteSubMenu.cpp new file mode 100644 index 000000000..99f1bb0c3 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteSubMenu.cpp @@ -0,0 +1,97 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DeleteSubMenu.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +DeleteSubMenu& DeleteSubMenu::operator =(const DeleteSubMenu& c) +{ + menuId=c.menuId; + appId=c.appId; + return *this; +} + + +DeleteSubMenu::~DeleteSubMenu(void) +{ +} + + +DeleteSubMenu::DeleteSubMenu(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__DELETESUBMENU) +{ +} + + +DeleteSubMenu::DeleteSubMenu(const DeleteSubMenu& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__DELETESUBMENU,c.getId()) +{ + *this=c; +} + + +unsigned int DeleteSubMenu::get_menuId(void) +{ + return menuId; +} + +bool DeleteSubMenu::set_menuId(unsigned int menuId_) +{ + menuId=menuId_; + return true; +} + +int DeleteSubMenu::get_appId(void) +{ + return appId; +} + +bool DeleteSubMenu::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool DeleteSubMenu::checkIntegrity(void) +{ + return DeleteSubMenuMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteSubMenuMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteSubMenuMarshaller.cpp new file mode 100644 index 000000000..564d0902e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteSubMenuMarshaller.cpp @@ -0,0 +1,129 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DeleteSubMenu.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/DeleteSubMenuMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool DeleteSubMenuMarshaller::checkIntegrity(DeleteSubMenu& s) +{ + return checkIntegrityConst(s); +} + + +bool DeleteSubMenuMarshaller::fromString(const std::string& s,DeleteSubMenu& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string DeleteSubMenuMarshaller::toString(const DeleteSubMenu& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool DeleteSubMenuMarshaller::checkIntegrityConst(const DeleteSubMenu& s) +{ + if(s.menuId>2000000000) return false; + + return true; +} + + +Json::Value DeleteSubMenuMarshaller::toJSON(const DeleteSubMenu& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.DeleteSubMenu"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["menuId"]=Json::Value(e.menuId);; + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool DeleteSubMenuMarshaller::fromJSON(const Json::Value& json,DeleteSubMenu& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.DeleteSubMenu")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(!js.isMember("menuId") || !js["menuId"].isInt()) return false; + c.menuId=js["menuId"].asInt(); + if(c.menuId>2000000000) return false; + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteSubMenuMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteSubMenuMarshaller.h new file mode 100644 index 000000000..348720175 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteSubMenuMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_DELETESUBMENUMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_DELETESUBMENUMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DeleteSubMenu.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct DeleteSubMenuMarshaller + { + static bool checkIntegrity(DeleteSubMenu& e); + static bool checkIntegrityConst(const DeleteSubMenu& e); + + static bool fromString(const std::string& s,DeleteSubMenu& e); + static const std::string toString(const DeleteSubMenu& e); + + static bool fromJSON(const Json::Value& s,DeleteSubMenu& e); + static Json::Value toJSON(const DeleteSubMenu& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteSubMenuResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteSubMenuResponse.cpp new file mode 100644 index 000000000..818e52032 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteSubMenuResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DeleteSubMenuResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +DeleteSubMenuResponse& DeleteSubMenuResponse::operator =(const DeleteSubMenuResponse& c) +{ + return *this; +} + + +DeleteSubMenuResponse::~DeleteSubMenuResponse(void) +{ +} + + +DeleteSubMenuResponse::DeleteSubMenuResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__DELETESUBMENURESPONSE) +{ +} + + +DeleteSubMenuResponse::DeleteSubMenuResponse(const DeleteSubMenuResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__DELETESUBMENURESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool DeleteSubMenuResponse::checkIntegrity(void) +{ + return DeleteSubMenuResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteSubMenuResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteSubMenuResponseMarshaller.cpp new file mode 100644 index 000000000..acc82de87 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteSubMenuResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DeleteSubMenuResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/DeleteSubMenuResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool DeleteSubMenuResponseMarshaller::checkIntegrity(DeleteSubMenuResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool DeleteSubMenuResponseMarshaller::fromString(const std::string& s,DeleteSubMenuResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string DeleteSubMenuResponseMarshaller::toString(const DeleteSubMenuResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool DeleteSubMenuResponseMarshaller::checkIntegrityConst(const DeleteSubMenuResponse& s) +{ + return true; +} + + +Json::Value DeleteSubMenuResponseMarshaller::toJSON(const DeleteSubMenuResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.DeleteSubMenuResponse"); + + return json; +} + + +bool DeleteSubMenuResponseMarshaller::fromJSON(const Json::Value& json,DeleteSubMenuResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.DeleteSubMenuResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteSubMenuResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteSubMenuResponseMarshaller.h new file mode 100644 index 000000000..52ea48acb --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DeleteSubMenuResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_DELETESUBMENURESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_DELETESUBMENURESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DeleteSubMenuResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct DeleteSubMenuResponseMarshaller + { + static bool checkIntegrity(DeleteSubMenuResponse& e); + static bool checkIntegrityConst(const DeleteSubMenuResponse& e); + + static bool fromString(const std::string& s,DeleteSubMenuResponse& e); + static const std::string toString(const DeleteSubMenuResponse& e); + + static bool fromJSON(const Json::Value& s,DeleteSubMenuResponse& e); + static Json::Value toJSON(const DeleteSubMenuResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DialNumber.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DialNumber.cpp new file mode 100644 index 000000000..a897f23d0 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DialNumber.cpp @@ -0,0 +1,97 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DialNumber.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +DialNumber& DialNumber::operator =(const DialNumber& c) +{ + number=c.number; + appId=c.appId; + return *this; +} + + +DialNumber::~DialNumber(void) +{ +} + + +DialNumber::DialNumber(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__DIALNUMBER) +{ +} + + +DialNumber::DialNumber(const DialNumber& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__DIALNUMBER,c.getId()) +{ + *this=c; +} + + +const std::string& DialNumber::get_number(void) +{ + return number; +} + +bool DialNumber::set_number(const std::string& number_) +{ + number=number_; + return true; +} + +int DialNumber::get_appId(void) +{ + return appId; +} + +bool DialNumber::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool DialNumber::checkIntegrity(void) +{ + return DialNumberMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DialNumberMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DialNumberMarshaller.cpp new file mode 100644 index 000000000..409658320 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DialNumberMarshaller.cpp @@ -0,0 +1,129 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DialNumber.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/DialNumberMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool DialNumberMarshaller::checkIntegrity(DialNumber& s) +{ + return checkIntegrityConst(s); +} + + +bool DialNumberMarshaller::fromString(const std::string& s,DialNumber& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string DialNumberMarshaller::toString(const DialNumber& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool DialNumberMarshaller::checkIntegrityConst(const DialNumber& s) +{ + if(s.number.length()>500) return false; + + return true; +} + + +Json::Value DialNumberMarshaller::toJSON(const DialNumber& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.DialNumber"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["number"]=Json::Value(e.number);; + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool DialNumberMarshaller::fromJSON(const Json::Value& json,DialNumber& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.DialNumber")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(!js.isMember("number") || !js["number"].isString()) return false; + c.number=js["number"].asString(); + if(c.number.length()>500) return false; + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DialNumberMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DialNumberMarshaller.h new file mode 100644 index 000000000..58ae4033b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DialNumberMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_DIALNUMBERMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_DIALNUMBERMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DialNumber.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct DialNumberMarshaller + { + static bool checkIntegrity(DialNumber& e); + static bool checkIntegrityConst(const DialNumber& e); + + static bool fromString(const std::string& s,DialNumber& e); + static const std::string toString(const DialNumber& e); + + static bool fromJSON(const Json::Value& s,DialNumber& e); + static Json::Value toJSON(const DialNumber& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DialNumberResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DialNumberResponse.cpp new file mode 100644 index 000000000..fe6963ce3 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DialNumberResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DialNumberResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +DialNumberResponse& DialNumberResponse::operator =(const DialNumberResponse& c) +{ + return *this; +} + + +DialNumberResponse::~DialNumberResponse(void) +{ +} + + +DialNumberResponse::DialNumberResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__DIALNUMBERRESPONSE) +{ +} + + +DialNumberResponse::DialNumberResponse(const DialNumberResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__DIALNUMBERRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool DialNumberResponse::checkIntegrity(void) +{ + return DialNumberResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DialNumberResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DialNumberResponseMarshaller.cpp new file mode 100644 index 000000000..062df7e7a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DialNumberResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DialNumberResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/DialNumberResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool DialNumberResponseMarshaller::checkIntegrity(DialNumberResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool DialNumberResponseMarshaller::fromString(const std::string& s,DialNumberResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string DialNumberResponseMarshaller::toString(const DialNumberResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool DialNumberResponseMarshaller::checkIntegrityConst(const DialNumberResponse& s) +{ + return true; +} + + +Json::Value DialNumberResponseMarshaller::toJSON(const DialNumberResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.DialNumberResponse"); + + return json; +} + + +bool DialNumberResponseMarshaller::fromJSON(const Json::Value& json,DialNumberResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.DialNumberResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DialNumberResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DialNumberResponseMarshaller.h new file mode 100644 index 000000000..df442bd4e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/DialNumberResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_DIALNUMBERRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_DIALNUMBERRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/DialNumberResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct DialNumberResponseMarshaller + { + static bool checkIntegrity(DialNumberResponse& e); + static bool checkIntegrityConst(const DialNumberResponse& e); + + static bool fromString(const std::string& s,DialNumberResponse& e); + static const std::string toString(const DialNumberResponse& e); + + static bool fromJSON(const Json::Value& s,DialNumberResponse& e); + static Json::Value toJSON(const DialNumberResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/EndAudioPassThru.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/EndAudioPassThru.cpp new file mode 100644 index 000000000..6da0b38d5 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/EndAudioPassThru.cpp @@ -0,0 +1,85 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/EndAudioPassThru.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +EndAudioPassThru& EndAudioPassThru::operator =(const EndAudioPassThru& c) +{ + appId=c.appId; + return *this; +} + + +EndAudioPassThru::~EndAudioPassThru(void) +{ +} + + +EndAudioPassThru::EndAudioPassThru(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ENDAUDIOPASSTHRU) +{ +} + + +EndAudioPassThru::EndAudioPassThru(const EndAudioPassThru& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ENDAUDIOPASSTHRU,c.getId()) +{ + *this=c; +} + + +int EndAudioPassThru::get_appId(void) +{ + return appId; +} + +bool EndAudioPassThru::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool EndAudioPassThru::checkIntegrity(void) +{ + return EndAudioPassThruMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/EndAudioPassThruMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/EndAudioPassThruMarshaller.cpp new file mode 100644 index 000000000..23495dde7 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/EndAudioPassThruMarshaller.cpp @@ -0,0 +1,122 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/EndAudioPassThru.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/EndAudioPassThruMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool EndAudioPassThruMarshaller::checkIntegrity(EndAudioPassThru& s) +{ + return checkIntegrityConst(s); +} + + +bool EndAudioPassThruMarshaller::fromString(const std::string& s,EndAudioPassThru& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string EndAudioPassThruMarshaller::toString(const EndAudioPassThru& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool EndAudioPassThruMarshaller::checkIntegrityConst(const EndAudioPassThru& s) +{ + return true; +} + + +Json::Value EndAudioPassThruMarshaller::toJSON(const EndAudioPassThru& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.EndAudioPassThru"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool EndAudioPassThruMarshaller::fromJSON(const Json::Value& json,EndAudioPassThru& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.EndAudioPassThru")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/EndAudioPassThruMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/EndAudioPassThruMarshaller.h new file mode 100644 index 000000000..5c1649272 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/EndAudioPassThruMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_ENDAUDIOPASSTHRUMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_ENDAUDIOPASSTHRUMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/EndAudioPassThru.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct EndAudioPassThruMarshaller + { + static bool checkIntegrity(EndAudioPassThru& e); + static bool checkIntegrityConst(const EndAudioPassThru& e); + + static bool fromString(const std::string& s,EndAudioPassThru& e); + static const std::string toString(const EndAudioPassThru& e); + + static bool fromJSON(const Json::Value& s,EndAudioPassThru& e); + static Json::Value toJSON(const EndAudioPassThru& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/EndAudioPassThruResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/EndAudioPassThruResponse.cpp new file mode 100644 index 000000000..82d04ef74 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/EndAudioPassThruResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/EndAudioPassThruResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +EndAudioPassThruResponse& EndAudioPassThruResponse::operator =(const EndAudioPassThruResponse& c) +{ + return *this; +} + + +EndAudioPassThruResponse::~EndAudioPassThruResponse(void) +{ +} + + +EndAudioPassThruResponse::EndAudioPassThruResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ENDAUDIOPASSTHRURESPONSE) +{ +} + + +EndAudioPassThruResponse::EndAudioPassThruResponse(const EndAudioPassThruResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ENDAUDIOPASSTHRURESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool EndAudioPassThruResponse::checkIntegrity(void) +{ + return EndAudioPassThruResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/EndAudioPassThruResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/EndAudioPassThruResponseMarshaller.cpp new file mode 100644 index 000000000..dd5399fc5 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/EndAudioPassThruResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/EndAudioPassThruResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/EndAudioPassThruResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool EndAudioPassThruResponseMarshaller::checkIntegrity(EndAudioPassThruResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool EndAudioPassThruResponseMarshaller::fromString(const std::string& s,EndAudioPassThruResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string EndAudioPassThruResponseMarshaller::toString(const EndAudioPassThruResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool EndAudioPassThruResponseMarshaller::checkIntegrityConst(const EndAudioPassThruResponse& s) +{ + return true; +} + + +Json::Value EndAudioPassThruResponseMarshaller::toJSON(const EndAudioPassThruResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.EndAudioPassThruResponse"); + + return json; +} + + +bool EndAudioPassThruResponseMarshaller::fromJSON(const Json::Value& json,EndAudioPassThruResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.EndAudioPassThruResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/EndAudioPassThruResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/EndAudioPassThruResponseMarshaller.h new file mode 100644 index 000000000..f4990c054 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/EndAudioPassThruResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_ENDAUDIOPASSTHRURESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_ENDAUDIOPASSTHRURESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/EndAudioPassThruResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct EndAudioPassThruResponseMarshaller + { + static bool checkIntegrity(EndAudioPassThruResponse& e); + static bool checkIntegrityConst(const EndAudioPassThruResponse& e); + + static bool fromString(const std::string& s,EndAudioPassThruResponse& e); + static const std::string toString(const EndAudioPassThruResponse& e); + + static bool fromJSON(const Json::Value& s,EndAudioPassThruResponse& e); + static Json::Value toJSON(const EndAudioPassThruResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetCapabilities.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetCapabilities.cpp new file mode 100644 index 000000000..ed2176a3a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetCapabilities.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/GetCapabilities.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +GetCapabilities& GetCapabilities::operator =(const GetCapabilities& c) +{ + return *this; +} + + +GetCapabilities::~GetCapabilities(void) +{ +} + + +GetCapabilities::GetCapabilities(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__GETCAPABILITIES) +{ +} + + +GetCapabilities::GetCapabilities(const GetCapabilities& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__GETCAPABILITIES,c.getId()) +{ + *this=c; +} + + +bool GetCapabilities::checkIntegrity(void) +{ + return GetCapabilitiesMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetCapabilitiesMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetCapabilitiesMarshaller.cpp new file mode 100644 index 000000000..9a19ca9c2 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetCapabilitiesMarshaller.cpp @@ -0,0 +1,113 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/GetCapabilities.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/GetCapabilitiesMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool GetCapabilitiesMarshaller::checkIntegrity(GetCapabilities& s) +{ + return checkIntegrityConst(s); +} + + +bool GetCapabilitiesMarshaller::fromString(const std::string& s,GetCapabilities& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string GetCapabilitiesMarshaller::toString(const GetCapabilities& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool GetCapabilitiesMarshaller::checkIntegrityConst(const GetCapabilities& s) +{ + return true; +} + + +Json::Value GetCapabilitiesMarshaller::toJSON(const GetCapabilities& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.GetCapabilities"); + + json["id"]=Json::Value(e.getId()); + return json; +} + + +bool GetCapabilitiesMarshaller::fromJSON(const Json::Value& json,GetCapabilities& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.GetCapabilities")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetCapabilitiesMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetCapabilitiesMarshaller.h new file mode 100644 index 000000000..390510e68 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetCapabilitiesMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_GETCAPABILITIESMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_GETCAPABILITIESMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/GetCapabilities.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct GetCapabilitiesMarshaller + { + static bool checkIntegrity(GetCapabilities& e); + static bool checkIntegrityConst(const GetCapabilities& e); + + static bool fromString(const std::string& s,GetCapabilities& e); + static const std::string toString(const GetCapabilities& e); + + static bool fromJSON(const Json::Value& s,GetCapabilities& e); + static Json::Value toJSON(const GetCapabilities& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetCapabilitiesResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetCapabilitiesResponse.cpp new file mode 100644 index 000000000..204f6450a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetCapabilitiesResponse.cpp @@ -0,0 +1,119 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/GetCapabilitiesResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +GetCapabilitiesResponse& GetCapabilitiesResponse::operator =(const GetCapabilitiesResponse& c) +{ + displayCapabilities=c.displayCapabilities; + hmiZoneCapabilities=c.hmiZoneCapabilities; + if(softButtonCapabilities) delete softButtonCapabilities; + softButtonCapabilities= c.softButtonCapabilities ? new std::vector<NsSmartDeviceLinkRPCV2::SoftButtonCapabilities>(c.softButtonCapabilities[0]) : 0; + return *this; +} + + +GetCapabilitiesResponse::~GetCapabilitiesResponse(void) +{ + if(softButtonCapabilities) delete softButtonCapabilities; +} + + +GetCapabilitiesResponse::GetCapabilitiesResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__GETCAPABILITIESRESPONSE), + softButtonCapabilities(0) +{ +} + + +GetCapabilitiesResponse::GetCapabilitiesResponse(const GetCapabilitiesResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__GETCAPABILITIESRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::DisplayCapabilities& GetCapabilitiesResponse::get_displayCapabilities(void) +{ + return displayCapabilities; +} + +bool GetCapabilitiesResponse::set_displayCapabilities(const NsSmartDeviceLinkRPCV2::DisplayCapabilities& displayCapabilities_) +{ + displayCapabilities=displayCapabilities_; + return true; +} + +const std::vector< NsSmartDeviceLinkRPCV2::HmiZoneCapabilities>& GetCapabilitiesResponse::get_hmiZoneCapabilities(void) +{ + return hmiZoneCapabilities; +} + +bool GetCapabilitiesResponse::set_hmiZoneCapabilities(const std::vector< NsSmartDeviceLinkRPCV2::HmiZoneCapabilities>& hmiZoneCapabilities_) +{ + hmiZoneCapabilities=hmiZoneCapabilities_; + return true; +} + +const std::vector< NsSmartDeviceLinkRPCV2::SoftButtonCapabilities>* GetCapabilitiesResponse::get_softButtonCapabilities(void) +{ + return softButtonCapabilities; +} + +bool GetCapabilitiesResponse::set_softButtonCapabilities(const std::vector< NsSmartDeviceLinkRPCV2::SoftButtonCapabilities>& softButtonCapabilities_) +{ + if(softButtonCapabilities) delete softButtonCapabilities; + softButtonCapabilities=new std::vector< NsSmartDeviceLinkRPCV2::SoftButtonCapabilities>(softButtonCapabilities_); + return true; +} + +void GetCapabilitiesResponse::reset_softButtonCapabilities(void) +{ + if(softButtonCapabilities) delete softButtonCapabilities; + softButtonCapabilities=0; +} + +bool GetCapabilitiesResponse::checkIntegrity(void) +{ + return GetCapabilitiesResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetCapabilitiesResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetCapabilitiesResponseMarshaller.cpp new file mode 100644 index 000000000..c6ee9c41e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetCapabilitiesResponseMarshaller.cpp @@ -0,0 +1,199 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/GetCapabilitiesResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/DisplayCapabilitiesMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/HmiZoneCapabilitiesMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/SoftButtonCapabilitiesMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/GetCapabilitiesResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool GetCapabilitiesResponseMarshaller::checkIntegrity(GetCapabilitiesResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool GetCapabilitiesResponseMarshaller::fromString(const std::string& s,GetCapabilitiesResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string GetCapabilitiesResponseMarshaller::toString(const GetCapabilitiesResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool GetCapabilitiesResponseMarshaller::checkIntegrityConst(const GetCapabilitiesResponse& s) +{ + if(!NsSmartDeviceLinkRPCV2::DisplayCapabilitiesMarshaller::checkIntegrityConst(s.displayCapabilities)) return false; + + { + unsigned int i=s.hmiZoneCapabilities.size(); + if(i<1) return false; + if(i>100) return false; + } + + if(s.softButtonCapabilities) + { + unsigned int i=s.softButtonCapabilities[0].size(); + if(i<1) return false; + if(i>100) return false; + } + + return true; +} + + +Json::Value GetCapabilitiesResponseMarshaller::toJSON(const GetCapabilitiesResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.GetCapabilitiesResponse"); + + json["result"]["displayCapabilities"]=NsSmartDeviceLinkRPCV2::DisplayCapabilitiesMarshaller::toJSON(e.displayCapabilities);; + { + unsigned int i=e.hmiZoneCapabilities.size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::HmiZoneCapabilitiesMarshaller::toJSON(e.hmiZoneCapabilities[i]); + + json["result"]["hmiZoneCapabilities"]=j; + } + if(e.softButtonCapabilities) + { + unsigned int i=e.softButtonCapabilities[0].size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::SoftButtonCapabilitiesMarshaller::toJSON(e.softButtonCapabilities[0][i]); + + json["result"]["softButtonCapabilities"]=j; + } + return json; +} + + +bool GetCapabilitiesResponseMarshaller::fromJSON(const Json::Value& json,GetCapabilitiesResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.GetCapabilitiesResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + if(!js.isMember("displayCapabilities") || !NsSmartDeviceLinkRPCV2::DisplayCapabilitiesMarshaller::fromJSON(js["displayCapabilities"],c.displayCapabilities)) return false; + + if(!js.isMember("hmiZoneCapabilities") || !js["hmiZoneCapabilities"].isArray()) return false; + { + unsigned int i=js["hmiZoneCapabilities"].size(); + if(i<1) return false; + if(i>100) return false; + c.hmiZoneCapabilities.resize(i); + while(i--) + { + NsSmartDeviceLinkRPCV2::HmiZoneCapabilities t; + if(!NsSmartDeviceLinkRPCV2::HmiZoneCapabilitiesMarshaller::fromJSON(js["hmiZoneCapabilities"][i],t)) + return false; + c.hmiZoneCapabilities[i]=t; + } + } + + if(c.softButtonCapabilities) delete c.softButtonCapabilities; + c.softButtonCapabilities=0; + if(js.isMember("softButtonCapabilities")) + { + if(!js["softButtonCapabilities"].isArray()) return false; + unsigned int i=js["softButtonCapabilities"].size(); + if(i<1) return false; + if(i>100) return false; + + c.softButtonCapabilities=new std::vector<NsSmartDeviceLinkRPCV2::SoftButtonCapabilities>(); + c.softButtonCapabilities->resize(js["softButtonCapabilities"].size()); + + while(i--) + if(!NsSmartDeviceLinkRPCV2::SoftButtonCapabilitiesMarshaller::fromJSON(js["softButtonCapabilities"][i],c.softButtonCapabilities[0][i])) return false; + } + + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetCapabilitiesResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetCapabilitiesResponseMarshaller.h new file mode 100644 index 000000000..1eeeaf76f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetCapabilitiesResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_GETCAPABILITIESRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_GETCAPABILITIESRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/GetCapabilitiesResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct GetCapabilitiesResponseMarshaller + { + static bool checkIntegrity(GetCapabilitiesResponse& e); + static bool checkIntegrityConst(const GetCapabilitiesResponse& e); + + static bool fromString(const std::string& s,GetCapabilitiesResponse& e); + static const std::string toString(const GetCapabilitiesResponse& e); + + static bool fromJSON(const Json::Value& s,GetCapabilitiesResponse& e); + static Json::Value toJSON(const GetCapabilitiesResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetLanguage.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetLanguage.cpp new file mode 100644 index 000000000..36e740f20 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetLanguage.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/GetLanguage.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +GetLanguage& GetLanguage::operator =(const GetLanguage& c) +{ + return *this; +} + + +GetLanguage::~GetLanguage(void) +{ +} + + +GetLanguage::GetLanguage(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__GETLANGUAGE) +{ +} + + +GetLanguage::GetLanguage(const GetLanguage& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__GETLANGUAGE,c.getId()) +{ + *this=c; +} + + +bool GetLanguage::checkIntegrity(void) +{ + return GetLanguageMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetLanguageMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetLanguageMarshaller.cpp new file mode 100644 index 000000000..1310baef3 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetLanguageMarshaller.cpp @@ -0,0 +1,113 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/GetLanguage.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/GetLanguageMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool GetLanguageMarshaller::checkIntegrity(GetLanguage& s) +{ + return checkIntegrityConst(s); +} + + +bool GetLanguageMarshaller::fromString(const std::string& s,GetLanguage& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string GetLanguageMarshaller::toString(const GetLanguage& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool GetLanguageMarshaller::checkIntegrityConst(const GetLanguage& s) +{ + return true; +} + + +Json::Value GetLanguageMarshaller::toJSON(const GetLanguage& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.GetLanguage"); + + json["id"]=Json::Value(e.getId()); + return json; +} + + +bool GetLanguageMarshaller::fromJSON(const Json::Value& json,GetLanguage& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.GetLanguage")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetLanguageMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetLanguageMarshaller.h new file mode 100644 index 000000000..03ed2fded --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetLanguageMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_GETLANGUAGEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_GETLANGUAGEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/GetLanguage.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct GetLanguageMarshaller + { + static bool checkIntegrity(GetLanguage& e); + static bool checkIntegrityConst(const GetLanguage& e); + + static bool fromString(const std::string& s,GetLanguage& e); + static const std::string toString(const GetLanguage& e); + + static bool fromJSON(const Json::Value& s,GetLanguage& e); + static Json::Value toJSON(const GetLanguage& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetLanguageResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetLanguageResponse.cpp new file mode 100644 index 000000000..72e118ac9 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetLanguageResponse.cpp @@ -0,0 +1,85 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/GetLanguageResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +GetLanguageResponse& GetLanguageResponse::operator =(const GetLanguageResponse& c) +{ + hmiDisplayLanguage=c.hmiDisplayLanguage; + return *this; +} + + +GetLanguageResponse::~GetLanguageResponse(void) +{ +} + + +GetLanguageResponse::GetLanguageResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__GETLANGUAGERESPONSE) +{ +} + + +GetLanguageResponse::GetLanguageResponse(const GetLanguageResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__GETLANGUAGERESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::Language& GetLanguageResponse::get_hmiDisplayLanguage(void) +{ + return hmiDisplayLanguage; +} + +bool GetLanguageResponse::set_hmiDisplayLanguage(const NsSmartDeviceLinkRPCV2::Language& hmiDisplayLanguage_) +{ + hmiDisplayLanguage=hmiDisplayLanguage_; + return true; +} + +bool GetLanguageResponse::checkIntegrity(void) +{ + return GetLanguageResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetLanguageResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetLanguageResponseMarshaller.cpp new file mode 100644 index 000000000..e4f04dfa1 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetLanguageResponseMarshaller.cpp @@ -0,0 +1,133 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/GetLanguageResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/LanguageMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/GetLanguageResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool GetLanguageResponseMarshaller::checkIntegrity(GetLanguageResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool GetLanguageResponseMarshaller::fromString(const std::string& s,GetLanguageResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string GetLanguageResponseMarshaller::toString(const GetLanguageResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool GetLanguageResponseMarshaller::checkIntegrityConst(const GetLanguageResponse& s) +{ + if(!NsSmartDeviceLinkRPCV2::LanguageMarshaller::checkIntegrityConst(s.hmiDisplayLanguage)) return false; + + return true; +} + + +Json::Value GetLanguageResponseMarshaller::toJSON(const GetLanguageResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.GetLanguageResponse"); + + json["result"]["hmiDisplayLanguage"]=NsSmartDeviceLinkRPCV2::LanguageMarshaller::toJSON(e.hmiDisplayLanguage);; + return json; +} + + +bool GetLanguageResponseMarshaller::fromJSON(const Json::Value& json,GetLanguageResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.GetLanguageResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + if(!js.isMember("hmiDisplayLanguage") || !NsSmartDeviceLinkRPCV2::LanguageMarshaller::fromJSON(js["hmiDisplayLanguage"],c.hmiDisplayLanguage)) return false; + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetLanguageResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetLanguageResponseMarshaller.h new file mode 100644 index 000000000..01e9fada2 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetLanguageResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_GETLANGUAGERESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_GETLANGUAGERESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/GetLanguageResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct GetLanguageResponseMarshaller + { + static bool checkIntegrity(GetLanguageResponse& e); + static bool checkIntegrityConst(const GetLanguageResponse& e); + + static bool fromString(const std::string& s,GetLanguageResponse& e); + static const std::string toString(const GetLanguageResponse& e); + + static bool fromJSON(const Json::Value& s,GetLanguageResponse& e); + static Json::Value toJSON(const GetLanguageResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetSupportedLanguages.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetSupportedLanguages.cpp new file mode 100644 index 000000000..b68b5462e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetSupportedLanguages.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/GetSupportedLanguages.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +GetSupportedLanguages& GetSupportedLanguages::operator =(const GetSupportedLanguages& c) +{ + return *this; +} + + +GetSupportedLanguages::~GetSupportedLanguages(void) +{ +} + + +GetSupportedLanguages::GetSupportedLanguages(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__GETSUPPORTEDLANGUAGES) +{ +} + + +GetSupportedLanguages::GetSupportedLanguages(const GetSupportedLanguages& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__GETSUPPORTEDLANGUAGES,c.getId()) +{ + *this=c; +} + + +bool GetSupportedLanguages::checkIntegrity(void) +{ + return GetSupportedLanguagesMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetSupportedLanguagesMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetSupportedLanguagesMarshaller.cpp new file mode 100644 index 000000000..1aa123469 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetSupportedLanguagesMarshaller.cpp @@ -0,0 +1,113 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/GetSupportedLanguages.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/GetSupportedLanguagesMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool GetSupportedLanguagesMarshaller::checkIntegrity(GetSupportedLanguages& s) +{ + return checkIntegrityConst(s); +} + + +bool GetSupportedLanguagesMarshaller::fromString(const std::string& s,GetSupportedLanguages& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string GetSupportedLanguagesMarshaller::toString(const GetSupportedLanguages& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool GetSupportedLanguagesMarshaller::checkIntegrityConst(const GetSupportedLanguages& s) +{ + return true; +} + + +Json::Value GetSupportedLanguagesMarshaller::toJSON(const GetSupportedLanguages& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.GetSupportedLanguages"); + + json["id"]=Json::Value(e.getId()); + return json; +} + + +bool GetSupportedLanguagesMarshaller::fromJSON(const Json::Value& json,GetSupportedLanguages& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.GetSupportedLanguages")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetSupportedLanguagesMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetSupportedLanguagesMarshaller.h new file mode 100644 index 000000000..e518431b4 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetSupportedLanguagesMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_GETSUPPORTEDLANGUAGESMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_GETSUPPORTEDLANGUAGESMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/GetSupportedLanguages.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct GetSupportedLanguagesMarshaller + { + static bool checkIntegrity(GetSupportedLanguages& e); + static bool checkIntegrityConst(const GetSupportedLanguages& e); + + static bool fromString(const std::string& s,GetSupportedLanguages& e); + static const std::string toString(const GetSupportedLanguages& e); + + static bool fromJSON(const Json::Value& s,GetSupportedLanguages& e); + static Json::Value toJSON(const GetSupportedLanguages& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetSupportedLanguagesResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetSupportedLanguagesResponse.cpp new file mode 100644 index 000000000..3ead1761c --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetSupportedLanguagesResponse.cpp @@ -0,0 +1,85 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/GetSupportedLanguagesResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +GetSupportedLanguagesResponse& GetSupportedLanguagesResponse::operator =(const GetSupportedLanguagesResponse& c) +{ + languages=c.languages; + return *this; +} + + +GetSupportedLanguagesResponse::~GetSupportedLanguagesResponse(void) +{ +} + + +GetSupportedLanguagesResponse::GetSupportedLanguagesResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__GETSUPPORTEDLANGUAGESRESPONSE) +{ +} + + +GetSupportedLanguagesResponse::GetSupportedLanguagesResponse(const GetSupportedLanguagesResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__GETSUPPORTEDLANGUAGESRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +const std::vector< NsSmartDeviceLinkRPCV2::Language>& GetSupportedLanguagesResponse::get_languages(void) +{ + return languages; +} + +bool GetSupportedLanguagesResponse::set_languages(const std::vector< NsSmartDeviceLinkRPCV2::Language>& languages_) +{ + languages=languages_; + return true; +} + +bool GetSupportedLanguagesResponse::checkIntegrity(void) +{ + return GetSupportedLanguagesResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetSupportedLanguagesResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetSupportedLanguagesResponseMarshaller.cpp new file mode 100644 index 000000000..6c947feb1 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetSupportedLanguagesResponseMarshaller.cpp @@ -0,0 +1,158 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/GetSupportedLanguagesResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/LanguageMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/GetSupportedLanguagesResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool GetSupportedLanguagesResponseMarshaller::checkIntegrity(GetSupportedLanguagesResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool GetSupportedLanguagesResponseMarshaller::fromString(const std::string& s,GetSupportedLanguagesResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string GetSupportedLanguagesResponseMarshaller::toString(const GetSupportedLanguagesResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool GetSupportedLanguagesResponseMarshaller::checkIntegrityConst(const GetSupportedLanguagesResponse& s) +{ + { + unsigned int i=s.languages.size(); + if(i<1) return false; + if(i>100) return false; + } + + return true; +} + + +Json::Value GetSupportedLanguagesResponseMarshaller::toJSON(const GetSupportedLanguagesResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.GetSupportedLanguagesResponse"); + + { + unsigned int i=e.languages.size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::LanguageMarshaller::toJSON(e.languages[i]); + + json["result"]["languages"]=j; + } + return json; +} + + +bool GetSupportedLanguagesResponseMarshaller::fromJSON(const Json::Value& json,GetSupportedLanguagesResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.GetSupportedLanguagesResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + if(!js.isMember("languages") || !js["languages"].isArray()) return false; + { + unsigned int i=js["languages"].size(); + if(i<1) return false; + if(i>100) return false; + c.languages.resize(i); + while(i--) + { + NsSmartDeviceLinkRPCV2::Language t; + if(!NsSmartDeviceLinkRPCV2::LanguageMarshaller::fromJSON(js["languages"][i],t)) + return false; + c.languages[i]=t; + } + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetSupportedLanguagesResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetSupportedLanguagesResponseMarshaller.h new file mode 100644 index 000000000..f0d17f125 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/GetSupportedLanguagesResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_GETSUPPORTEDLANGUAGESRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_GETSUPPORTEDLANGUAGESRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/GetSupportedLanguagesResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct GetSupportedLanguagesResponseMarshaller + { + static bool checkIntegrity(GetSupportedLanguagesResponse& e); + static bool checkIntegrityConst(const GetSupportedLanguagesResponse& e); + + static bool fromString(const std::string& s,GetSupportedLanguagesResponse& e); + static const std::string toString(const GetSupportedLanguagesResponse& e); + + static bool fromJSON(const Json::Value& s,GetSupportedLanguagesResponse& e); + static Json::Value toJSON(const GetSupportedLanguagesResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnCommand.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnCommand.cpp new file mode 100644 index 000000000..07fb31b9b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnCommand.cpp @@ -0,0 +1,97 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnCommand.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +OnCommand& OnCommand::operator =(const OnCommand& c) +{ + commandId=c.commandId; + appId=c.appId; + return *this; +} + + +OnCommand::~OnCommand(void) +{ +} + + +OnCommand::OnCommand(void) : + RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ONCOMMAND) +{ +} + + +OnCommand::OnCommand(const OnCommand& c) : RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ONCOMMAND) +{ + *this=c; +} + + +unsigned int OnCommand::get_commandId(void) +{ + return commandId; +} + +bool OnCommand::set_commandId(unsigned int commandId_) +{ + commandId=commandId_; + return true; +} + +int OnCommand::get_appId(void) +{ + return appId; +} + +bool OnCommand::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool OnCommand::checkIntegrity(void) +{ + return OnCommandMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnCommandMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnCommandMarshaller.cpp new file mode 100644 index 000000000..a9cddfd63 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnCommandMarshaller.cpp @@ -0,0 +1,126 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnCommand.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/OnCommandMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool OnCommandMarshaller::checkIntegrity(OnCommand& s) +{ + return checkIntegrityConst(s); +} + + +bool OnCommandMarshaller::fromString(const std::string& s,OnCommand& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string OnCommandMarshaller::toString(const OnCommand& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool OnCommandMarshaller::checkIntegrityConst(const OnCommand& s) +{ + if(s.commandId>2000000000) return false; + + return true; +} + + +Json::Value OnCommandMarshaller::toJSON(const OnCommand& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.OnCommand"); + json["params"]=Json::Value(Json::objectValue); + + json["params"]["commandId"]=Json::Value(e.commandId);; + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool OnCommandMarshaller::fromJSON(const Json::Value& json,OnCommand& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.OnCommand")) return false; + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + + if(!js.isMember("commandId") || !js["commandId"].isInt()) return false; + c.commandId=js["commandId"].asInt(); + if(c.commandId>2000000000) return false; + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnCommandMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnCommandMarshaller.h new file mode 100644 index 000000000..452bc9023 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnCommandMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_ONCOMMANDMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_ONCOMMANDMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnCommand.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct OnCommandMarshaller + { + static bool checkIntegrity(OnCommand& e); + static bool checkIntegrityConst(const OnCommand& e); + + static bool fromString(const std::string& s,OnCommand& e); + static const std::string toString(const OnCommand& e); + + static bool fromJSON(const Json::Value& s,OnCommand& e); + static Json::Value toJSON(const OnCommand& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnDeviceChosen.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnDeviceChosen.cpp new file mode 100644 index 000000000..64030c3ef --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnDeviceChosen.cpp @@ -0,0 +1,85 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnDeviceChosen.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +OnDeviceChosen& OnDeviceChosen::operator =(const OnDeviceChosen& c) +{ + deviceName=c.deviceName; + return *this; +} + + +OnDeviceChosen::~OnDeviceChosen(void) +{ +} + + +OnDeviceChosen::OnDeviceChosen(void) : + RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ONDEVICECHOSEN) +{ +} + + +OnDeviceChosen::OnDeviceChosen(const OnDeviceChosen& c) : RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ONDEVICECHOSEN) +{ + *this=c; +} + + +const std::string& OnDeviceChosen::get_deviceName(void) +{ + return deviceName; +} + +bool OnDeviceChosen::set_deviceName(const std::string& deviceName_) +{ + deviceName=deviceName_; + return true; +} + +bool OnDeviceChosen::checkIntegrity(void) +{ + return OnDeviceChosenMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnDeviceChosenMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnDeviceChosenMarshaller.cpp new file mode 100644 index 000000000..b9ce689ec --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnDeviceChosenMarshaller.cpp @@ -0,0 +1,119 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnDeviceChosen.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/OnDeviceChosenMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool OnDeviceChosenMarshaller::checkIntegrity(OnDeviceChosen& s) +{ + return checkIntegrityConst(s); +} + + +bool OnDeviceChosenMarshaller::fromString(const std::string& s,OnDeviceChosen& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string OnDeviceChosenMarshaller::toString(const OnDeviceChosen& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool OnDeviceChosenMarshaller::checkIntegrityConst(const OnDeviceChosen& s) +{ + return true; +} + + +Json::Value OnDeviceChosenMarshaller::toJSON(const OnDeviceChosen& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.OnDeviceChosen"); + json["params"]=Json::Value(Json::objectValue); + + json["params"]["deviceName"]=Json::Value(e.deviceName);; + return json; +} + + +bool OnDeviceChosenMarshaller::fromJSON(const Json::Value& json,OnDeviceChosen& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.OnDeviceChosen")) return false; + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + + if(!js.isMember("deviceName") || !js["deviceName"].isString()) return false; + c.deviceName=js["deviceName"].asString(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnDeviceChosenMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnDeviceChosenMarshaller.h new file mode 100644 index 000000000..eeb41cbad --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnDeviceChosenMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_ONDEVICECHOSENMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_ONDEVICECHOSENMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnDeviceChosen.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct OnDeviceChosenMarshaller + { + static bool checkIntegrity(OnDeviceChosen& e); + static bool checkIntegrityConst(const OnDeviceChosen& e); + + static bool fromString(const std::string& s,OnDeviceChosen& e); + static const std::string toString(const OnDeviceChosen& e); + + static bool fromJSON(const Json::Value& s,OnDeviceChosen& e); + static Json::Value toJSON(const OnDeviceChosen& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnDriverDistraction.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnDriverDistraction.cpp new file mode 100644 index 000000000..68cf2740d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnDriverDistraction.cpp @@ -0,0 +1,85 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnDriverDistraction.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +OnDriverDistraction& OnDriverDistraction::operator =(const OnDriverDistraction& c) +{ + state=c.state; + return *this; +} + + +OnDriverDistraction::~OnDriverDistraction(void) +{ +} + + +OnDriverDistraction::OnDriverDistraction(void) : + RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ONDRIVERDISTRACTION) +{ +} + + +OnDriverDistraction::OnDriverDistraction(const OnDriverDistraction& c) : RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ONDRIVERDISTRACTION) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::DriverDistractionState& OnDriverDistraction::get_state(void) +{ + return state; +} + +bool OnDriverDistraction::set_state(const NsSmartDeviceLinkRPCV2::DriverDistractionState& state_) +{ + state=state_; + return true; +} + +bool OnDriverDistraction::checkIntegrity(void) +{ + return OnDriverDistractionMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnDriverDistractionMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnDriverDistractionMarshaller.cpp new file mode 100644 index 000000000..c62901454 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnDriverDistractionMarshaller.cpp @@ -0,0 +1,121 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnDriverDistraction.h" +#include "../src/SDLRPCObjectsImpl/V2/DriverDistractionStateMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/OnDriverDistractionMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool OnDriverDistractionMarshaller::checkIntegrity(OnDriverDistraction& s) +{ + return checkIntegrityConst(s); +} + + +bool OnDriverDistractionMarshaller::fromString(const std::string& s,OnDriverDistraction& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string OnDriverDistractionMarshaller::toString(const OnDriverDistraction& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool OnDriverDistractionMarshaller::checkIntegrityConst(const OnDriverDistraction& s) +{ + if(!NsSmartDeviceLinkRPCV2::DriverDistractionStateMarshaller::checkIntegrityConst(s.state)) return false; + + return true; +} + + +Json::Value OnDriverDistractionMarshaller::toJSON(const OnDriverDistraction& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.OnDriverDistraction"); + json["params"]=Json::Value(Json::objectValue); + + json["params"]["state"]=NsSmartDeviceLinkRPCV2::DriverDistractionStateMarshaller::toJSON(e.state);; + return json; +} + + +bool OnDriverDistractionMarshaller::fromJSON(const Json::Value& json,OnDriverDistraction& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.OnDriverDistraction")) return false; + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + + if(!js.isMember("state") || !NsSmartDeviceLinkRPCV2::DriverDistractionStateMarshaller::fromJSON(js["state"],c.state)) return false; + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnDriverDistractionMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnDriverDistractionMarshaller.h new file mode 100644 index 000000000..470fe089d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnDriverDistractionMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_ONDRIVERDISTRACTIONMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_ONDRIVERDISTRACTIONMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnDriverDistraction.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct OnDriverDistractionMarshaller + { + static bool checkIntegrity(OnDriverDistraction& e); + static bool checkIntegrityConst(const OnDriverDistraction& e); + + static bool fromString(const std::string& s,OnDriverDistraction& e); + static const std::string toString(const OnDriverDistraction& e); + + static bool fromJSON(const Json::Value& s,OnDriverDistraction& e); + static Json::Value toJSON(const OnDriverDistraction& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnLanguageChange.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnLanguageChange.cpp new file mode 100644 index 000000000..0418a8f33 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnLanguageChange.cpp @@ -0,0 +1,85 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnLanguageChange.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +OnLanguageChange& OnLanguageChange::operator =(const OnLanguageChange& c) +{ + hmiDisplayLanguage=c.hmiDisplayLanguage; + return *this; +} + + +OnLanguageChange::~OnLanguageChange(void) +{ +} + + +OnLanguageChange::OnLanguageChange(void) : + RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ONLANGUAGECHANGE) +{ +} + + +OnLanguageChange::OnLanguageChange(const OnLanguageChange& c) : RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ONLANGUAGECHANGE) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::Language& OnLanguageChange::get_hmiDisplayLanguage(void) +{ + return hmiDisplayLanguage; +} + +bool OnLanguageChange::set_hmiDisplayLanguage(const NsSmartDeviceLinkRPCV2::Language& hmiDisplayLanguage_) +{ + hmiDisplayLanguage=hmiDisplayLanguage_; + return true; +} + +bool OnLanguageChange::checkIntegrity(void) +{ + return OnLanguageChangeMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnLanguageChangeMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnLanguageChangeMarshaller.cpp new file mode 100644 index 000000000..57e0b8c10 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnLanguageChangeMarshaller.cpp @@ -0,0 +1,121 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnLanguageChange.h" +#include "../src/SDLRPCObjectsImpl/V2/LanguageMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/OnLanguageChangeMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool OnLanguageChangeMarshaller::checkIntegrity(OnLanguageChange& s) +{ + return checkIntegrityConst(s); +} + + +bool OnLanguageChangeMarshaller::fromString(const std::string& s,OnLanguageChange& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string OnLanguageChangeMarshaller::toString(const OnLanguageChange& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool OnLanguageChangeMarshaller::checkIntegrityConst(const OnLanguageChange& s) +{ + if(!NsSmartDeviceLinkRPCV2::LanguageMarshaller::checkIntegrityConst(s.hmiDisplayLanguage)) return false; + + return true; +} + + +Json::Value OnLanguageChangeMarshaller::toJSON(const OnLanguageChange& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.OnLanguageChange"); + json["params"]=Json::Value(Json::objectValue); + + json["params"]["hmiDisplayLanguage"]=NsSmartDeviceLinkRPCV2::LanguageMarshaller::toJSON(e.hmiDisplayLanguage);; + return json; +} + + +bool OnLanguageChangeMarshaller::fromJSON(const Json::Value& json,OnLanguageChange& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.OnLanguageChange")) return false; + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + + if(!js.isMember("hmiDisplayLanguage") || !NsSmartDeviceLinkRPCV2::LanguageMarshaller::fromJSON(js["hmiDisplayLanguage"],c.hmiDisplayLanguage)) return false; + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnLanguageChangeMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnLanguageChangeMarshaller.h new file mode 100644 index 000000000..286ae7eb9 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnLanguageChangeMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_ONLANGUAGECHANGEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_ONLANGUAGECHANGEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnLanguageChange.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct OnLanguageChangeMarshaller + { + static bool checkIntegrity(OnLanguageChange& e); + static bool checkIntegrityConst(const OnLanguageChange& e); + + static bool fromString(const std::string& s,OnLanguageChange& e); + static const std::string toString(const OnLanguageChange& e); + + static bool fromJSON(const Json::Value& s,OnLanguageChange& e); + static Json::Value toJSON(const OnLanguageChange& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnReady.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnReady.cpp new file mode 100644 index 000000000..af4d65a2f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnReady.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnReady.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +OnReady& OnReady::operator =(const OnReady& c) +{ + return *this; +} + + +OnReady::~OnReady(void) +{ +} + + +OnReady::OnReady(void) : + RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ONREADY) +{ +} + + +OnReady::OnReady(const OnReady& c) : RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ONREADY) +{ + *this=c; +} + + +bool OnReady::checkIntegrity(void) +{ + return OnReadyMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnReadyMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnReadyMarshaller.cpp new file mode 100644 index 000000000..5fc0178cc --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnReadyMarshaller.cpp @@ -0,0 +1,109 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnReady.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/OnReadyMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool OnReadyMarshaller::checkIntegrity(OnReady& s) +{ + return checkIntegrityConst(s); +} + + +bool OnReadyMarshaller::fromString(const std::string& s,OnReady& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string OnReadyMarshaller::toString(const OnReady& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool OnReadyMarshaller::checkIntegrityConst(const OnReady& s) +{ + return true; +} + + +Json::Value OnReadyMarshaller::toJSON(const OnReady& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.OnReady"); + + return json; +} + + +bool OnReadyMarshaller::fromJSON(const Json::Value& json,OnReady& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.OnReady")) return false; + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnReadyMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnReadyMarshaller.h new file mode 100644 index 000000000..f96808e44 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnReadyMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_ONREADYMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_ONREADYMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnReady.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct OnReadyMarshaller + { + static bool checkIntegrity(OnReady& e); + static bool checkIntegrityConst(const OnReady& e); + + static bool fromString(const std::string& s,OnReady& e); + static const std::string toString(const OnReady& e); + + static bool fromJSON(const Json::Value& s,OnReady& e); + static Json::Value toJSON(const OnReady& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnSystemContext.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnSystemContext.cpp new file mode 100644 index 000000000..1b87a26be --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnSystemContext.cpp @@ -0,0 +1,85 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnSystemContext.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +OnSystemContext& OnSystemContext::operator =(const OnSystemContext& c) +{ + systemContext=c.systemContext; + return *this; +} + + +OnSystemContext::~OnSystemContext(void) +{ +} + + +OnSystemContext::OnSystemContext(void) : + RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ONSYSTEMCONTEXT) +{ +} + + +OnSystemContext::OnSystemContext(const OnSystemContext& c) : RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ONSYSTEMCONTEXT) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::SystemContext& OnSystemContext::get_systemContext(void) +{ + return systemContext; +} + +bool OnSystemContext::set_systemContext(const NsSmartDeviceLinkRPCV2::SystemContext& systemContext_) +{ + systemContext=systemContext_; + return true; +} + +bool OnSystemContext::checkIntegrity(void) +{ + return OnSystemContextMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnSystemContextMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnSystemContextMarshaller.cpp new file mode 100644 index 000000000..471b5330d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnSystemContextMarshaller.cpp @@ -0,0 +1,121 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnSystemContext.h" +#include "../src/SDLRPCObjectsImpl/V2/SystemContextMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/OnSystemContextMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool OnSystemContextMarshaller::checkIntegrity(OnSystemContext& s) +{ + return checkIntegrityConst(s); +} + + +bool OnSystemContextMarshaller::fromString(const std::string& s,OnSystemContext& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string OnSystemContextMarshaller::toString(const OnSystemContext& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool OnSystemContextMarshaller::checkIntegrityConst(const OnSystemContext& s) +{ + if(!NsSmartDeviceLinkRPCV2::SystemContextMarshaller::checkIntegrityConst(s.systemContext)) return false; + + return true; +} + + +Json::Value OnSystemContextMarshaller::toJSON(const OnSystemContext& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.OnSystemContext"); + json["params"]=Json::Value(Json::objectValue); + + json["params"]["systemContext"]=NsSmartDeviceLinkRPCV2::SystemContextMarshaller::toJSON(e.systemContext);; + return json; +} + + +bool OnSystemContextMarshaller::fromJSON(const Json::Value& json,OnSystemContext& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.OnSystemContext")) return false; + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + + if(!js.isMember("systemContext") || !NsSmartDeviceLinkRPCV2::SystemContextMarshaller::fromJSON(js["systemContext"],c.systemContext)) return false; + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnSystemContextMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnSystemContextMarshaller.h new file mode 100644 index 000000000..e9cece0ac --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnSystemContextMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_ONSYSTEMCONTEXTMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_ONSYSTEMCONTEXTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnSystemContext.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct OnSystemContextMarshaller + { + static bool checkIntegrity(OnSystemContext& e); + static bool checkIntegrityConst(const OnSystemContext& e); + + static bool fromString(const std::string& s,OnSystemContext& e); + static const std::string toString(const OnSystemContext& e); + + static bool fromJSON(const Json::Value& s,OnSystemContext& e); + static Json::Value toJSON(const OnSystemContext& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnTBTClientState.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnTBTClientState.cpp new file mode 100644 index 000000000..f1dce8016 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnTBTClientState.cpp @@ -0,0 +1,96 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnTBTClientState.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +OnTBTClientState& OnTBTClientState::operator =(const OnTBTClientState& c) +{ + state=c.state; + return *this; +} + + +OnTBTClientState::~OnTBTClientState(void) +{ +} + + +OnTBTClientState::OnTBTClientState(void) : + RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ONTBTCLIENTSTATE) +{ +} + + +OnTBTClientState::OnTBTClientState(const OnTBTClientState& c) : RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__ONTBTCLIENTSTATE) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::TBTState& OnTBTClientState::get_state(void) +{ + return state; +} + +bool OnTBTClientState::set_state(const NsSmartDeviceLinkRPCV2::TBTState& state_) +{ + state=state_; + return true; +} + +int OnTBTClientState::get_appId(void) +{ + return appId; +} + +bool OnTBTClientState::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool OnTBTClientState::checkIntegrity(void) +{ + return OnTBTClientStateMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnTBTClientStateMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnTBTClientStateMarshaller.cpp new file mode 100644 index 000000000..891112e8e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnTBTClientStateMarshaller.cpp @@ -0,0 +1,124 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnTBTClientState.h" +#include "../src/SDLRPCObjectsImpl/V2/TBTStateMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/OnTBTClientStateMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool OnTBTClientStateMarshaller::checkIntegrity(OnTBTClientState& s) +{ + return checkIntegrityConst(s); +} + + +bool OnTBTClientStateMarshaller::fromString(const std::string& s,OnTBTClientState& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string OnTBTClientStateMarshaller::toString(const OnTBTClientState& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool OnTBTClientStateMarshaller::checkIntegrityConst(const OnTBTClientState& s) +{ + if(!NsSmartDeviceLinkRPCV2::TBTStateMarshaller::checkIntegrityConst(s.state)) return false; + + return true; +} + + +Json::Value OnTBTClientStateMarshaller::toJSON(const OnTBTClientState& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.OnTBTClientState"); + json["params"]=Json::Value(Json::objectValue); + + json["params"]["state"]=NsSmartDeviceLinkRPCV2::TBTStateMarshaller::toJSON(e.state); + json["params"]["appId"]=Json::Value(e.appId); + return json; +} + + +bool OnTBTClientStateMarshaller::fromJSON(const Json::Value& json,OnTBTClientState& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.OnTBTClientState")) return false; + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + + if(!js.isMember("state") || !NsSmartDeviceLinkRPCV2::TBTStateMarshaller::fromJSON(js["state"],c.state)) return false; + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnTBTClientStateMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnTBTClientStateMarshaller.h new file mode 100644 index 000000000..a78e8025f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/OnTBTClientStateMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_ONTBTCLIENTSTATEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_ONTBTCLIENTSTATEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/OnTBTClientState.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct OnTBTClientStateMarshaller + { + static bool checkIntegrity(OnTBTClientState& e); + static bool checkIntegrityConst(const OnTBTClientState& e); + + static bool fromString(const std::string& s,OnTBTClientState& e); + static const std::string toString(const OnTBTClientState& e); + + static bool fromJSON(const Json::Value& s,OnTBTClientState& e); + static Json::Value toJSON(const OnTBTClientState& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformAudioPassThru.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformAudioPassThru.cpp new file mode 100644 index 000000000..8365563d3 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformAudioPassThru.cpp @@ -0,0 +1,189 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/PerformAudioPassThru.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +PerformAudioPassThru& PerformAudioPassThru::operator =(const PerformAudioPassThru& c) +{ + initialPrompt=c.initialPrompt; + if(audioPassThruDisplayText1) delete audioPassThruDisplayText1; + audioPassThruDisplayText1= c.audioPassThruDisplayText1 ? new std::string(c.audioPassThruDisplayText1[0]) : 0; + if(audioPassThruDisplayText2) delete audioPassThruDisplayText2; + audioPassThruDisplayText2= c.audioPassThruDisplayText2 ? new std::string(c.audioPassThruDisplayText2[0]) : 0; + samplingRate=c.samplingRate; + maxDuration=c.maxDuration; + bitsPerSample=c.bitsPerSample; + audioType=c.audioType; + appId=c.appId; + return *this; +} + + +PerformAudioPassThru::~PerformAudioPassThru(void) +{ + if(audioPassThruDisplayText1) delete audioPassThruDisplayText1; + if(audioPassThruDisplayText2) delete audioPassThruDisplayText2; +} + + +PerformAudioPassThru::PerformAudioPassThru(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__PERFORMAUDIOPASSTHRU), + audioPassThruDisplayText1(0), + audioPassThruDisplayText2(0) +{ +} + + +PerformAudioPassThru::PerformAudioPassThru(const PerformAudioPassThru& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__PERFORMAUDIOPASSTHRU,c.getId()) +{ + *this=c; +} + + +const std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>& PerformAudioPassThru::get_initialPrompt(void) +{ + return initialPrompt; +} + +bool PerformAudioPassThru::set_initialPrompt(const std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>& initialPrompt_) +{ + initialPrompt=initialPrompt_; + return true; +} + +const std::string* PerformAudioPassThru::get_audioPassThruDisplayText1(void) +{ + return audioPassThruDisplayText1; +} + +bool PerformAudioPassThru::set_audioPassThruDisplayText1(const std::string& audioPassThruDisplayText1_) +{ + if(audioPassThruDisplayText1) delete audioPassThruDisplayText1; + audioPassThruDisplayText1=new std::string(audioPassThruDisplayText1_); + return true; +} + +void PerformAudioPassThru::reset_audioPassThruDisplayText1(void) +{ + if(audioPassThruDisplayText1) delete audioPassThruDisplayText1; + audioPassThruDisplayText1=0; +} + +const std::string* PerformAudioPassThru::get_audioPassThruDisplayText2(void) +{ + return audioPassThruDisplayText2; +} + +bool PerformAudioPassThru::set_audioPassThruDisplayText2(const std::string& audioPassThruDisplayText2_) +{ + if(audioPassThruDisplayText2) delete audioPassThruDisplayText2; + audioPassThruDisplayText2=new std::string(audioPassThruDisplayText2_); + return true; +} + +void PerformAudioPassThru::reset_audioPassThruDisplayText2(void) +{ + if(audioPassThruDisplayText2) delete audioPassThruDisplayText2; + audioPassThruDisplayText2=0; +} + +const NsSmartDeviceLinkRPCV2::SamplingRate& PerformAudioPassThru::get_samplingRate(void) +{ + return samplingRate; +} + +bool PerformAudioPassThru::set_samplingRate(const NsSmartDeviceLinkRPCV2::SamplingRate& samplingRate_) +{ + samplingRate=samplingRate_; + return true; +} + +unsigned int PerformAudioPassThru::get_maxDuration(void) +{ + return maxDuration; +} + +bool PerformAudioPassThru::set_maxDuration(unsigned int maxDuration_) +{ + maxDuration=maxDuration_; + return true; +} + +const NsSmartDeviceLinkRPCV2::AudioCaptureQuality& PerformAudioPassThru::get_bitsPerSample(void) +{ + return bitsPerSample; +} + +bool PerformAudioPassThru::set_bitsPerSample(const NsSmartDeviceLinkRPCV2::AudioCaptureQuality& bitsPerSample_) +{ + bitsPerSample=bitsPerSample_; + return true; +} + +const NsSmartDeviceLinkRPCV2::AudioType& PerformAudioPassThru::get_audioType(void) +{ + return audioType; +} + +bool PerformAudioPassThru::set_audioType(const NsSmartDeviceLinkRPCV2::AudioType& audioType_) +{ + audioType=audioType_; + return true; +} + +int PerformAudioPassThru::get_appId(void) +{ + return appId; +} + +bool PerformAudioPassThru::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool PerformAudioPassThru::checkIntegrity(void) +{ + return PerformAudioPassThruMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformAudioPassThruMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformAudioPassThruMarshaller.cpp new file mode 100644 index 000000000..bda449899 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformAudioPassThruMarshaller.cpp @@ -0,0 +1,208 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/PerformAudioPassThru.h" +#include "../src/SDLRPCObjectsImpl/V2/TTSChunkMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/SamplingRateMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/AudioCaptureQualityMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/AudioTypeMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/PerformAudioPassThruMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool PerformAudioPassThruMarshaller::checkIntegrity(PerformAudioPassThru& s) +{ + return checkIntegrityConst(s); +} + + +bool PerformAudioPassThruMarshaller::fromString(const std::string& s,PerformAudioPassThru& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string PerformAudioPassThruMarshaller::toString(const PerformAudioPassThru& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool PerformAudioPassThruMarshaller::checkIntegrityConst(const PerformAudioPassThru& s) +{ + { + unsigned int i=s.initialPrompt.size(); + if(i<1) return false; + if(i>100) return false; + } + + if(s.audioPassThruDisplayText1 && (s.audioPassThruDisplayText1[0].length()>500)) return false; + + if(s.audioPassThruDisplayText2 && (s.audioPassThruDisplayText2[0].length()>500)) return false; + + if(!NsSmartDeviceLinkRPCV2::SamplingRateMarshaller::checkIntegrityConst(s.samplingRate)) return false; + + if(s.maxDuration>1000000) return false; + + if(!NsSmartDeviceLinkRPCV2::AudioCaptureQualityMarshaller::checkIntegrityConst(s.bitsPerSample)) return false; + + if(!NsSmartDeviceLinkRPCV2::AudioTypeMarshaller::checkIntegrityConst(s.audioType)) return false; + + return true; +} + + +Json::Value PerformAudioPassThruMarshaller::toJSON(const PerformAudioPassThru& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.PerformAudioPassThru"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + { + unsigned int i=e.initialPrompt.size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::TTSChunkMarshaller::toJSON(e.initialPrompt[i]); + + json["params"]["initialPrompt"]=j; + } + if(e.audioPassThruDisplayText1) + json["params"]["audioPassThruDisplayText1"]=Json::Value(e.audioPassThruDisplayText1[0]);; + if(e.audioPassThruDisplayText2) + json["params"]["audioPassThruDisplayText2"]=Json::Value(e.audioPassThruDisplayText2[0]);; + json["params"]["samplingRate"]=NsSmartDeviceLinkRPCV2::SamplingRateMarshaller::toJSON(e.samplingRate);; + json["params"]["maxDuration"]=Json::Value(e.maxDuration);; + json["params"]["bitsPerSample"]=NsSmartDeviceLinkRPCV2::AudioCaptureQualityMarshaller::toJSON(e.bitsPerSample);; + json["params"]["audioType"]=NsSmartDeviceLinkRPCV2::AudioTypeMarshaller::toJSON(e.audioType);; + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool PerformAudioPassThruMarshaller::fromJSON(const Json::Value& json,PerformAudioPassThru& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.PerformAudioPassThru")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(!js.isMember("initialPrompt") || !js["initialPrompt"].isArray()) return false; + { + unsigned int i=js["initialPrompt"].size(); + if(i<1) return false; + if(i>100) return false; + c.initialPrompt.resize(i); + while(i--) + { + NsSmartDeviceLinkRPCV2::TTSChunk t; + if(!NsSmartDeviceLinkRPCV2::TTSChunkMarshaller::fromJSON(js["initialPrompt"][i],t)) + return false; + c.initialPrompt[i]=t; + } + } + + if(c.audioPassThruDisplayText1) delete c.audioPassThruDisplayText1; + c.audioPassThruDisplayText1=0; + if(js.isMember("audioPassThruDisplayText1")) + { + if(!js["audioPassThruDisplayText1"].isString()) return false; + c.audioPassThruDisplayText1=new std::string(); + c.audioPassThruDisplayText1[0]=js["audioPassThruDisplayText1"].asString(); + if(c.audioPassThruDisplayText1[0].length()>500) return false; + + } + + if(c.audioPassThruDisplayText2) delete c.audioPassThruDisplayText2; + c.audioPassThruDisplayText2=0; + if(js.isMember("audioPassThruDisplayText2")) + { + if(!js["audioPassThruDisplayText2"].isString()) return false; + c.audioPassThruDisplayText2=new std::string(); + c.audioPassThruDisplayText2[0]=js["audioPassThruDisplayText2"].asString(); + if(c.audioPassThruDisplayText2[0].length()>500) return false; + + } + + if(!js.isMember("samplingRate") || !NsSmartDeviceLinkRPCV2::SamplingRateMarshaller::fromJSON(js["samplingRate"],c.samplingRate)) return false; + + if(!js.isMember("maxDuration") || !js["maxDuration"].isInt()) return false; + c.maxDuration=js["maxDuration"].asInt(); + if(c.maxDuration>1000000) return false; + + if(!js.isMember("bitsPerSample") || !NsSmartDeviceLinkRPCV2::AudioCaptureQualityMarshaller::fromJSON(js["bitsPerSample"],c.bitsPerSample)) return false; + + if(!js.isMember("audioType") || !NsSmartDeviceLinkRPCV2::AudioTypeMarshaller::fromJSON(js["audioType"],c.audioType)) return false; + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformAudioPassThruMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformAudioPassThruMarshaller.h new file mode 100644 index 000000000..76b662ff5 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformAudioPassThruMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_PERFORMAUDIOPASSTHRUMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_PERFORMAUDIOPASSTHRUMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/PerformAudioPassThru.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct PerformAudioPassThruMarshaller + { + static bool checkIntegrity(PerformAudioPassThru& e); + static bool checkIntegrityConst(const PerformAudioPassThru& e); + + static bool fromString(const std::string& s,PerformAudioPassThru& e); + static const std::string toString(const PerformAudioPassThru& e); + + static bool fromJSON(const Json::Value& s,PerformAudioPassThru& e); + static Json::Value toJSON(const PerformAudioPassThru& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformAudioPassThruResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformAudioPassThruResponse.cpp new file mode 100644 index 000000000..a622237d9 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformAudioPassThruResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/PerformAudioPassThruResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +PerformAudioPassThruResponse& PerformAudioPassThruResponse::operator =(const PerformAudioPassThruResponse& c) +{ + return *this; +} + + +PerformAudioPassThruResponse::~PerformAudioPassThruResponse(void) +{ +} + + +PerformAudioPassThruResponse::PerformAudioPassThruResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__PERFORMAUDIOPASSTHRURESPONSE) +{ +} + + +PerformAudioPassThruResponse::PerformAudioPassThruResponse(const PerformAudioPassThruResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__PERFORMAUDIOPASSTHRURESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool PerformAudioPassThruResponse::checkIntegrity(void) +{ + return PerformAudioPassThruResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformAudioPassThruResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformAudioPassThruResponseMarshaller.cpp new file mode 100644 index 000000000..fef6ca726 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformAudioPassThruResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/PerformAudioPassThruResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/PerformAudioPassThruResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool PerformAudioPassThruResponseMarshaller::checkIntegrity(PerformAudioPassThruResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool PerformAudioPassThruResponseMarshaller::fromString(const std::string& s,PerformAudioPassThruResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string PerformAudioPassThruResponseMarshaller::toString(const PerformAudioPassThruResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool PerformAudioPassThruResponseMarshaller::checkIntegrityConst(const PerformAudioPassThruResponse& s) +{ + return true; +} + + +Json::Value PerformAudioPassThruResponseMarshaller::toJSON(const PerformAudioPassThruResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.PerformAudioPassThruResponse"); + + return json; +} + + +bool PerformAudioPassThruResponseMarshaller::fromJSON(const Json::Value& json,PerformAudioPassThruResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.PerformAudioPassThruResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformAudioPassThruResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformAudioPassThruResponseMarshaller.h new file mode 100644 index 000000000..45127eadb --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformAudioPassThruResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_PERFORMAUDIOPASSTHRURESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_PERFORMAUDIOPASSTHRURESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/PerformAudioPassThruResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct PerformAudioPassThruResponseMarshaller + { + static bool checkIntegrity(PerformAudioPassThruResponse& e); + static bool checkIntegrityConst(const PerformAudioPassThruResponse& e); + + static bool fromString(const std::string& s,PerformAudioPassThruResponse& e); + static const std::string toString(const PerformAudioPassThruResponse& e); + + static bool fromJSON(const Json::Value& s,PerformAudioPassThruResponse& e); + static Json::Value toJSON(const PerformAudioPassThruResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformInteraction.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformInteraction.cpp new file mode 100644 index 000000000..afd958da5 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformInteraction.cpp @@ -0,0 +1,221 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/PerformInteraction.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +PerformInteraction& PerformInteraction::operator =(const PerformInteraction& c) +{ + initialText=c.initialText; + initialPrompt=c.initialPrompt; + interactionMode=c.interactionMode; + interactionChoiceSetIDList=c.interactionChoiceSetIDList; + if(helpPrompt) delete helpPrompt; + helpPrompt= c.helpPrompt ? new std::vector<NsSmartDeviceLinkRPCV2::TTSChunk>(c.helpPrompt[0]) : 0; + if(timeoutPrompt) delete timeoutPrompt; + timeoutPrompt= c.timeoutPrompt ? new std::vector<NsSmartDeviceLinkRPCV2::TTSChunk>(c.timeoutPrompt[0]) : 0; + if(timeout) delete timeout; + timeout= c.timeout ? new unsigned int(c.timeout[0]) : 0; + if(vrHelp) delete vrHelp; + vrHelp= c.vrHelp ? new std::vector<NsSmartDeviceLinkRPCV2::VrHelpItem>(c.vrHelp[0]) : 0; + appId=c.appId; + return *this; +} + + +PerformInteraction::~PerformInteraction(void) +{ + if(helpPrompt) delete helpPrompt; + if(timeoutPrompt) delete timeoutPrompt; + if(timeout) delete timeout; + if(vrHelp) delete vrHelp; +} + + +PerformInteraction::PerformInteraction(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__PERFORMINTERACTION), + helpPrompt(0), + timeoutPrompt(0), + timeout(0), + vrHelp(0) +{ +} + + +PerformInteraction::PerformInteraction(const PerformInteraction& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__PERFORMINTERACTION,c.getId()) +{ + *this=c; +} + + +const std::string& PerformInteraction::get_initialText(void) +{ + return initialText; +} + +bool PerformInteraction::set_initialText(const std::string& initialText_) +{ + initialText=initialText_; + return true; +} + +const std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>& PerformInteraction::get_initialPrompt(void) +{ + return initialPrompt; +} + +bool PerformInteraction::set_initialPrompt(const std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>& initialPrompt_) +{ + initialPrompt=initialPrompt_; + return true; +} + +const NsSmartDeviceLinkRPCV2::InteractionMode& PerformInteraction::get_interactionMode(void) +{ + return interactionMode; +} + +bool PerformInteraction::set_interactionMode(const NsSmartDeviceLinkRPCV2::InteractionMode& interactionMode_) +{ + interactionMode=interactionMode_; + return true; +} + +const std::vector< unsigned int>& PerformInteraction::get_interactionChoiceSetIDList(void) +{ + return interactionChoiceSetIDList; +} + +bool PerformInteraction::set_interactionChoiceSetIDList(const std::vector< unsigned int>& interactionChoiceSetIDList_) +{ + interactionChoiceSetIDList=interactionChoiceSetIDList_; + return true; +} + +const std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>* PerformInteraction::get_helpPrompt(void) +{ + return helpPrompt; +} + +bool PerformInteraction::set_helpPrompt(const std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>& helpPrompt_) +{ + if(helpPrompt) delete helpPrompt; + helpPrompt=new std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>(helpPrompt_); + return true; +} + +void PerformInteraction::reset_helpPrompt(void) +{ + if(helpPrompt) delete helpPrompt; + helpPrompt=0; +} + +const std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>* PerformInteraction::get_timeoutPrompt(void) +{ + return timeoutPrompt; +} + +bool PerformInteraction::set_timeoutPrompt(const std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>& timeoutPrompt_) +{ + if(timeoutPrompt) delete timeoutPrompt; + timeoutPrompt=new std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>(timeoutPrompt_); + return true; +} + +void PerformInteraction::reset_timeoutPrompt(void) +{ + if(timeoutPrompt) delete timeoutPrompt; + timeoutPrompt=0; +} + +const unsigned int* PerformInteraction::get_timeout(void) +{ + return timeout; +} + +bool PerformInteraction::set_timeout(const unsigned int& timeout_) +{ + if(timeout) delete timeout; + timeout=new unsigned int(timeout_); + return true; +} + +void PerformInteraction::reset_timeout(void) +{ + if(timeout) delete timeout; + timeout=0; +} + +const std::vector< NsSmartDeviceLinkRPCV2::VrHelpItem>* PerformInteraction::get_vrHelp(void) +{ + return vrHelp; +} + +bool PerformInteraction::set_vrHelp(const std::vector< NsSmartDeviceLinkRPCV2::VrHelpItem>& vrHelp_) +{ + if(vrHelp) delete vrHelp; + vrHelp=new std::vector< NsSmartDeviceLinkRPCV2::VrHelpItem>(vrHelp_); + return true; +} + +void PerformInteraction::reset_vrHelp(void) +{ + if(vrHelp) delete vrHelp; + vrHelp=0; +} + +int PerformInteraction::get_appId(void) +{ + return appId; +} + +bool PerformInteraction::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool PerformInteraction::checkIntegrity(void) +{ + return PerformInteractionMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformInteractionMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformInteractionMarshaller.cpp new file mode 100644 index 000000000..52b49e374 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformInteractionMarshaller.cpp @@ -0,0 +1,324 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/PerformInteraction.h" +#include "../src/SDLRPCObjectsImpl/V2/TTSChunkMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/InteractionModeMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/TTSChunkMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/TTSChunkMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/VrHelpItemMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/PerformInteractionMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool PerformInteractionMarshaller::checkIntegrity(PerformInteraction& s) +{ + return checkIntegrityConst(s); +} + + +bool PerformInteractionMarshaller::fromString(const std::string& s,PerformInteraction& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string PerformInteractionMarshaller::toString(const PerformInteraction& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool PerformInteractionMarshaller::checkIntegrityConst(const PerformInteraction& s) +{ + if(s.initialText.length()>500) return false; + + { + unsigned int i=s.initialPrompt.size(); + if(i<1) return false; + if(i>100) return false; + } + + if(!NsSmartDeviceLinkRPCV2::InteractionModeMarshaller::checkIntegrityConst(s.interactionMode)) return false; + + { + unsigned int i=s.interactionChoiceSetIDList.size(); + if(i<1) return false; + if(i>100) return false; + while(i--) + { + if(s.interactionChoiceSetIDList[i]>2000000000) return false; + } + } + + if(s.helpPrompt) + { + unsigned int i=s.helpPrompt[0].size(); + if(i<1) return false; + if(i>100) return false; + } + + if(s.timeoutPrompt) + { + unsigned int i=s.timeoutPrompt[0].size(); + if(i<1) return false; + if(i>100) return false; + } + + if(s.timeout && (s.timeout[0]<5000 || s.timeout[0]>100000)) return false; + + if(s.vrHelp) + { + unsigned int i=s.vrHelp[0].size(); + if(i<1) return false; + if(i>100) return false; + } + + return true; +} + + +Json::Value PerformInteractionMarshaller::toJSON(const PerformInteraction& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.PerformInteraction"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["initialText"]=Json::Value(e.initialText);; + { + unsigned int i=e.initialPrompt.size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::TTSChunkMarshaller::toJSON(e.initialPrompt[i]); + + json["params"]["initialPrompt"]=j; + } + json["params"]["interactionMode"]=NsSmartDeviceLinkRPCV2::InteractionModeMarshaller::toJSON(e.interactionMode);; + { + unsigned int i=e.interactionChoiceSetIDList.size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=Json::Value(e.interactionChoiceSetIDList[i]); + + json["params"]["interactionChoiceSetIDList"]=j; + } + if(e.helpPrompt) + { + unsigned int i=e.helpPrompt[0].size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::TTSChunkMarshaller::toJSON(e.helpPrompt[0][i]); + + json["params"]["helpPrompt"]=j; + } + if(e.timeoutPrompt) + { + unsigned int i=e.timeoutPrompt[0].size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::TTSChunkMarshaller::toJSON(e.timeoutPrompt[0][i]); + + json["params"]["timeoutPrompt"]=j; + } + if(e.timeout) + json["params"]["timeout"]=Json::Value(e.timeout[0]);; + if(e.vrHelp) + { + unsigned int i=e.vrHelp[0].size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::VrHelpItemMarshaller::toJSON(e.vrHelp[0][i]); + + json["params"]["vrHelp"]=j; + } + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool PerformInteractionMarshaller::fromJSON(const Json::Value& json,PerformInteraction& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.PerformInteraction")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(!js.isMember("initialText") || !js["initialText"].isString()) return false; + c.initialText=js["initialText"].asString(); + if(c.initialText.length()>500) return false; + + if(!js.isMember("initialPrompt") || !js["initialPrompt"].isArray()) return false; + { + unsigned int i=js["initialPrompt"].size(); + if(i<1) return false; + if(i>100) return false; + c.initialPrompt.resize(i); + while(i--) + { + NsSmartDeviceLinkRPCV2::TTSChunk t; + if(!NsSmartDeviceLinkRPCV2::TTSChunkMarshaller::fromJSON(js["initialPrompt"][i],t)) + return false; + c.initialPrompt[i]=t; + } + } + + if(!js.isMember("interactionMode") || !NsSmartDeviceLinkRPCV2::InteractionModeMarshaller::fromJSON(js["interactionMode"],c.interactionMode)) return false; + + if(!js.isMember("interactionChoiceSetIDList") || !js["interactionChoiceSetIDList"].isArray()) + return false; + { + c.interactionChoiceSetIDList.clear(); + unsigned int i=js["interactionChoiceSetIDList"].size(); + if(i<1) return false; + if(i>100) return false; + c.interactionChoiceSetIDList.resize(i); + while(i--) + { + if(!js["interactionChoiceSetIDList"][i].isInt()) + return false; + c.interactionChoiceSetIDList[i]=js["interactionChoiceSetIDList"][i].asInt(); + if(c.interactionChoiceSetIDList[i]>2000000000) return false; + + } + } + + + if(c.helpPrompt) delete c.helpPrompt; + c.helpPrompt=0; + if(js.isMember("helpPrompt")) + { + if(!js["helpPrompt"].isArray()) return false; + unsigned int i=js["helpPrompt"].size(); + if(i<1) return false; + if(i>100) return false; + + c.helpPrompt=new std::vector<NsSmartDeviceLinkRPCV2::TTSChunk>(); + c.helpPrompt->resize(js["helpPrompt"].size()); + + while(i--) + if(!NsSmartDeviceLinkRPCV2::TTSChunkMarshaller::fromJSON(js["helpPrompt"][i],c.helpPrompt[0][i])) return false; + } + + + if(c.timeoutPrompt) delete c.timeoutPrompt; + c.timeoutPrompt=0; + if(js.isMember("timeoutPrompt")) + { + if(!js["timeoutPrompt"].isArray()) return false; + unsigned int i=js["timeoutPrompt"].size(); + if(i<1) return false; + if(i>100) return false; + + c.timeoutPrompt=new std::vector<NsSmartDeviceLinkRPCV2::TTSChunk>(); + c.timeoutPrompt->resize(js["timeoutPrompt"].size()); + + while(i--) + if(!NsSmartDeviceLinkRPCV2::TTSChunkMarshaller::fromJSON(js["timeoutPrompt"][i],c.timeoutPrompt[0][i])) return false; + } + + + if(c.timeout) delete c.timeout; + c.timeout=0; + if(js.isMember("timeout")) + { + if(!js["timeout"].isInt()) return false; + c.timeout=new unsigned int(); + c.timeout[0]=js["timeout"].asInt(); + if(c.timeout[0]<5000 || c.timeout[0]>100000) return false; + + } + + if(c.vrHelp) delete c.vrHelp; + c.vrHelp=0; + if(js.isMember("vrHelp")) + { + if(!js["vrHelp"].isArray()) return false; + unsigned int i=js["vrHelp"].size(); + if(i<1) return false; + if(i>100) return false; + + c.vrHelp=new std::vector<NsSmartDeviceLinkRPCV2::VrHelpItem>(); + c.vrHelp->resize(js["vrHelp"].size()); + + while(i--) + if(!NsSmartDeviceLinkRPCV2::VrHelpItemMarshaller::fromJSON(js["vrHelp"][i],c.vrHelp[0][i])) return false; + } + + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformInteractionMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformInteractionMarshaller.h new file mode 100644 index 000000000..32abde5e3 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformInteractionMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_PERFORMINTERACTIONMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_PERFORMINTERACTIONMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/PerformInteraction.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct PerformInteractionMarshaller + { + static bool checkIntegrity(PerformInteraction& e); + static bool checkIntegrityConst(const PerformInteraction& e); + + static bool fromString(const std::string& s,PerformInteraction& e); + static const std::string toString(const PerformInteraction& e); + + static bool fromJSON(const Json::Value& s,PerformInteraction& e); + static Json::Value toJSON(const PerformInteraction& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformInteractionResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformInteractionResponse.cpp new file mode 100644 index 000000000..b357352ba --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformInteractionResponse.cpp @@ -0,0 +1,117 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/PerformInteractionResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +PerformInteractionResponse& PerformInteractionResponse::operator =(const PerformInteractionResponse& c) +{ + if(choiceID) delete choiceID; + choiceID= c.choiceID ? new unsigned int(c.choiceID[0]) : 0; + if(triggerSource) delete triggerSource; + triggerSource= c.triggerSource ? new NsSmartDeviceLinkRPCV2::TriggerSource(c.triggerSource[0]) : 0; + return *this; +} + + +PerformInteractionResponse::~PerformInteractionResponse(void) +{ + if(choiceID) delete choiceID; + if(triggerSource) delete triggerSource; +} + + +PerformInteractionResponse::PerformInteractionResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__PERFORMINTERACTIONRESPONSE), + choiceID(0), + triggerSource(0) +{ +} + + +PerformInteractionResponse::PerformInteractionResponse(const PerformInteractionResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__PERFORMINTERACTIONRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +const unsigned int* PerformInteractionResponse::get_choiceID(void) +{ + return choiceID; +} + +bool PerformInteractionResponse::set_choiceID(const unsigned int& choiceID_) +{ + if(choiceID) delete choiceID; + choiceID=new unsigned int(choiceID_); + return true; +} + +void PerformInteractionResponse::reset_choiceID(void) +{ + if(choiceID) delete choiceID; + choiceID=0; +} + +const NsSmartDeviceLinkRPCV2::TriggerSource* PerformInteractionResponse::get_triggerSource(void) +{ + return triggerSource; +} + +bool PerformInteractionResponse::set_triggerSource(const NsSmartDeviceLinkRPCV2::TriggerSource& triggerSource_) +{ + if(triggerSource) delete triggerSource; + triggerSource=new NsSmartDeviceLinkRPCV2::TriggerSource(triggerSource_); + return true; +} + +void PerformInteractionResponse::reset_triggerSource(void) +{ + if(triggerSource) delete triggerSource; + triggerSource=0; +} + +bool PerformInteractionResponse::checkIntegrity(void) +{ + return PerformInteractionResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformInteractionResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformInteractionResponseMarshaller.cpp new file mode 100644 index 000000000..884377fe3 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformInteractionResponseMarshaller.cpp @@ -0,0 +1,155 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/PerformInteractionResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/TriggerSourceMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/PerformInteractionResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool PerformInteractionResponseMarshaller::checkIntegrity(PerformInteractionResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool PerformInteractionResponseMarshaller::fromString(const std::string& s,PerformInteractionResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string PerformInteractionResponseMarshaller::toString(const PerformInteractionResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool PerformInteractionResponseMarshaller::checkIntegrityConst(const PerformInteractionResponse& s) +{ + if(s.choiceID && (s.choiceID[0]>2000000000)) return false; + + if(s.triggerSource && (!NsSmartDeviceLinkRPCV2::TriggerSourceMarshaller::checkIntegrityConst(s.triggerSource[0]))) return false; + + return true; +} + + +Json::Value PerformInteractionResponseMarshaller::toJSON(const PerformInteractionResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.PerformInteractionResponse"); + + if(e.choiceID) + json["result"]["choiceID"]=Json::Value(e.choiceID[0]);; + if(e.triggerSource) + json["result"]["triggerSource"]=NsSmartDeviceLinkRPCV2::TriggerSourceMarshaller::toJSON(e.triggerSource[0]);; + return json; +} + + +bool PerformInteractionResponseMarshaller::fromJSON(const Json::Value& json,PerformInteractionResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.PerformInteractionResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + if(c.choiceID) delete c.choiceID; + c.choiceID=0; + if(js.isMember("choiceID")) + { + if(!js["choiceID"].isInt()) return false; + c.choiceID=new unsigned int(); + c.choiceID[0]=js["choiceID"].asInt(); + if(c.choiceID[0]>2000000000) return false; + + } + + if(c.triggerSource) delete c.triggerSource; + c.triggerSource=0; + if(js.isMember("triggerSource")) + { + c.triggerSource=new NsSmartDeviceLinkRPCV2::TriggerSource(); + if(!NsSmartDeviceLinkRPCV2::TriggerSourceMarshaller::fromJSON(js["triggerSource"],c.triggerSource[0])) return false; + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformInteractionResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformInteractionResponseMarshaller.h new file mode 100644 index 000000000..19ff0387b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/PerformInteractionResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_PERFORMINTERACTIONRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_PERFORMINTERACTIONRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/PerformInteractionResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct PerformInteractionResponseMarshaller + { + static bool checkIntegrity(PerformInteractionResponse& e); + static bool checkIntegrityConst(const PerformInteractionResponse& e); + + static bool fromString(const std::string& s,PerformInteractionResponse& e); + static const std::string toString(const PerformInteractionResponse& e); + + static bool fromJSON(const Json::Value& s,PerformInteractionResponse& e); + static Json::Value toJSON(const PerformInteractionResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ResetGlobalProperties.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ResetGlobalProperties.cpp new file mode 100644 index 000000000..01ee3bf89 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ResetGlobalProperties.cpp @@ -0,0 +1,97 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ResetGlobalProperties.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +ResetGlobalProperties& ResetGlobalProperties::operator =(const ResetGlobalProperties& c) +{ + properties=c.properties; + appId=c.appId; + return *this; +} + + +ResetGlobalProperties::~ResetGlobalProperties(void) +{ +} + + +ResetGlobalProperties::ResetGlobalProperties(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__RESETGLOBALPROPERTIES) +{ +} + + +ResetGlobalProperties::ResetGlobalProperties(const ResetGlobalProperties& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__RESETGLOBALPROPERTIES,c.getId()) +{ + *this=c; +} + + +const std::vector< NsSmartDeviceLinkRPCV2::GlobalProperty>& ResetGlobalProperties::get_properties(void) +{ + return properties; +} + +bool ResetGlobalProperties::set_properties(const std::vector< NsSmartDeviceLinkRPCV2::GlobalProperty>& properties_) +{ + properties=properties_; + return true; +} + +int ResetGlobalProperties::get_appId(void) +{ + return appId; +} + +bool ResetGlobalProperties::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool ResetGlobalProperties::checkIntegrity(void) +{ + return ResetGlobalPropertiesMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ResetGlobalPropertiesMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ResetGlobalPropertiesMarshaller.cpp new file mode 100644 index 000000000..c66462c58 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ResetGlobalPropertiesMarshaller.cpp @@ -0,0 +1,153 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ResetGlobalProperties.h" +#include "../src/SDLRPCObjectsImpl/V2/GlobalPropertyMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/ResetGlobalPropertiesMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool ResetGlobalPropertiesMarshaller::checkIntegrity(ResetGlobalProperties& s) +{ + return checkIntegrityConst(s); +} + + +bool ResetGlobalPropertiesMarshaller::fromString(const std::string& s,ResetGlobalProperties& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string ResetGlobalPropertiesMarshaller::toString(const ResetGlobalProperties& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool ResetGlobalPropertiesMarshaller::checkIntegrityConst(const ResetGlobalProperties& s) +{ + { + unsigned int i=s.properties.size(); + if(i<1) return false; + if(i>100) return false; + } + + return true; +} + + +Json::Value ResetGlobalPropertiesMarshaller::toJSON(const ResetGlobalProperties& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.ResetGlobalProperties"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + { + unsigned int i=e.properties.size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::GlobalPropertyMarshaller::toJSON(e.properties[i]); + + json["params"]["properties"]=j; + } + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool ResetGlobalPropertiesMarshaller::fromJSON(const Json::Value& json,ResetGlobalProperties& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.ResetGlobalProperties")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(!js.isMember("properties") || !js["properties"].isArray()) return false; + { + unsigned int i=js["properties"].size(); + if(i<1) return false; + if(i>100) return false; + c.properties.resize(i); + while(i--) + { + NsSmartDeviceLinkRPCV2::GlobalProperty t; + if(!NsSmartDeviceLinkRPCV2::GlobalPropertyMarshaller::fromJSON(js["properties"][i],t)) + return false; + c.properties[i]=t; + } + } + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ResetGlobalPropertiesMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ResetGlobalPropertiesMarshaller.h new file mode 100644 index 000000000..4f0f41aee --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ResetGlobalPropertiesMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_RESETGLOBALPROPERTIESMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_RESETGLOBALPROPERTIESMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ResetGlobalProperties.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct ResetGlobalPropertiesMarshaller + { + static bool checkIntegrity(ResetGlobalProperties& e); + static bool checkIntegrityConst(const ResetGlobalProperties& e); + + static bool fromString(const std::string& s,ResetGlobalProperties& e); + static const std::string toString(const ResetGlobalProperties& e); + + static bool fromJSON(const Json::Value& s,ResetGlobalProperties& e); + static Json::Value toJSON(const ResetGlobalProperties& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ResetGlobalPropertiesResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ResetGlobalPropertiesResponse.cpp new file mode 100644 index 000000000..4321d5c84 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ResetGlobalPropertiesResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ResetGlobalPropertiesResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +ResetGlobalPropertiesResponse& ResetGlobalPropertiesResponse::operator =(const ResetGlobalPropertiesResponse& c) +{ + return *this; +} + + +ResetGlobalPropertiesResponse::~ResetGlobalPropertiesResponse(void) +{ +} + + +ResetGlobalPropertiesResponse::ResetGlobalPropertiesResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__RESETGLOBALPROPERTIESRESPONSE) +{ +} + + +ResetGlobalPropertiesResponse::ResetGlobalPropertiesResponse(const ResetGlobalPropertiesResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__RESETGLOBALPROPERTIESRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool ResetGlobalPropertiesResponse::checkIntegrity(void) +{ + return ResetGlobalPropertiesResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ResetGlobalPropertiesResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ResetGlobalPropertiesResponseMarshaller.cpp new file mode 100644 index 000000000..a15c932d1 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ResetGlobalPropertiesResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ResetGlobalPropertiesResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/ResetGlobalPropertiesResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool ResetGlobalPropertiesResponseMarshaller::checkIntegrity(ResetGlobalPropertiesResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool ResetGlobalPropertiesResponseMarshaller::fromString(const std::string& s,ResetGlobalPropertiesResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string ResetGlobalPropertiesResponseMarshaller::toString(const ResetGlobalPropertiesResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool ResetGlobalPropertiesResponseMarshaller::checkIntegrityConst(const ResetGlobalPropertiesResponse& s) +{ + return true; +} + + +Json::Value ResetGlobalPropertiesResponseMarshaller::toJSON(const ResetGlobalPropertiesResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.ResetGlobalPropertiesResponse"); + + return json; +} + + +bool ResetGlobalPropertiesResponseMarshaller::fromJSON(const Json::Value& json,ResetGlobalPropertiesResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.ResetGlobalPropertiesResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ResetGlobalPropertiesResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ResetGlobalPropertiesResponseMarshaller.h new file mode 100644 index 000000000..ade01a3ab --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ResetGlobalPropertiesResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_RESETGLOBALPROPERTIESRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_RESETGLOBALPROPERTIESRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ResetGlobalPropertiesResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct ResetGlobalPropertiesResponseMarshaller + { + static bool checkIntegrity(ResetGlobalPropertiesResponse& e); + static bool checkIntegrityConst(const ResetGlobalPropertiesResponse& e); + + static bool fromString(const std::string& s,ResetGlobalPropertiesResponse& e); + static const std::string toString(const ResetGlobalPropertiesResponse& e); + + static bool fromJSON(const Json::Value& s,ResetGlobalPropertiesResponse& e); + static Json::Value toJSON(const ResetGlobalPropertiesResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ScrollableMessage.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ScrollableMessage.cpp new file mode 100644 index 000000000..47bffe006 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ScrollableMessage.cpp @@ -0,0 +1,141 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ScrollableMessage.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +ScrollableMessage& ScrollableMessage::operator =(const ScrollableMessage& c) +{ + scrollableMessageBody=c.scrollableMessageBody; + if(timeout) delete timeout; + timeout= c.timeout ? new unsigned int(c.timeout[0]) : 0; + if(softButtons) delete softButtons; + softButtons= c.softButtons ? new std::vector<NsSmartDeviceLinkRPCV2::SoftButton>(c.softButtons[0]) : 0; + appId=c.appId; + return *this; +} + + +ScrollableMessage::~ScrollableMessage(void) +{ + if(timeout) delete timeout; + if(softButtons) delete softButtons; +} + + +ScrollableMessage::ScrollableMessage(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SCROLLABLEMESSAGE), + timeout(0), + softButtons(0) +{ +} + + +ScrollableMessage::ScrollableMessage(const ScrollableMessage& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SCROLLABLEMESSAGE,c.getId()) +{ + *this=c; +} + + +const std::string& ScrollableMessage::get_scrollableMessageBody(void) +{ + return scrollableMessageBody; +} + +bool ScrollableMessage::set_scrollableMessageBody(const std::string& scrollableMessageBody_) +{ + scrollableMessageBody=scrollableMessageBody_; + return true; +} + +const unsigned int* ScrollableMessage::get_timeout(void) +{ + return timeout; +} + +bool ScrollableMessage::set_timeout(const unsigned int& timeout_) +{ + if(timeout) delete timeout; + timeout=new unsigned int(timeout_); + return true; +} + +void ScrollableMessage::reset_timeout(void) +{ + if(timeout) delete timeout; + timeout=0; +} + +const std::vector< NsSmartDeviceLinkRPCV2::SoftButton>* ScrollableMessage::get_softButtons(void) +{ + return softButtons; +} + +bool ScrollableMessage::set_softButtons(const std::vector< NsSmartDeviceLinkRPCV2::SoftButton>& softButtons_) +{ + if(softButtons) delete softButtons; + softButtons=new std::vector< NsSmartDeviceLinkRPCV2::SoftButton>(softButtons_); + return true; +} + +void ScrollableMessage::reset_softButtons(void) +{ + if(softButtons) delete softButtons; + softButtons=0; +} + +int ScrollableMessage::get_appId(void) +{ + return appId; +} + +bool ScrollableMessage::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool ScrollableMessage::checkIntegrity(void) +{ + return ScrollableMessageMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ScrollableMessageMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ScrollableMessageMarshaller.cpp new file mode 100644 index 000000000..b37f75f2f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ScrollableMessageMarshaller.cpp @@ -0,0 +1,179 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ScrollableMessage.h" +#include "../src/SDLRPCObjectsImpl/V2/SoftButtonMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/ScrollableMessageMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool ScrollableMessageMarshaller::checkIntegrity(ScrollableMessage& s) +{ + return checkIntegrityConst(s); +} + + +bool ScrollableMessageMarshaller::fromString(const std::string& s,ScrollableMessage& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string ScrollableMessageMarshaller::toString(const ScrollableMessage& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool ScrollableMessageMarshaller::checkIntegrityConst(const ScrollableMessage& s) +{ + if(s.scrollableMessageBody.length()>500) return false; + + if(s.timeout && (s.timeout[0]>65535)) return false; + + if(s.softButtons) + { + unsigned int i=s.softButtons[0].size(); + if(i<0) return false; + if(i>8) return false; + } + + return true; +} + + +Json::Value ScrollableMessageMarshaller::toJSON(const ScrollableMessage& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.ScrollableMessage"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["scrollableMessageBody"]=Json::Value(e.scrollableMessageBody);; + if(e.timeout) + json["params"]["timeout"]=Json::Value(e.timeout[0]);; + if(e.softButtons) + { + unsigned int i=e.softButtons[0].size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::SoftButtonMarshaller::toJSON(e.softButtons[0][i]); + + json["params"]["softButtons"]=j; + } + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool ScrollableMessageMarshaller::fromJSON(const Json::Value& json,ScrollableMessage& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.ScrollableMessage")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(!js.isMember("scrollableMessageBody") || !js["scrollableMessageBody"].isString()) return false; + c.scrollableMessageBody=js["scrollableMessageBody"].asString(); + if(c.scrollableMessageBody.length()>500) return false; + + if(c.timeout) delete c.timeout; + c.timeout=0; + if(js.isMember("timeout")) + { + if(!js["timeout"].isInt()) return false; + c.timeout=new unsigned int(); + c.timeout[0]=js["timeout"].asInt(); + if(c.timeout[0]>65535) return false; + + } + + if(c.softButtons) delete c.softButtons; + c.softButtons=0; + if(js.isMember("softButtons")) + { + if(!js["softButtons"].isArray()) return false; + unsigned int i=js["softButtons"].size(); + if(i<0) return false; + if(i>8) return false; + + c.softButtons=new std::vector<NsSmartDeviceLinkRPCV2::SoftButton>(); + c.softButtons->resize(js["softButtons"].size()); + + while(i--) + if(!NsSmartDeviceLinkRPCV2::SoftButtonMarshaller::fromJSON(js["softButtons"][i],c.softButtons[0][i])) return false; + } + + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ScrollableMessageMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ScrollableMessageMarshaller.h new file mode 100644 index 000000000..9c5893b6a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ScrollableMessageMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_SCROLLABLEMESSAGEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_SCROLLABLEMESSAGEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ScrollableMessage.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct ScrollableMessageMarshaller + { + static bool checkIntegrity(ScrollableMessage& e); + static bool checkIntegrityConst(const ScrollableMessage& e); + + static bool fromString(const std::string& s,ScrollableMessage& e); + static const std::string toString(const ScrollableMessage& e); + + static bool fromJSON(const Json::Value& s,ScrollableMessage& e); + static Json::Value toJSON(const ScrollableMessage& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ScrollableMessageResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ScrollableMessageResponse.cpp new file mode 100644 index 000000000..f624f26c4 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ScrollableMessageResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ScrollableMessageResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +ScrollableMessageResponse& ScrollableMessageResponse::operator =(const ScrollableMessageResponse& c) +{ + return *this; +} + + +ScrollableMessageResponse::~ScrollableMessageResponse(void) +{ +} + + +ScrollableMessageResponse::ScrollableMessageResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SCROLLABLEMESSAGERESPONSE) +{ +} + + +ScrollableMessageResponse::ScrollableMessageResponse(const ScrollableMessageResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SCROLLABLEMESSAGERESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool ScrollableMessageResponse::checkIntegrity(void) +{ + return ScrollableMessageResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ScrollableMessageResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ScrollableMessageResponseMarshaller.cpp new file mode 100644 index 000000000..805c766c5 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ScrollableMessageResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ScrollableMessageResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/ScrollableMessageResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool ScrollableMessageResponseMarshaller::checkIntegrity(ScrollableMessageResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool ScrollableMessageResponseMarshaller::fromString(const std::string& s,ScrollableMessageResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string ScrollableMessageResponseMarshaller::toString(const ScrollableMessageResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool ScrollableMessageResponseMarshaller::checkIntegrityConst(const ScrollableMessageResponse& s) +{ + return true; +} + + +Json::Value ScrollableMessageResponseMarshaller::toJSON(const ScrollableMessageResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.ScrollableMessageResponse"); + + return json; +} + + +bool ScrollableMessageResponseMarshaller::fromJSON(const Json::Value& json,ScrollableMessageResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.ScrollableMessageResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ScrollableMessageResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ScrollableMessageResponseMarshaller.h new file mode 100644 index 000000000..8b24f7e9a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ScrollableMessageResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_SCROLLABLEMESSAGERESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_SCROLLABLEMESSAGERESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ScrollableMessageResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct ScrollableMessageResponseMarshaller + { + static bool checkIntegrity(ScrollableMessageResponse& e); + static bool checkIntegrityConst(const ScrollableMessageResponse& e); + + static bool fromString(const std::string& s,ScrollableMessageResponse& e); + static const std::string toString(const ScrollableMessageResponse& e); + + static bool fromJSON(const Json::Value& s,ScrollableMessageResponse& e); + static Json::Value toJSON(const ScrollableMessageResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetAppIcon.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetAppIcon.cpp new file mode 100644 index 000000000..980d22391 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetAppIcon.cpp @@ -0,0 +1,97 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetAppIcon.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +SetAppIcon& SetAppIcon::operator =(const SetAppIcon& c) +{ + syncFileName=c.syncFileName; + appId=c.appId; + return *this; +} + + +SetAppIcon::~SetAppIcon(void) +{ +} + + +SetAppIcon::SetAppIcon(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SETAPPICON) +{ +} + + +SetAppIcon::SetAppIcon(const SetAppIcon& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SETAPPICON,c.getId()) +{ + *this=c; +} + + +const std::string& SetAppIcon::get_syncFileName(void) +{ + return syncFileName; +} + +bool SetAppIcon::set_syncFileName(const std::string& syncFileName_) +{ + syncFileName=syncFileName_; + return true; +} + +int SetAppIcon::get_appId(void) +{ + return appId; +} + +bool SetAppIcon::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool SetAppIcon::checkIntegrity(void) +{ + return SetAppIconMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetAppIconMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetAppIconMarshaller.cpp new file mode 100644 index 000000000..42d468572 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetAppIconMarshaller.cpp @@ -0,0 +1,129 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetAppIcon.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/SetAppIconMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool SetAppIconMarshaller::checkIntegrity(SetAppIcon& s) +{ + return checkIntegrityConst(s); +} + + +bool SetAppIconMarshaller::fromString(const std::string& s,SetAppIcon& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string SetAppIconMarshaller::toString(const SetAppIcon& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SetAppIconMarshaller::checkIntegrityConst(const SetAppIcon& s) +{ + if(s.syncFileName.length()>500) return false; + + return true; +} + + +Json::Value SetAppIconMarshaller::toJSON(const SetAppIcon& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.SetAppIcon"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["syncFileName"]=Json::Value(e.syncFileName);; + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool SetAppIconMarshaller::fromJSON(const Json::Value& json,SetAppIcon& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.SetAppIcon")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(!js.isMember("syncFileName") || !js["syncFileName"].isString()) return false; + c.syncFileName=js["syncFileName"].asString(); + if(c.syncFileName.length()>500) return false; + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetAppIconMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetAppIconMarshaller.h new file mode 100644 index 000000000..65f722b11 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetAppIconMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_SETAPPICONMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_SETAPPICONMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetAppIcon.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct SetAppIconMarshaller + { + static bool checkIntegrity(SetAppIcon& e); + static bool checkIntegrityConst(const SetAppIcon& e); + + static bool fromString(const std::string& s,SetAppIcon& e); + static const std::string toString(const SetAppIcon& e); + + static bool fromJSON(const Json::Value& s,SetAppIcon& e); + static Json::Value toJSON(const SetAppIcon& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetAppIconResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetAppIconResponse.cpp new file mode 100644 index 000000000..b0c0297c3 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetAppIconResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetAppIconResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +SetAppIconResponse& SetAppIconResponse::operator =(const SetAppIconResponse& c) +{ + return *this; +} + + +SetAppIconResponse::~SetAppIconResponse(void) +{ +} + + +SetAppIconResponse::SetAppIconResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SETAPPICONRESPONSE) +{ +} + + +SetAppIconResponse::SetAppIconResponse(const SetAppIconResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SETAPPICONRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool SetAppIconResponse::checkIntegrity(void) +{ + return SetAppIconResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetAppIconResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetAppIconResponseMarshaller.cpp new file mode 100644 index 000000000..fdb121213 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetAppIconResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetAppIconResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/SetAppIconResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool SetAppIconResponseMarshaller::checkIntegrity(SetAppIconResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool SetAppIconResponseMarshaller::fromString(const std::string& s,SetAppIconResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string SetAppIconResponseMarshaller::toString(const SetAppIconResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SetAppIconResponseMarshaller::checkIntegrityConst(const SetAppIconResponse& s) +{ + return true; +} + + +Json::Value SetAppIconResponseMarshaller::toJSON(const SetAppIconResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.SetAppIconResponse"); + + return json; +} + + +bool SetAppIconResponseMarshaller::fromJSON(const Json::Value& json,SetAppIconResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.SetAppIconResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetAppIconResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetAppIconResponseMarshaller.h new file mode 100644 index 000000000..e749198f4 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetAppIconResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_SETAPPICONRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_SETAPPICONRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetAppIconResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct SetAppIconResponseMarshaller + { + static bool checkIntegrity(SetAppIconResponse& e); + static bool checkIntegrityConst(const SetAppIconResponse& e); + + static bool fromString(const std::string& s,SetAppIconResponse& e); + static const std::string toString(const SetAppIconResponse& e); + + static bool fromJSON(const Json::Value& s,SetAppIconResponse& e); + static Json::Value toJSON(const SetAppIconResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetDisplayLayout.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetDisplayLayout.cpp new file mode 100644 index 000000000..898414601 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetDisplayLayout.cpp @@ -0,0 +1,97 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetDisplayLayout.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +SetDisplayLayout& SetDisplayLayout::operator =(const SetDisplayLayout& c) +{ + displayLayout=c.displayLayout; + appId=c.appId; + return *this; +} + + +SetDisplayLayout::~SetDisplayLayout(void) +{ +} + + +SetDisplayLayout::SetDisplayLayout(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SETDISPLAYLAYOUT) +{ +} + + +SetDisplayLayout::SetDisplayLayout(const SetDisplayLayout& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SETDISPLAYLAYOUT,c.getId()) +{ + *this=c; +} + + +const std::string& SetDisplayLayout::get_displayLayout(void) +{ + return displayLayout; +} + +bool SetDisplayLayout::set_displayLayout(const std::string& displayLayout_) +{ + displayLayout=displayLayout_; + return true; +} + +int SetDisplayLayout::get_appId(void) +{ + return appId; +} + +bool SetDisplayLayout::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool SetDisplayLayout::checkIntegrity(void) +{ + return SetDisplayLayoutMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetDisplayLayoutMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetDisplayLayoutMarshaller.cpp new file mode 100644 index 000000000..7a23e0e03 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetDisplayLayoutMarshaller.cpp @@ -0,0 +1,126 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetDisplayLayout.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/SetDisplayLayoutMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool SetDisplayLayoutMarshaller::checkIntegrity(SetDisplayLayout& s) +{ + return checkIntegrityConst(s); +} + + +bool SetDisplayLayoutMarshaller::fromString(const std::string& s,SetDisplayLayout& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string SetDisplayLayoutMarshaller::toString(const SetDisplayLayout& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SetDisplayLayoutMarshaller::checkIntegrityConst(const SetDisplayLayout& s) +{ + return true; +} + + +Json::Value SetDisplayLayoutMarshaller::toJSON(const SetDisplayLayout& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.SetDisplayLayout"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["displayLayout"]=Json::Value(e.displayLayout);; + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool SetDisplayLayoutMarshaller::fromJSON(const Json::Value& json,SetDisplayLayout& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.SetDisplayLayout")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(!js.isMember("displayLayout") || !js["displayLayout"].isString()) return false; + c.displayLayout=js["displayLayout"].asString(); + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetDisplayLayoutMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetDisplayLayoutMarshaller.h new file mode 100644 index 000000000..40d879096 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetDisplayLayoutMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_SETDISPLAYLAYOUTMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_SETDISPLAYLAYOUTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetDisplayLayout.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct SetDisplayLayoutMarshaller + { + static bool checkIntegrity(SetDisplayLayout& e); + static bool checkIntegrityConst(const SetDisplayLayout& e); + + static bool fromString(const std::string& s,SetDisplayLayout& e); + static const std::string toString(const SetDisplayLayout& e); + + static bool fromJSON(const Json::Value& s,SetDisplayLayout& e); + static Json::Value toJSON(const SetDisplayLayout& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetDisplayLayoutResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetDisplayLayoutResponse.cpp new file mode 100644 index 000000000..79b35a1d2 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetDisplayLayoutResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetDisplayLayoutResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +SetDisplayLayoutResponse& SetDisplayLayoutResponse::operator =(const SetDisplayLayoutResponse& c) +{ + return *this; +} + + +SetDisplayLayoutResponse::~SetDisplayLayoutResponse(void) +{ +} + + +SetDisplayLayoutResponse::SetDisplayLayoutResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SETDISPLAYLAYOUTRESPONSE) +{ +} + + +SetDisplayLayoutResponse::SetDisplayLayoutResponse(const SetDisplayLayoutResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SETDISPLAYLAYOUTRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool SetDisplayLayoutResponse::checkIntegrity(void) +{ + return SetDisplayLayoutResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetDisplayLayoutResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetDisplayLayoutResponseMarshaller.cpp new file mode 100644 index 000000000..dd52e08f7 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetDisplayLayoutResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetDisplayLayoutResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/SetDisplayLayoutResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool SetDisplayLayoutResponseMarshaller::checkIntegrity(SetDisplayLayoutResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool SetDisplayLayoutResponseMarshaller::fromString(const std::string& s,SetDisplayLayoutResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string SetDisplayLayoutResponseMarshaller::toString(const SetDisplayLayoutResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SetDisplayLayoutResponseMarshaller::checkIntegrityConst(const SetDisplayLayoutResponse& s) +{ + return true; +} + + +Json::Value SetDisplayLayoutResponseMarshaller::toJSON(const SetDisplayLayoutResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.SetDisplayLayoutResponse"); + + return json; +} + + +bool SetDisplayLayoutResponseMarshaller::fromJSON(const Json::Value& json,SetDisplayLayoutResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.SetDisplayLayoutResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetDisplayLayoutResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetDisplayLayoutResponseMarshaller.h new file mode 100644 index 000000000..9e8e25a92 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetDisplayLayoutResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_SETDISPLAYLAYOUTRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_SETDISPLAYLAYOUTRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetDisplayLayoutResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct SetDisplayLayoutResponseMarshaller + { + static bool checkIntegrity(SetDisplayLayoutResponse& e); + static bool checkIntegrityConst(const SetDisplayLayoutResponse& e); + + static bool fromString(const std::string& s,SetDisplayLayoutResponse& e); + static const std::string toString(const SetDisplayLayoutResponse& e); + + static bool fromJSON(const Json::Value& s,SetDisplayLayoutResponse& e); + static Json::Value toJSON(const SetDisplayLayoutResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetGlobalProperties.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetGlobalProperties.cpp new file mode 100644 index 000000000..ed014c13e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetGlobalProperties.cpp @@ -0,0 +1,173 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetGlobalProperties.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +SetGlobalProperties& SetGlobalProperties::operator =(const SetGlobalProperties& c) +{ + if(helpPrompt) delete helpPrompt; + helpPrompt= c.helpPrompt ? new std::vector<NsSmartDeviceLinkRPCV2::TTSChunk>(c.helpPrompt[0]) : 0; + if(timeoutPrompt) delete timeoutPrompt; + timeoutPrompt= c.timeoutPrompt ? new std::vector<NsSmartDeviceLinkRPCV2::TTSChunk>(c.timeoutPrompt[0]) : 0; + if(vrHelpTitle) delete vrHelpTitle; + vrHelpTitle= c.vrHelpTitle ? new std::string(c.vrHelpTitle[0]) : 0; + if(vrHelp) delete vrHelp; + vrHelp= c.vrHelp ? new std::vector<NsSmartDeviceLinkRPCV2::VrHelpItem>(c.vrHelp[0]) : 0; + appId=c.appId; + return *this; +} + + +SetGlobalProperties::~SetGlobalProperties(void) +{ + if(helpPrompt) delete helpPrompt; + if(timeoutPrompt) delete timeoutPrompt; + if(vrHelpTitle) delete vrHelpTitle; + if(vrHelp) delete vrHelp; +} + + +SetGlobalProperties::SetGlobalProperties(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SETGLOBALPROPERTIES), + helpPrompt(0), + timeoutPrompt(0), + vrHelpTitle(0), + vrHelp(0) +{ +} + + +SetGlobalProperties::SetGlobalProperties(const SetGlobalProperties& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SETGLOBALPROPERTIES,c.getId()) +{ + *this=c; +} + + +const std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>* SetGlobalProperties::get_helpPrompt(void) +{ + return helpPrompt; +} + +bool SetGlobalProperties::set_helpPrompt(const std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>& helpPrompt_) +{ + if(helpPrompt) delete helpPrompt; + helpPrompt=new std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>(helpPrompt_); + return true; +} + +void SetGlobalProperties::reset_helpPrompt(void) +{ + if(helpPrompt) delete helpPrompt; + helpPrompt=0; +} + +const std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>* SetGlobalProperties::get_timeoutPrompt(void) +{ + return timeoutPrompt; +} + +bool SetGlobalProperties::set_timeoutPrompt(const std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>& timeoutPrompt_) +{ + if(timeoutPrompt) delete timeoutPrompt; + timeoutPrompt=new std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>(timeoutPrompt_); + return true; +} + +void SetGlobalProperties::reset_timeoutPrompt(void) +{ + if(timeoutPrompt) delete timeoutPrompt; + timeoutPrompt=0; +} + +const std::string* SetGlobalProperties::get_vrHelpTitle(void) +{ + return vrHelpTitle; +} + +bool SetGlobalProperties::set_vrHelpTitle(const std::string& vrHelpTitle_) +{ + if(vrHelpTitle) delete vrHelpTitle; + vrHelpTitle=new std::string(vrHelpTitle_); + return true; +} + +void SetGlobalProperties::reset_vrHelpTitle(void) +{ + if(vrHelpTitle) delete vrHelpTitle; + vrHelpTitle=0; +} + +const std::vector< NsSmartDeviceLinkRPCV2::VrHelpItem>* SetGlobalProperties::get_vrHelp(void) +{ + return vrHelp; +} + +bool SetGlobalProperties::set_vrHelp(const std::vector< NsSmartDeviceLinkRPCV2::VrHelpItem>& vrHelp_) +{ + if(vrHelp) delete vrHelp; + vrHelp=new std::vector< NsSmartDeviceLinkRPCV2::VrHelpItem>(vrHelp_); + return true; +} + +void SetGlobalProperties::reset_vrHelp(void) +{ + if(vrHelp) delete vrHelp; + vrHelp=0; +} + +int SetGlobalProperties::get_appId(void) +{ + return appId; +} + +bool SetGlobalProperties::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool SetGlobalProperties::checkIntegrity(void) +{ + return SetGlobalPropertiesMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetGlobalPropertiesMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetGlobalPropertiesMarshaller.cpp new file mode 100644 index 000000000..49e0df40a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetGlobalPropertiesMarshaller.cpp @@ -0,0 +1,242 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetGlobalProperties.h" +#include "../src/SDLRPCObjectsImpl/V2/TTSChunkMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/TTSChunkMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/VrHelpItemMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/SetGlobalPropertiesMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool SetGlobalPropertiesMarshaller::checkIntegrity(SetGlobalProperties& s) +{ + return checkIntegrityConst(s); +} + + +bool SetGlobalPropertiesMarshaller::fromString(const std::string& s,SetGlobalProperties& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string SetGlobalPropertiesMarshaller::toString(const SetGlobalProperties& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SetGlobalPropertiesMarshaller::checkIntegrityConst(const SetGlobalProperties& s) +{ + if(s.helpPrompt) + { + unsigned int i=s.helpPrompt[0].size(); + if(i<1) return false; + if(i>100) return false; + } + + if(s.timeoutPrompt) + { + unsigned int i=s.timeoutPrompt[0].size(); + if(i<1) return false; + if(i>100) return false; + } + + if(s.vrHelpTitle && (s.vrHelpTitle[0].length()>500)) return false; + + if(s.vrHelp) + { + unsigned int i=s.vrHelp[0].size(); + if(i<1) return false; + if(i>100) return false; + } + + return true; +} + + +Json::Value SetGlobalPropertiesMarshaller::toJSON(const SetGlobalProperties& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.SetGlobalProperties"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + if(e.helpPrompt) + { + unsigned int i=e.helpPrompt[0].size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::TTSChunkMarshaller::toJSON(e.helpPrompt[0][i]); + + json["params"]["helpPrompt"]=j; + } + if(e.timeoutPrompt) + { + unsigned int i=e.timeoutPrompt[0].size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::TTSChunkMarshaller::toJSON(e.timeoutPrompt[0][i]); + + json["params"]["timeoutPrompt"]=j; + } + if(e.vrHelpTitle) + json["params"]["vrHelpTitle"]=Json::Value(e.vrHelpTitle[0]);; + if(e.vrHelp) + { + unsigned int i=e.vrHelp[0].size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::VrHelpItemMarshaller::toJSON(e.vrHelp[0][i]); + + json["params"]["vrHelp"]=j; + } + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool SetGlobalPropertiesMarshaller::fromJSON(const Json::Value& json,SetGlobalProperties& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.SetGlobalProperties")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(c.helpPrompt) delete c.helpPrompt; + c.helpPrompt=0; + if(js.isMember("helpPrompt")) + { + if(!js["helpPrompt"].isArray()) return false; + unsigned int i=js["helpPrompt"].size(); + if(i<1) return false; + if(i>100) return false; + + c.helpPrompt=new std::vector<NsSmartDeviceLinkRPCV2::TTSChunk>(); + c.helpPrompt->resize(js["helpPrompt"].size()); + + while(i--) + if(!NsSmartDeviceLinkRPCV2::TTSChunkMarshaller::fromJSON(js["helpPrompt"][i],c.helpPrompt[0][i])) return false; + } + + + if(c.timeoutPrompt) delete c.timeoutPrompt; + c.timeoutPrompt=0; + if(js.isMember("timeoutPrompt")) + { + if(!js["timeoutPrompt"].isArray()) return false; + unsigned int i=js["timeoutPrompt"].size(); + if(i<1) return false; + if(i>100) return false; + + c.timeoutPrompt=new std::vector<NsSmartDeviceLinkRPCV2::TTSChunk>(); + c.timeoutPrompt->resize(js["timeoutPrompt"].size()); + + while(i--) + if(!NsSmartDeviceLinkRPCV2::TTSChunkMarshaller::fromJSON(js["timeoutPrompt"][i],c.timeoutPrompt[0][i])) return false; + } + + + if(c.vrHelpTitle) delete c.vrHelpTitle; + c.vrHelpTitle=0; + if(js.isMember("vrHelpTitle")) + { + if(!js["vrHelpTitle"].isString()) return false; + c.vrHelpTitle=new std::string(); + c.vrHelpTitle[0]=js["vrHelpTitle"].asString(); + if(c.vrHelpTitle[0].length()>500) return false; + + } + + if(c.vrHelp) delete c.vrHelp; + c.vrHelp=0; + if(js.isMember("vrHelp")) + { + if(!js["vrHelp"].isArray()) return false; + unsigned int i=js["vrHelp"].size(); + if(i<1) return false; + if(i>100) return false; + + c.vrHelp=new std::vector<NsSmartDeviceLinkRPCV2::VrHelpItem>(); + c.vrHelp->resize(js["vrHelp"].size()); + + while(i--) + if(!NsSmartDeviceLinkRPCV2::VrHelpItemMarshaller::fromJSON(js["vrHelp"][i],c.vrHelp[0][i])) return false; + } + + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetGlobalPropertiesMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetGlobalPropertiesMarshaller.h new file mode 100644 index 000000000..f61f004ad --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetGlobalPropertiesMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_SETGLOBALPROPERTIESMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_SETGLOBALPROPERTIESMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetGlobalProperties.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct SetGlobalPropertiesMarshaller + { + static bool checkIntegrity(SetGlobalProperties& e); + static bool checkIntegrityConst(const SetGlobalProperties& e); + + static bool fromString(const std::string& s,SetGlobalProperties& e); + static const std::string toString(const SetGlobalProperties& e); + + static bool fromJSON(const Json::Value& s,SetGlobalProperties& e); + static Json::Value toJSON(const SetGlobalProperties& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetGlobalPropertiesResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetGlobalPropertiesResponse.cpp new file mode 100644 index 000000000..302d7b667 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetGlobalPropertiesResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetGlobalPropertiesResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +SetGlobalPropertiesResponse& SetGlobalPropertiesResponse::operator =(const SetGlobalPropertiesResponse& c) +{ + return *this; +} + + +SetGlobalPropertiesResponse::~SetGlobalPropertiesResponse(void) +{ +} + + +SetGlobalPropertiesResponse::SetGlobalPropertiesResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SETGLOBALPROPERTIESRESPONSE) +{ +} + + +SetGlobalPropertiesResponse::SetGlobalPropertiesResponse(const SetGlobalPropertiesResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SETGLOBALPROPERTIESRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool SetGlobalPropertiesResponse::checkIntegrity(void) +{ + return SetGlobalPropertiesResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetGlobalPropertiesResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetGlobalPropertiesResponseMarshaller.cpp new file mode 100644 index 000000000..653429e20 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetGlobalPropertiesResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetGlobalPropertiesResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/SetGlobalPropertiesResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool SetGlobalPropertiesResponseMarshaller::checkIntegrity(SetGlobalPropertiesResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool SetGlobalPropertiesResponseMarshaller::fromString(const std::string& s,SetGlobalPropertiesResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string SetGlobalPropertiesResponseMarshaller::toString(const SetGlobalPropertiesResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SetGlobalPropertiesResponseMarshaller::checkIntegrityConst(const SetGlobalPropertiesResponse& s) +{ + return true; +} + + +Json::Value SetGlobalPropertiesResponseMarshaller::toJSON(const SetGlobalPropertiesResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.SetGlobalPropertiesResponse"); + + return json; +} + + +bool SetGlobalPropertiesResponseMarshaller::fromJSON(const Json::Value& json,SetGlobalPropertiesResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.SetGlobalPropertiesResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetGlobalPropertiesResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetGlobalPropertiesResponseMarshaller.h new file mode 100644 index 000000000..5c0828dad --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetGlobalPropertiesResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_SETGLOBALPROPERTIESRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_SETGLOBALPROPERTIESRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetGlobalPropertiesResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct SetGlobalPropertiesResponseMarshaller + { + static bool checkIntegrity(SetGlobalPropertiesResponse& e); + static bool checkIntegrityConst(const SetGlobalPropertiesResponse& e); + + static bool fromString(const std::string& s,SetGlobalPropertiesResponse& e); + static const std::string toString(const SetGlobalPropertiesResponse& e); + + static bool fromJSON(const Json::Value& s,SetGlobalPropertiesResponse& e); + static Json::Value toJSON(const SetGlobalPropertiesResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetMediaClockTimer.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetMediaClockTimer.cpp new file mode 100644 index 000000000..4c51da9af --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetMediaClockTimer.cpp @@ -0,0 +1,119 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetMediaClockTimer.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +SetMediaClockTimer& SetMediaClockTimer::operator =(const SetMediaClockTimer& c) +{ + if(startTime) delete startTime; + startTime= c.startTime ? new NsSmartDeviceLinkRPCV2::StartTime(c.startTime[0]) : 0; + updateMode=c.updateMode; + appId=c.appId; + return *this; +} + + +SetMediaClockTimer::~SetMediaClockTimer(void) +{ + if(startTime) delete startTime; +} + + +SetMediaClockTimer::SetMediaClockTimer(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SETMEDIACLOCKTIMER), + startTime(0) +{ +} + + +SetMediaClockTimer::SetMediaClockTimer(const SetMediaClockTimer& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SETMEDIACLOCKTIMER,c.getId()) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::StartTime* SetMediaClockTimer::get_startTime(void) +{ + return startTime; +} + +bool SetMediaClockTimer::set_startTime(const NsSmartDeviceLinkRPCV2::StartTime& startTime_) +{ + if(startTime) delete startTime; + startTime=new NsSmartDeviceLinkRPCV2::StartTime(startTime_); + return true; +} + +void SetMediaClockTimer::reset_startTime(void) +{ + if(startTime) delete startTime; + startTime=0; +} + +const NsSmartDeviceLinkRPCV2::UpdateMode& SetMediaClockTimer::get_updateMode(void) +{ + return updateMode; +} + +bool SetMediaClockTimer::set_updateMode(const NsSmartDeviceLinkRPCV2::UpdateMode& updateMode_) +{ + updateMode=updateMode_; + return true; +} + +int SetMediaClockTimer::get_appId(void) +{ + return appId; +} + +bool SetMediaClockTimer::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool SetMediaClockTimer::checkIntegrity(void) +{ + return SetMediaClockTimerMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetMediaClockTimerMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetMediaClockTimerMarshaller.cpp new file mode 100644 index 000000000..08c6b4c5d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetMediaClockTimerMarshaller.cpp @@ -0,0 +1,141 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetMediaClockTimer.h" +#include "../src/SDLRPCObjectsImpl/V2/StartTimeMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/UpdateModeMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/SetMediaClockTimerMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool SetMediaClockTimerMarshaller::checkIntegrity(SetMediaClockTimer& s) +{ + return checkIntegrityConst(s); +} + + +bool SetMediaClockTimerMarshaller::fromString(const std::string& s,SetMediaClockTimer& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string SetMediaClockTimerMarshaller::toString(const SetMediaClockTimer& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SetMediaClockTimerMarshaller::checkIntegrityConst(const SetMediaClockTimer& s) +{ + if(s.startTime && (!NsSmartDeviceLinkRPCV2::StartTimeMarshaller::checkIntegrityConst(s.startTime[0]))) return false; + + if(!NsSmartDeviceLinkRPCV2::UpdateModeMarshaller::checkIntegrityConst(s.updateMode)) return false; + + return true; +} + + +Json::Value SetMediaClockTimerMarshaller::toJSON(const SetMediaClockTimer& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.SetMediaClockTimer"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + if(e.startTime) + json["params"]["startTime"]=NsSmartDeviceLinkRPCV2::StartTimeMarshaller::toJSON(e.startTime[0]);; + json["params"]["updateMode"]=NsSmartDeviceLinkRPCV2::UpdateModeMarshaller::toJSON(e.updateMode);; + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool SetMediaClockTimerMarshaller::fromJSON(const Json::Value& json,SetMediaClockTimer& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.SetMediaClockTimer")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(c.startTime) delete c.startTime; + c.startTime=0; + if(js.isMember("startTime")) + { + c.startTime=new NsSmartDeviceLinkRPCV2::StartTime(); + if(!NsSmartDeviceLinkRPCV2::StartTimeMarshaller::fromJSON(js["startTime"],c.startTime[0])) return false; + } + + if(!js.isMember("updateMode") || !NsSmartDeviceLinkRPCV2::UpdateModeMarshaller::fromJSON(js["updateMode"],c.updateMode)) return false; + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetMediaClockTimerMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetMediaClockTimerMarshaller.h new file mode 100644 index 000000000..b6efc75da --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetMediaClockTimerMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_SETMEDIACLOCKTIMERMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_SETMEDIACLOCKTIMERMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetMediaClockTimer.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct SetMediaClockTimerMarshaller + { + static bool checkIntegrity(SetMediaClockTimer& e); + static bool checkIntegrityConst(const SetMediaClockTimer& e); + + static bool fromString(const std::string& s,SetMediaClockTimer& e); + static const std::string toString(const SetMediaClockTimer& e); + + static bool fromJSON(const Json::Value& s,SetMediaClockTimer& e); + static Json::Value toJSON(const SetMediaClockTimer& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetMediaClockTimerResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetMediaClockTimerResponse.cpp new file mode 100644 index 000000000..7f3a4504b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetMediaClockTimerResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetMediaClockTimerResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +SetMediaClockTimerResponse& SetMediaClockTimerResponse::operator =(const SetMediaClockTimerResponse& c) +{ + return *this; +} + + +SetMediaClockTimerResponse::~SetMediaClockTimerResponse(void) +{ +} + + +SetMediaClockTimerResponse::SetMediaClockTimerResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SETMEDIACLOCKTIMERRESPONSE) +{ +} + + +SetMediaClockTimerResponse::SetMediaClockTimerResponse(const SetMediaClockTimerResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SETMEDIACLOCKTIMERRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool SetMediaClockTimerResponse::checkIntegrity(void) +{ + return SetMediaClockTimerResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetMediaClockTimerResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetMediaClockTimerResponseMarshaller.cpp new file mode 100644 index 000000000..9ab8aa7ea --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetMediaClockTimerResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetMediaClockTimerResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/SetMediaClockTimerResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool SetMediaClockTimerResponseMarshaller::checkIntegrity(SetMediaClockTimerResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool SetMediaClockTimerResponseMarshaller::fromString(const std::string& s,SetMediaClockTimerResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string SetMediaClockTimerResponseMarshaller::toString(const SetMediaClockTimerResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SetMediaClockTimerResponseMarshaller::checkIntegrityConst(const SetMediaClockTimerResponse& s) +{ + return true; +} + + +Json::Value SetMediaClockTimerResponseMarshaller::toJSON(const SetMediaClockTimerResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.SetMediaClockTimerResponse"); + + return json; +} + + +bool SetMediaClockTimerResponseMarshaller::fromJSON(const Json::Value& json,SetMediaClockTimerResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.SetMediaClockTimerResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetMediaClockTimerResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetMediaClockTimerResponseMarshaller.h new file mode 100644 index 000000000..16a912e29 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetMediaClockTimerResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_SETMEDIACLOCKTIMERRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_SETMEDIACLOCKTIMERRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetMediaClockTimerResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct SetMediaClockTimerResponseMarshaller + { + static bool checkIntegrity(SetMediaClockTimerResponse& e); + static bool checkIntegrityConst(const SetMediaClockTimerResponse& e); + + static bool fromString(const std::string& s,SetMediaClockTimerResponse& e); + static const std::string toString(const SetMediaClockTimerResponse& e); + + static bool fromJSON(const Json::Value& s,SetMediaClockTimerResponse& e); + static Json::Value toJSON(const SetMediaClockTimerResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/Show.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/Show.cpp new file mode 100644 index 000000000..d518a8af5 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/Show.cpp @@ -0,0 +1,327 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/Show.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +Show& Show::operator =(const Show& c) +{ + if(mainField1) delete mainField1; + mainField1= c.mainField1 ? new std::string(c.mainField1[0]) : 0; + if(mainField2) delete mainField2; + mainField2= c.mainField2 ? new std::string(c.mainField2[0]) : 0; + if(mainField3) delete mainField3; + mainField3= c.mainField3 ? new std::string(c.mainField3[0]) : 0; + if(mainField4) delete mainField4; + mainField4= c.mainField4 ? new std::string(c.mainField4[0]) : 0; + if(alignment) delete alignment; + alignment= c.alignment ? new NsSmartDeviceLinkRPCV2::TextAlignment(c.alignment[0]) : 0; + if(statusBar) delete statusBar; + statusBar= c.statusBar ? new std::string(c.statusBar[0]) : 0; + if(mediaClock) delete mediaClock; + mediaClock= c.mediaClock ? new std::string(c.mediaClock[0]) : 0; + if(mediaTrack) delete mediaTrack; + mediaTrack= c.mediaTrack ? new std::string(c.mediaTrack[0]) : 0; + if(graphic) delete graphic; + graphic= c.graphic ? new NsSmartDeviceLinkRPCV2::Image(c.graphic[0]) : 0; + if(softButtons) delete softButtons; + softButtons= c.softButtons ? new std::vector<NsSmartDeviceLinkRPCV2::SoftButton>(c.softButtons[0]) : 0; + if(customPresets) delete customPresets; + customPresets= c.customPresets ? new std::vector<std::string>(c.customPresets[0]) : 0; + appId=c.appId; + return *this; +} + + +Show::~Show(void) +{ + if(mainField1) delete mainField1; + if(mainField2) delete mainField2; + if(mainField3) delete mainField3; + if(mainField4) delete mainField4; + if(alignment) delete alignment; + if(statusBar) delete statusBar; + if(mediaClock) delete mediaClock; + if(mediaTrack) delete mediaTrack; + if(graphic) delete graphic; + if(softButtons) delete softButtons; + if(customPresets) delete customPresets; +} + + +Show::Show(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SHOW), + mainField1(0), + mainField2(0), + mainField3(0), + mainField4(0), + alignment(0), + statusBar(0), + mediaClock(0), + mediaTrack(0), + graphic(0), + softButtons(0), + customPresets(0) +{ +} + + +Show::Show(const Show& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SHOW,c.getId()) +{ + *this=c; +} + + +const std::string* Show::get_mainField1(void) +{ + return mainField1; +} + +bool Show::set_mainField1(const std::string& mainField1_) +{ + if(mainField1) delete mainField1; + mainField1=new std::string(mainField1_); + return true; +} + +void Show::reset_mainField1(void) +{ + if(mainField1) delete mainField1; + mainField1=0; +} + +const std::string* Show::get_mainField2(void) +{ + return mainField2; +} + +bool Show::set_mainField2(const std::string& mainField2_) +{ + if(mainField2) delete mainField2; + mainField2=new std::string(mainField2_); + return true; +} + +void Show::reset_mainField2(void) +{ + if(mainField2) delete mainField2; + mainField2=0; +} + +const std::string* Show::get_mainField3(void) +{ + return mainField3; +} + +bool Show::set_mainField3(const std::string& mainField3_) +{ + if(mainField3) delete mainField3; + mainField3=new std::string(mainField3_); + return true; +} + +void Show::reset_mainField3(void) +{ + if(mainField3) delete mainField3; + mainField3=0; +} + +const std::string* Show::get_mainField4(void) +{ + return mainField4; +} + +bool Show::set_mainField4(const std::string& mainField4_) +{ + if(mainField4) delete mainField4; + mainField4=new std::string(mainField4_); + return true; +} + +void Show::reset_mainField4(void) +{ + if(mainField4) delete mainField4; + mainField4=0; +} + +const NsSmartDeviceLinkRPCV2::TextAlignment* Show::get_alignment(void) +{ + return alignment; +} + +bool Show::set_alignment(const NsSmartDeviceLinkRPCV2::TextAlignment& alignment_) +{ + if(alignment) delete alignment; + alignment=new NsSmartDeviceLinkRPCV2::TextAlignment(alignment_); + return true; +} + +void Show::reset_alignment(void) +{ + if(alignment) delete alignment; + alignment=0; +} + +const std::string* Show::get_statusBar(void) +{ + return statusBar; +} + +bool Show::set_statusBar(const std::string& statusBar_) +{ + if(statusBar) delete statusBar; + statusBar=new std::string(statusBar_); + return true; +} + +void Show::reset_statusBar(void) +{ + if(statusBar) delete statusBar; + statusBar=0; +} + +const std::string* Show::get_mediaClock(void) +{ + return mediaClock; +} + +bool Show::set_mediaClock(const std::string& mediaClock_) +{ + if(mediaClock) delete mediaClock; + mediaClock=new std::string(mediaClock_); + return true; +} + +void Show::reset_mediaClock(void) +{ + if(mediaClock) delete mediaClock; + mediaClock=0; +} + +const std::string* Show::get_mediaTrack(void) +{ + return mediaTrack; +} + +bool Show::set_mediaTrack(const std::string& mediaTrack_) +{ + if(mediaTrack) delete mediaTrack; + mediaTrack=new std::string(mediaTrack_); + return true; +} + +void Show::reset_mediaTrack(void) +{ + if(mediaTrack) delete mediaTrack; + mediaTrack=0; +} + +const NsSmartDeviceLinkRPCV2::Image* Show::get_graphic(void) +{ + return graphic; +} + +bool Show::set_graphic(const NsSmartDeviceLinkRPCV2::Image& graphic_) +{ + if(graphic) delete graphic; + graphic=new NsSmartDeviceLinkRPCV2::Image(graphic_); + return true; +} + +void Show::reset_graphic(void) +{ + if(graphic) delete graphic; + graphic=0; +} + +const std::vector< NsSmartDeviceLinkRPCV2::SoftButton>* Show::get_softButtons(void) +{ + return softButtons; +} + +bool Show::set_softButtons(const std::vector< NsSmartDeviceLinkRPCV2::SoftButton>& softButtons_) +{ + if(softButtons) delete softButtons; + softButtons=new std::vector< NsSmartDeviceLinkRPCV2::SoftButton>(softButtons_); + return true; +} + +void Show::reset_softButtons(void) +{ + if(softButtons) delete softButtons; + softButtons=0; +} + +const std::vector< std::string>* Show::get_customPresets(void) +{ + return customPresets; +} + +bool Show::set_customPresets(const std::vector< std::string>& customPresets_) +{ + if(customPresets) delete customPresets; + customPresets=new std::vector< std::string>(customPresets_); + return true; +} + +void Show::reset_customPresets(void) +{ + if(customPresets) delete customPresets; + customPresets=0; +} + +int Show::get_appId(void) +{ + return appId; +} + +bool Show::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool Show::checkIntegrity(void) +{ + return ShowMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowConstantTBT.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowConstantTBT.cpp new file mode 100644 index 000000000..255f1e16d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowConstantTBT.cpp @@ -0,0 +1,243 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ShowConstantTBT.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +ShowConstantTBT& ShowConstantTBT::operator =(const ShowConstantTBT& c) +{ + if(navigationText1) delete navigationText1; + navigationText1= c.navigationText1 ? new std::string(c.navigationText1[0]) : 0; + if(navigationText2) delete navigationText2; + navigationText2= c.navigationText2 ? new std::string(c.navigationText2[0]) : 0; + if(eta) delete eta; + eta= c.eta ? new std::string(c.eta[0]) : 0; + if(totalDistance) delete totalDistance; + totalDistance= c.totalDistance ? new std::string(c.totalDistance[0]) : 0; + turnIcon=c.turnIcon; + distanceToManeuver=c.distanceToManeuver; + distanceToManeuverScale=c.distanceToManeuverScale; + if(maneuverComplete) delete maneuverComplete; + maneuverComplete= c.maneuverComplete ? new bool(c.maneuverComplete[0]) : 0; + softButtons=c.softButtons; + appId=c.appId; + return *this; +} + + +ShowConstantTBT::~ShowConstantTBT(void) +{ + if(navigationText1) delete navigationText1; + if(navigationText2) delete navigationText2; + if(eta) delete eta; + if(totalDistance) delete totalDistance; + if(maneuverComplete) delete maneuverComplete; +} + + +ShowConstantTBT::ShowConstantTBT(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SHOWCONSTANTTBT), + navigationText1(0), + navigationText2(0), + eta(0), + totalDistance(0), + maneuverComplete(0) +{ +} + + +ShowConstantTBT::ShowConstantTBT(const ShowConstantTBT& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SHOWCONSTANTTBT,c.getId()) +{ + *this=c; +} + + +const std::string* ShowConstantTBT::get_navigationText1(void) +{ + return navigationText1; +} + +bool ShowConstantTBT::set_navigationText1(const std::string& navigationText1_) +{ + if(navigationText1) delete navigationText1; + navigationText1=new std::string(navigationText1_); + return true; +} + +void ShowConstantTBT::reset_navigationText1(void) +{ + if(navigationText1) delete navigationText1; + navigationText1=0; +} + +const std::string* ShowConstantTBT::get_navigationText2(void) +{ + return navigationText2; +} + +bool ShowConstantTBT::set_navigationText2(const std::string& navigationText2_) +{ + if(navigationText2) delete navigationText2; + navigationText2=new std::string(navigationText2_); + return true; +} + +void ShowConstantTBT::reset_navigationText2(void) +{ + if(navigationText2) delete navigationText2; + navigationText2=0; +} + +const std::string* ShowConstantTBT::get_eta(void) +{ + return eta; +} + +bool ShowConstantTBT::set_eta(const std::string& eta_) +{ + if(eta) delete eta; + eta=new std::string(eta_); + return true; +} + +void ShowConstantTBT::reset_eta(void) +{ + if(eta) delete eta; + eta=0; +} + +const std::string* ShowConstantTBT::get_totalDistance(void) +{ + return totalDistance; +} + +bool ShowConstantTBT::set_totalDistance(const std::string& totalDistance_) +{ + if(totalDistance) delete totalDistance; + totalDistance=new std::string(totalDistance_); + return true; +} + +void ShowConstantTBT::reset_totalDistance(void) +{ + if(totalDistance) delete totalDistance; + totalDistance=0; +} + +const NsSmartDeviceLinkRPCV2::Image& ShowConstantTBT::get_turnIcon(void) +{ + return turnIcon; +} + +bool ShowConstantTBT::set_turnIcon(const NsSmartDeviceLinkRPCV2::Image& turnIcon_) +{ + turnIcon=turnIcon_; + return true; +} + +float ShowConstantTBT::get_distanceToManeuver(void) +{ + return distanceToManeuver; +} + +bool ShowConstantTBT::set_distanceToManeuver(float distanceToManeuver_) +{ + distanceToManeuver=distanceToManeuver_; + return true; +} + +float ShowConstantTBT::get_distanceToManeuverScale(void) +{ + return distanceToManeuverScale; +} + +bool ShowConstantTBT::set_distanceToManeuverScale(float distanceToManeuverScale_) +{ + distanceToManeuverScale=distanceToManeuverScale_; + return true; +} + +const bool* ShowConstantTBT::get_maneuverComplete(void) +{ + return maneuverComplete; +} + +bool ShowConstantTBT::set_maneuverComplete(const bool& maneuverComplete_) +{ + if(maneuverComplete) delete maneuverComplete; + maneuverComplete=new bool(maneuverComplete_); + return true; +} + +void ShowConstantTBT::reset_maneuverComplete(void) +{ + if(maneuverComplete) delete maneuverComplete; + maneuverComplete=0; +} + +const std::vector< NsSmartDeviceLinkRPCV2::SoftButton>& ShowConstantTBT::get_softButtons(void) +{ + return softButtons; +} + +bool ShowConstantTBT::set_softButtons(const std::vector< NsSmartDeviceLinkRPCV2::SoftButton>& softButtons_) +{ + softButtons=softButtons_; + return true; +} + +int ShowConstantTBT::get_appId(void) +{ + return appId; +} + +bool ShowConstantTBT::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool ShowConstantTBT::checkIntegrity(void) +{ + return ShowConstantTBTMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowConstantTBTMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowConstantTBTMarshaller.cpp new file mode 100644 index 000000000..f4e509c08 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowConstantTBTMarshaller.cpp @@ -0,0 +1,245 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ShowConstantTBT.h" +#include "../src/SDLRPCObjectsImpl/V2/ImageMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/SoftButtonMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/ShowConstantTBTMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool ShowConstantTBTMarshaller::checkIntegrity(ShowConstantTBT& s) +{ + return checkIntegrityConst(s); +} + + +bool ShowConstantTBTMarshaller::fromString(const std::string& s,ShowConstantTBT& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string ShowConstantTBTMarshaller::toString(const ShowConstantTBT& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool ShowConstantTBTMarshaller::checkIntegrityConst(const ShowConstantTBT& s) +{ + if(s.navigationText1 && (s.navigationText1[0].length()>500)) return false; + + if(s.navigationText2 && (s.navigationText2[0].length()>500)) return false; + + if(s.eta && (s.eta[0].length()>500)) return false; + + if(s.totalDistance && (s.totalDistance[0].length()>500)) return false; + + if(!NsSmartDeviceLinkRPCV2::ImageMarshaller::checkIntegrityConst(s.turnIcon)) return false; + + if(s.distanceToManeuver<0 || s.distanceToManeuver>1000000000) return false; + + if(s.distanceToManeuverScale<0 || s.distanceToManeuverScale>1000000000) return false; + + { + unsigned int i=s.softButtons.size(); + if(i<0) return false; + if(i>3) return false; + } + + return true; +} + + +Json::Value ShowConstantTBTMarshaller::toJSON(const ShowConstantTBT& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.ShowConstantTBT"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + if(e.navigationText1) + json["params"]["navigationText1"]=Json::Value(e.navigationText1[0]);; + if(e.navigationText2) + json["params"]["navigationText2"]=Json::Value(e.navigationText2[0]);; + if(e.eta) + json["params"]["eta"]=Json::Value(e.eta[0]);; + if(e.totalDistance) + json["params"]["totalDistance"]=Json::Value(e.totalDistance[0]);; + json["params"]["turnIcon"]=NsSmartDeviceLinkRPCV2::ImageMarshaller::toJSON(e.turnIcon);; + json["params"]["distanceToManeuver"]=Json::Value(e.distanceToManeuver);; + json["params"]["distanceToManeuverScale"]=Json::Value(e.distanceToManeuverScale);; + if(e.maneuverComplete) + json["params"]["maneuverComplete"]=Json::Value(e.maneuverComplete[0]);; + { + unsigned int i=e.softButtons.size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::SoftButtonMarshaller::toJSON(e.softButtons[i]); + + json["params"]["softButtons"]=j; + } + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool ShowConstantTBTMarshaller::fromJSON(const Json::Value& json,ShowConstantTBT& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.ShowConstantTBT")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(c.navigationText1) delete c.navigationText1; + c.navigationText1=0; + if(js.isMember("navigationText1")) + { + if(!js["navigationText1"].isString()) return false; + c.navigationText1=new std::string(); + c.navigationText1[0]=js["navigationText1"].asString(); + if(c.navigationText1[0].length()>500) return false; + + } + + if(c.navigationText2) delete c.navigationText2; + c.navigationText2=0; + if(js.isMember("navigationText2")) + { + if(!js["navigationText2"].isString()) return false; + c.navigationText2=new std::string(); + c.navigationText2[0]=js["navigationText2"].asString(); + if(c.navigationText2[0].length()>500) return false; + + } + + if(c.eta) delete c.eta; + c.eta=0; + if(js.isMember("eta")) + { + if(!js["eta"].isString()) return false; + c.eta=new std::string(); + c.eta[0]=js["eta"].asString(); + if(c.eta[0].length()>500) return false; + + } + + if(c.totalDistance) delete c.totalDistance; + c.totalDistance=0; + if(js.isMember("totalDistance")) + { + if(!js["totalDistance"].isString()) return false; + c.totalDistance=new std::string(); + c.totalDistance[0]=js["totalDistance"].asString(); + if(c.totalDistance[0].length()>500) return false; + + } + + if(!js.isMember("turnIcon") || !NsSmartDeviceLinkRPCV2::ImageMarshaller::fromJSON(js["turnIcon"],c.turnIcon)) return false; + + if(!js.isMember("distanceToManeuver") || !js["distanceToManeuver"].isNumeric()) return false; + c.distanceToManeuver=js["distanceToManeuver"].asDouble(); + if(c.distanceToManeuver<0 || c.distanceToManeuver>1000000000) return false; + + if(!js.isMember("distanceToManeuverScale") || !js["distanceToManeuverScale"].isNumeric()) return false; + c.distanceToManeuverScale=js["distanceToManeuverScale"].asDouble(); + if(c.distanceToManeuverScale<0 || c.distanceToManeuverScale>1000000000) return false; + + if(c.maneuverComplete) delete c.maneuverComplete; + c.maneuverComplete=0; + if(js.isMember("maneuverComplete")) + { + if(!js["maneuverComplete"].isBool()) return false; + c.maneuverComplete=new bool(); + c.maneuverComplete[0]=js["maneuverComplete"].asBool(); + + } + + if(!js.isMember("softButtons") || !js["softButtons"].isArray()) return false; + { + unsigned int i=js["softButtons"].size(); + if(i<0) return false; + if(i>3) return false; + c.softButtons.resize(i); + while(i--) + { + NsSmartDeviceLinkRPCV2::SoftButton t; + if(!NsSmartDeviceLinkRPCV2::SoftButtonMarshaller::fromJSON(js["softButtons"][i],t)) + return false; + c.softButtons[i]=t; + } + } + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowConstantTBTMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowConstantTBTMarshaller.h new file mode 100644 index 000000000..dfeef7eef --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowConstantTBTMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_SHOWCONSTANTTBTMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_SHOWCONSTANTTBTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ShowConstantTBT.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct ShowConstantTBTMarshaller + { + static bool checkIntegrity(ShowConstantTBT& e); + static bool checkIntegrityConst(const ShowConstantTBT& e); + + static bool fromString(const std::string& s,ShowConstantTBT& e); + static const std::string toString(const ShowConstantTBT& e); + + static bool fromJSON(const Json::Value& s,ShowConstantTBT& e); + static Json::Value toJSON(const ShowConstantTBT& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowConstantTBTResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowConstantTBTResponse.cpp new file mode 100644 index 000000000..2db452e5d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowConstantTBTResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ShowConstantTBTResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +ShowConstantTBTResponse& ShowConstantTBTResponse::operator =(const ShowConstantTBTResponse& c) +{ + return *this; +} + + +ShowConstantTBTResponse::~ShowConstantTBTResponse(void) +{ +} + + +ShowConstantTBTResponse::ShowConstantTBTResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SHOWCONSTANTTBTRESPONSE) +{ +} + + +ShowConstantTBTResponse::ShowConstantTBTResponse(const ShowConstantTBTResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SHOWCONSTANTTBTRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool ShowConstantTBTResponse::checkIntegrity(void) +{ + return ShowConstantTBTResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowConstantTBTResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowConstantTBTResponseMarshaller.cpp new file mode 100644 index 000000000..e74ea5850 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowConstantTBTResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ShowConstantTBTResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/ShowConstantTBTResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool ShowConstantTBTResponseMarshaller::checkIntegrity(ShowConstantTBTResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool ShowConstantTBTResponseMarshaller::fromString(const std::string& s,ShowConstantTBTResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string ShowConstantTBTResponseMarshaller::toString(const ShowConstantTBTResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool ShowConstantTBTResponseMarshaller::checkIntegrityConst(const ShowConstantTBTResponse& s) +{ + return true; +} + + +Json::Value ShowConstantTBTResponseMarshaller::toJSON(const ShowConstantTBTResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.ShowConstantTBTResponse"); + + return json; +} + + +bool ShowConstantTBTResponseMarshaller::fromJSON(const Json::Value& json,ShowConstantTBTResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.ShowConstantTBTResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowConstantTBTResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowConstantTBTResponseMarshaller.h new file mode 100644 index 000000000..9205828d6 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowConstantTBTResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_SHOWCONSTANTTBTRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_SHOWCONSTANTTBTRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ShowConstantTBTResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct ShowConstantTBTResponseMarshaller + { + static bool checkIntegrity(ShowConstantTBTResponse& e); + static bool checkIntegrityConst(const ShowConstantTBTResponse& e); + + static bool fromString(const std::string& s,ShowConstantTBTResponse& e); + static const std::string toString(const ShowConstantTBTResponse& e); + + static bool fromJSON(const Json::Value& s,ShowConstantTBTResponse& e); + static Json::Value toJSON(const ShowConstantTBTResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowMarshaller.cpp new file mode 100644 index 000000000..6b273bcab --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowMarshaller.cpp @@ -0,0 +1,332 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/Show.h" +#include "../src/SDLRPCObjectsImpl/V2/TextAlignmentMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ImageMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/SoftButtonMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/ShowMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool ShowMarshaller::checkIntegrity(Show& s) +{ + return checkIntegrityConst(s); +} + + +bool ShowMarshaller::fromString(const std::string& s,Show& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string ShowMarshaller::toString(const Show& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool ShowMarshaller::checkIntegrityConst(const Show& s) +{ + if(s.mainField1 && (s.mainField1[0].length()>500)) return false; + + if(s.mainField2 && (s.mainField2[0].length()>500)) return false; + + if(s.mainField3 && (s.mainField3[0].length()>500)) return false; + + if(s.mainField4 && (s.mainField4[0].length()>500)) return false; + + if(s.alignment && (!NsSmartDeviceLinkRPCV2::TextAlignmentMarshaller::checkIntegrityConst(s.alignment[0]))) return false; + + if(s.statusBar && (s.statusBar[0].length()>500)) return false; + + if(s.mediaClock && (s.mediaClock[0].length()>500)) return false; + + if(s.mediaTrack && (s.mediaTrack[0].length()>500)) return false; + + if(s.graphic && (!NsSmartDeviceLinkRPCV2::ImageMarshaller::checkIntegrityConst(s.graphic[0]))) return false; + + if(s.softButtons) + { + unsigned int i=s.softButtons[0].size(); + if(i<0) return false; + if(i>8) return false; + } + + if(s.customPresets) + { + unsigned int i=s.customPresets[0].size(); + if(i<0) return false; + if(i>6) return false; + while(i--) + { + if(s.customPresets[0][i].length()>500) return false; + } + } + + return true; +} + + +Json::Value ShowMarshaller::toJSON(const Show& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.Show"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + if(e.mainField1) + json["params"]["mainField1"]=Json::Value(e.mainField1[0]);; + if(e.mainField2) + json["params"]["mainField2"]=Json::Value(e.mainField2[0]);; + if(e.mainField3) + json["params"]["mainField3"]=Json::Value(e.mainField3[0]);; + if(e.mainField4) + json["params"]["mainField4"]=Json::Value(e.mainField4[0]);; + if(e.alignment) + json["params"]["alignment"]=NsSmartDeviceLinkRPCV2::TextAlignmentMarshaller::toJSON(e.alignment[0]);; + if(e.statusBar) + json["params"]["statusBar"]=Json::Value(e.statusBar[0]);; + if(e.mediaClock) + json["params"]["mediaClock"]=Json::Value(e.mediaClock[0]);; + if(e.mediaTrack) + json["params"]["mediaTrack"]=Json::Value(e.mediaTrack[0]);; + if(e.graphic) + json["params"]["graphic"]=NsSmartDeviceLinkRPCV2::ImageMarshaller::toJSON(e.graphic[0]);; + if(e.softButtons) + { + unsigned int i=e.softButtons[0].size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::SoftButtonMarshaller::toJSON(e.softButtons[0][i]); + + json["params"]["softButtons"]=j; + } + if(e.customPresets) + { + unsigned int i=e.customPresets[0].size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=Json::Value(e.customPresets[0][i]); + + json["params"]["customPresets"]=j; + } + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool ShowMarshaller::fromJSON(const Json::Value& json,Show& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.Show")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(c.mainField1) delete c.mainField1; + c.mainField1=0; + if(js.isMember("mainField1")) + { + if(!js["mainField1"].isString()) return false; + c.mainField1=new std::string(); + c.mainField1[0]=js["mainField1"].asString(); + if(c.mainField1[0].length()>500) return false; + + } + + if(c.mainField2) delete c.mainField2; + c.mainField2=0; + if(js.isMember("mainField2")) + { + if(!js["mainField2"].isString()) return false; + c.mainField2=new std::string(); + c.mainField2[0]=js["mainField2"].asString(); + if(c.mainField2[0].length()>500) return false; + + } + + if(c.mainField3) delete c.mainField3; + c.mainField3=0; + if(js.isMember("mainField3")) + { + if(!js["mainField3"].isString()) return false; + c.mainField3=new std::string(); + c.mainField3[0]=js["mainField3"].asString(); + if(c.mainField3[0].length()>500) return false; + + } + + if(c.mainField4) delete c.mainField4; + c.mainField4=0; + if(js.isMember("mainField4")) + { + if(!js["mainField4"].isString()) return false; + c.mainField4=new std::string(); + c.mainField4[0]=js["mainField4"].asString(); + if(c.mainField4[0].length()>500) return false; + + } + + if(c.alignment) delete c.alignment; + c.alignment=0; + if(js.isMember("alignment")) + { + c.alignment=new NsSmartDeviceLinkRPCV2::TextAlignment(); + if(!NsSmartDeviceLinkRPCV2::TextAlignmentMarshaller::fromJSON(js["alignment"],c.alignment[0])) return false; + } + + if(c.statusBar) delete c.statusBar; + c.statusBar=0; + if(js.isMember("statusBar")) + { + if(!js["statusBar"].isString()) return false; + c.statusBar=new std::string(); + c.statusBar[0]=js["statusBar"].asString(); + if(c.statusBar[0].length()>500) return false; + + } + + if(c.mediaClock) delete c.mediaClock; + c.mediaClock=0; + if(js.isMember("mediaClock")) + { + if(!js["mediaClock"].isString()) return false; + c.mediaClock=new std::string(); + c.mediaClock[0]=js["mediaClock"].asString(); + if(c.mediaClock[0].length()>500) return false; + + } + + if(c.mediaTrack) delete c.mediaTrack; + c.mediaTrack=0; + if(js.isMember("mediaTrack")) + { + if(!js["mediaTrack"].isString()) return false; + c.mediaTrack=new std::string(); + c.mediaTrack[0]=js["mediaTrack"].asString(); + if(c.mediaTrack[0].length()>500) return false; + + } + + if(c.graphic) delete c.graphic; + c.graphic=0; + if(js.isMember("graphic")) + { + c.graphic=new NsSmartDeviceLinkRPCV2::Image(); + if(!NsSmartDeviceLinkRPCV2::ImageMarshaller::fromJSON(js["graphic"],c.graphic[0])) return false; + } + + if(c.softButtons) delete c.softButtons; + c.softButtons=0; + if(js.isMember("softButtons")) + { + if(!js["softButtons"].isArray()) return false; + unsigned int i=js["softButtons"].size(); + if(i<0) return false; + if(i>8) return false; + + c.softButtons=new std::vector<NsSmartDeviceLinkRPCV2::SoftButton>(); + c.softButtons->resize(js["softButtons"].size()); + + while(i--) + if(!NsSmartDeviceLinkRPCV2::SoftButtonMarshaller::fromJSON(js["softButtons"][i],c.softButtons[0][i])) return false; + } + + + if(c.customPresets) delete c.customPresets; + c.customPresets=0; + if(js.isMember("customPresets")) + { + if(!js["customPresets"].isArray()) return false; + unsigned int i=js["customPresets"].size(); + if(i<0) return false; + if(i>6) return false; + + c.customPresets=new std::vector<std::string>(); + c.customPresets->resize(js["customPresets"].size()); + + while(i--) + { + if(!js["customPresets"][i].isString()) + return false; + + c.customPresets[0][i]=js["customPresets"][i].asString(); + if(c.customPresets[0][i].length()>500) return false; + } + } + + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowMarshaller.h new file mode 100644 index 000000000..1b41e6683 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_SHOWMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_SHOWMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/Show.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct ShowMarshaller + { + static bool checkIntegrity(Show& e); + static bool checkIntegrityConst(const Show& e); + + static bool fromString(const std::string& s,Show& e); + static const std::string toString(const Show& e); + + static bool fromJSON(const Json::Value& s,Show& e); + static Json::Value toJSON(const Show& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowResponse.cpp new file mode 100644 index 000000000..c129bdc39 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ShowResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +ShowResponse& ShowResponse::operator =(const ShowResponse& c) +{ + return *this; +} + + +ShowResponse::~ShowResponse(void) +{ +} + + +ShowResponse::ShowResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SHOWRESPONSE) +{ +} + + +ShowResponse::ShowResponse(const ShowResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SHOWRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool ShowResponse::checkIntegrity(void) +{ + return ShowResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowResponseMarshaller.cpp new file mode 100644 index 000000000..ebd723ca7 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ShowResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/ShowResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool ShowResponseMarshaller::checkIntegrity(ShowResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool ShowResponseMarshaller::fromString(const std::string& s,ShowResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string ShowResponseMarshaller::toString(const ShowResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool ShowResponseMarshaller::checkIntegrityConst(const ShowResponse& s) +{ + return true; +} + + +Json::Value ShowResponseMarshaller::toJSON(const ShowResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.ShowResponse"); + + return json; +} + + +bool ShowResponseMarshaller::fromJSON(const Json::Value& json,ShowResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.ShowResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowResponseMarshaller.h new file mode 100644 index 000000000..aa5f288bd --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/ShowResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_SHOWRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_SHOWRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/ShowResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct ShowResponseMarshaller + { + static bool checkIntegrity(ShowResponse& e); + static bool checkIntegrityConst(const ShowResponse& e); + + static bool fromString(const std::string& s,ShowResponse& e); + static const std::string toString(const ShowResponse& e); + + static bool fromJSON(const Json::Value& s,ShowResponse& e); + static Json::Value toJSON(const ShowResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/Slider.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/Slider.cpp new file mode 100644 index 000000000..f50aed3c5 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/Slider.cpp @@ -0,0 +1,155 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/Slider.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +Slider& Slider::operator =(const Slider& c) +{ + numTicks=c.numTicks; + position=c.position; + sliderHeader=c.sliderHeader; + if(sliderFooter) delete sliderFooter; + sliderFooter= c.sliderFooter ? new std::vector<std::string>(c.sliderFooter[0]) : 0; + timeout=c.timeout; + appId=c.appId; + return *this; +} + + +Slider::~Slider(void) +{ + if(sliderFooter) delete sliderFooter; +} + + +Slider::Slider(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SLIDER), + sliderFooter(0) +{ +} + + +Slider::Slider(const Slider& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SLIDER,c.getId()) +{ + *this=c; +} + + +unsigned int Slider::get_numTicks(void) +{ + return numTicks; +} + +bool Slider::set_numTicks(unsigned int numTicks_) +{ + numTicks=numTicks_; + return true; +} + +unsigned int Slider::get_position(void) +{ + return position; +} + +bool Slider::set_position(unsigned int position_) +{ + position=position_; + return true; +} + +const std::string& Slider::get_sliderHeader(void) +{ + return sliderHeader; +} + +bool Slider::set_sliderHeader(const std::string& sliderHeader_) +{ + sliderHeader=sliderHeader_; + return true; +} + +const std::vector< std::string>* Slider::get_sliderFooter(void) +{ + return sliderFooter; +} + +bool Slider::set_sliderFooter(const std::vector< std::string>& sliderFooter_) +{ + if(sliderFooter) delete sliderFooter; + sliderFooter=new std::vector< std::string>(sliderFooter_); + return true; +} + +void Slider::reset_sliderFooter(void) +{ + if(sliderFooter) delete sliderFooter; + sliderFooter=0; +} + +unsigned int Slider::get_timeout(void) +{ + return timeout; +} + +bool Slider::set_timeout(unsigned int timeout_) +{ + timeout=timeout_; + return true; +} + +int Slider::get_appId(void) +{ + return appId; +} + +bool Slider::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool Slider::checkIntegrity(void) +{ + return SliderMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SliderMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SliderMarshaller.cpp new file mode 100644 index 000000000..2bcbddfc9 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SliderMarshaller.cpp @@ -0,0 +1,194 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/Slider.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/SliderMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool SliderMarshaller::checkIntegrity(Slider& s) +{ + return checkIntegrityConst(s); +} + + +bool SliderMarshaller::fromString(const std::string& s,Slider& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string SliderMarshaller::toString(const Slider& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SliderMarshaller::checkIntegrityConst(const Slider& s) +{ + if(s.numTicks<2 || s.numTicks>26) return false; + + if(s.position<1 || s.position>26) return false; + + if(s.sliderHeader.length()>500) return false; + + if(s.sliderFooter) + { + unsigned int i=s.sliderFooter[0].size(); + if(i<1) return false; + if(i>26) return false; + while(i--) + { + if(s.sliderFooter[0][i].length()>500) return false; + } + } + + if(s.timeout>65535) return false; + + return true; +} + + +Json::Value SliderMarshaller::toJSON(const Slider& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.Slider"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["numTicks"]=Json::Value(e.numTicks);; + json["params"]["position"]=Json::Value(e.position);; + json["params"]["sliderHeader"]=Json::Value(e.sliderHeader);; + if(e.sliderFooter) + { + unsigned int i=e.sliderFooter[0].size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=Json::Value(e.sliderFooter[0][i]); + + json["params"]["sliderFooter"]=j; + } + json["params"]["timeout"]=Json::Value(e.timeout);; + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool SliderMarshaller::fromJSON(const Json::Value& json,Slider& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.Slider")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(!js.isMember("numTicks") || !js["numTicks"].isInt()) return false; + c.numTicks=js["numTicks"].asInt(); + if(c.numTicks<2 || c.numTicks>26) return false; + + if(!js.isMember("position") || !js["position"].isInt()) return false; + c.position=js["position"].asInt(); + if(c.position<1 || c.position>16) return false; + + if(!js.isMember("sliderHeader") || !js["sliderHeader"].isString()) return false; + c.sliderHeader=js["sliderHeader"].asString(); + if(c.sliderHeader.length()>500) return false; + + if(c.sliderFooter) delete c.sliderFooter; + c.sliderFooter=0; + if(js.isMember("sliderFooter")) + { + if(!js["sliderFooter"].isArray()) return false; + unsigned int i=js["sliderFooter"].size(); + if(i<1) return false; + if(i>26) return false; + + c.sliderFooter=new std::vector<std::string>(); + c.sliderFooter->resize(js["sliderFooter"].size()); + + while(i--) + { + if(!js["sliderFooter"][i].isString()) + return false; + + c.sliderFooter[0][i]=js["sliderFooter"][i].asString(); + if(c.sliderFooter[0][i].length()>500) return false; + } + } + + + if(!js.isMember("timeout") || !js["timeout"].isInt()) return false; + c.timeout=js["timeout"].asInt(); + if(c.timeout>65535) return false; + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SliderMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SliderMarshaller.h new file mode 100644 index 000000000..62087dad0 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SliderMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_SLIDERMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_SLIDERMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/Slider.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct SliderMarshaller + { + static bool checkIntegrity(Slider& e); + static bool checkIntegrityConst(const Slider& e); + + static bool fromString(const std::string& s,Slider& e); + static const std::string toString(const Slider& e); + + static bool fromJSON(const Json::Value& s,Slider& e); + static Json::Value toJSON(const Slider& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SliderResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SliderResponse.cpp new file mode 100644 index 000000000..3350ef5c1 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SliderResponse.cpp @@ -0,0 +1,85 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SliderResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +SliderResponse& SliderResponse::operator =(const SliderResponse& c) +{ + sliderPosition=c.sliderPosition; + return *this; +} + + +SliderResponse::~SliderResponse(void) +{ +} + + +SliderResponse::SliderResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SLIDERRESPONSE) +{ +} + + +SliderResponse::SliderResponse(const SliderResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__SLIDERRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +unsigned int SliderResponse::get_sliderPosition(void) +{ + return sliderPosition; +} + +bool SliderResponse::set_sliderPosition(unsigned int sliderPosition_) +{ + sliderPosition=sliderPosition_; + return true; +} + +bool SliderResponse::checkIntegrity(void) +{ + return SliderResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SliderResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SliderResponseMarshaller.cpp new file mode 100644 index 000000000..2cac2cacb --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SliderResponseMarshaller.cpp @@ -0,0 +1,134 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SliderResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/SliderResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool SliderResponseMarshaller::checkIntegrity(SliderResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool SliderResponseMarshaller::fromString(const std::string& s,SliderResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string SliderResponseMarshaller::toString(const SliderResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SliderResponseMarshaller::checkIntegrityConst(const SliderResponse& s) +{ + if(s.sliderPosition<1 || s.sliderPosition>26) return false; + + return true; +} + + +Json::Value SliderResponseMarshaller::toJSON(const SliderResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.SliderResponse"); + + json["result"]["sliderPosition"]=Json::Value(e.sliderPosition);; + return json; +} + + +bool SliderResponseMarshaller::fromJSON(const Json::Value& json,SliderResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.SliderResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + if(!js.isMember("sliderPosition") || !js["sliderPosition"].isInt()) return false; + c.sliderPosition=js["sliderPosition"].asInt(); + if(c.sliderPosition<1 || c.sliderPosition>26) return false; + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SliderResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SliderResponseMarshaller.h new file mode 100644 index 000000000..f162ec300 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SliderResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_SLIDERRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_SLIDERRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SliderResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct SliderResponseMarshaller + { + static bool checkIntegrity(SliderResponse& e); + static bool checkIntegrityConst(const SliderResponse& e); + + static bool fromString(const std::string& s,SliderResponse& e); + static const std::string toString(const SliderResponse& e); + + static bool fromJSON(const Json::Value& s,SliderResponse& e); + static Json::Value toJSON(const SliderResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/UpdateTurnList.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/UpdateTurnList.cpp new file mode 100644 index 000000000..9b4dbc25e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/UpdateTurnList.cpp @@ -0,0 +1,109 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/UpdateTurnList.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +UpdateTurnList& UpdateTurnList::operator =(const UpdateTurnList& c) +{ + turnList=c.turnList; + softButtons=c.softButtons; + appId=c.appId; + return *this; +} + + +UpdateTurnList::~UpdateTurnList(void) +{ +} + + +UpdateTurnList::UpdateTurnList(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__UPDATETURNLIST) +{ +} + + +UpdateTurnList::UpdateTurnList(const UpdateTurnList& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__UPDATETURNLIST,c.getId()) +{ + *this=c; +} + + +const std::vector< NsSmartDeviceLinkRPCV2::Turn>& UpdateTurnList::get_turnList(void) +{ + return turnList; +} + +bool UpdateTurnList::set_turnList(const std::vector< NsSmartDeviceLinkRPCV2::Turn>& turnList_) +{ + turnList=turnList_; + return true; +} + +const std::vector< NsSmartDeviceLinkRPCV2::SoftButton>& UpdateTurnList::get_softButtons(void) +{ + return softButtons; +} + +bool UpdateTurnList::set_softButtons(const std::vector< NsSmartDeviceLinkRPCV2::SoftButton>& softButtons_) +{ + softButtons=softButtons_; + return true; +} + +int UpdateTurnList::get_appId(void) +{ + return appId; +} + +bool UpdateTurnList::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool UpdateTurnList::checkIntegrity(void) +{ + return UpdateTurnListMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/UpdateTurnListMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/UpdateTurnListMarshaller.cpp new file mode 100644 index 000000000..2ced1056f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/UpdateTurnListMarshaller.cpp @@ -0,0 +1,184 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/UpdateTurnList.h" +#include "../src/SDLRPCObjectsImpl/V2/TurnMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/SoftButtonMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/UpdateTurnListMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool UpdateTurnListMarshaller::checkIntegrity(UpdateTurnList& s) +{ + return checkIntegrityConst(s); +} + + +bool UpdateTurnListMarshaller::fromString(const std::string& s,UpdateTurnList& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string UpdateTurnListMarshaller::toString(const UpdateTurnList& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool UpdateTurnListMarshaller::checkIntegrityConst(const UpdateTurnList& s) +{ + { + unsigned int i=s.turnList.size(); + if(i<1) return false; + if(i>100) return false; + } + + { + unsigned int i=s.softButtons.size(); + if(i<0) return false; + if(i>1) return false; + } + + return true; +} + + +Json::Value UpdateTurnListMarshaller::toJSON(const UpdateTurnList& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("UI.UpdateTurnList"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + { + unsigned int i=e.turnList.size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::TurnMarshaller::toJSON(e.turnList[i]); + + json["params"]["turnList"]=j; + } + { + unsigned int i=e.softButtons.size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::SoftButtonMarshaller::toJSON(e.softButtons[i]); + + json["params"]["softButtons"]=j; + } + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool UpdateTurnListMarshaller::fromJSON(const Json::Value& json,UpdateTurnList& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("method") || !json["method"].isString() || json["method"].asString().compare("UI.UpdateTurnList")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(!js.isMember("turnList") || !js["turnList"].isArray()) return false; + { + unsigned int i=js["turnList"].size(); + if(i<1) return false; + if(i>100) return false; + c.turnList.resize(i); + while(i--) + { + NsSmartDeviceLinkRPCV2::Turn t; + if(!NsSmartDeviceLinkRPCV2::TurnMarshaller::fromJSON(js["turnList"][i],t)) + return false; + c.turnList[i]=t; + } + } + + if(!js.isMember("softButtons") || !js["softButtons"].isArray()) return false; + { + unsigned int i=js["softButtons"].size(); + if(i<0) return false; + if(i>1) return false; + c.softButtons.resize(i); + while(i--) + { + NsSmartDeviceLinkRPCV2::SoftButton t; + if(!NsSmartDeviceLinkRPCV2::SoftButtonMarshaller::fromJSON(js["softButtons"][i],t)) + return false; + c.softButtons[i]=t; + } + } + + if(!js.isMember("appId") || !js["appId"].isInt()) return false; + c.appId=js["appId"].asInt(); + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/UpdateTurnListMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/UpdateTurnListMarshaller.h new file mode 100644 index 000000000..28e3dcbb7 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/UpdateTurnListMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_UPDATETURNLISTMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_UPDATETURNLISTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/UpdateTurnList.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct UpdateTurnListMarshaller + { + static bool checkIntegrity(UpdateTurnList& e); + static bool checkIntegrityConst(const UpdateTurnList& e); + + static bool fromString(const std::string& s,UpdateTurnList& e); + static const std::string toString(const UpdateTurnList& e); + + static bool fromJSON(const Json::Value& s,UpdateTurnList& e); + static Json::Value toJSON(const UpdateTurnList& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/UpdateTurnListResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/UpdateTurnListResponse.cpp new file mode 100644 index 000000000..c54fe06de --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/UpdateTurnListResponse.cpp @@ -0,0 +1,73 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/UpdateTurnListResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + + +UpdateTurnListResponse& UpdateTurnListResponse::operator =(const UpdateTurnListResponse& c) +{ + return *this; +} + + +UpdateTurnListResponse::~UpdateTurnListResponse(void) +{ +} + + +UpdateTurnListResponse::UpdateTurnListResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__UPDATETURNLISTRESPONSE) +{ +} + + +UpdateTurnListResponse::UpdateTurnListResponse(const UpdateTurnListResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_UI__UPDATETURNLISTRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool UpdateTurnListResponse::checkIntegrity(void) +{ + return UpdateTurnListResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/UpdateTurnListResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/UpdateTurnListResponseMarshaller.cpp new file mode 100644 index 000000000..752f82916 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/UpdateTurnListResponseMarshaller.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/UpdateTurnListResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/UI/UpdateTurnListResponseMarshaller.h" + +/* + interface NsRPC2Communication::UI + version 1.2 + generated at Thu Jan 24 06:41:15 2013 + source stamp Wed Jan 23 13:56:28 2013 + author RC +*/ + +using namespace NsRPC2Communication::UI; + +bool UpdateTurnListResponseMarshaller::checkIntegrity(UpdateTurnListResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool UpdateTurnListResponseMarshaller::fromString(const std::string& s,UpdateTurnListResponse& e) +{ + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(!fromJSON(json,e)) return false; + } + catch(...) + { + return false; + } + return true; +} + + +const std::string UpdateTurnListResponseMarshaller::toString(const UpdateTurnListResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool UpdateTurnListResponseMarshaller::checkIntegrityConst(const UpdateTurnListResponse& s) +{ + return true; +} + + +Json::Value UpdateTurnListResponseMarshaller::toJSON(const UpdateTurnListResponse& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["id"]=Json::Value(e.getId()); + json["result"]=Json::Value(Json::objectValue); + NsSmartDeviceLinkRPCV2::Result r(static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(e.getResult())); + json["result"]["resultCode"]=NsSmartDeviceLinkRPCV2::ResultMarshaller::toJSON(r); + json["result"]["method"]=Json::Value("UI.UpdateTurnListResponse"); + + return json; +} + + +bool UpdateTurnListResponseMarshaller::fromJSON(const Json::Value& json,UpdateTurnListResponse& c) +{ + try + { + if(!json.isObject()) return false; + if(!json.isMember("jsonrpc") || !json["jsonrpc"].isString() || json["jsonrpc"].asString().compare("2.0")) return false; + if(!json.isMember("id") || !json["id"].isInt()) return false; + c.setId(json["id"].asInt()); + + if(!json.isMember("result")) return false; + + Json::Value js=json["result"]; + if(!js.isObject()) return false; + + NsSmartDeviceLinkRPCV2::Result r; + if(!js.isMember("resultCode") || !js["resultCode"].isString()) return false; + if(!js.isMember("method") || !js["method"].isString()) return false; + if(js["method"].asString().compare("UI.UpdateTurnListResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/UpdateTurnListResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/UpdateTurnListResponseMarshaller.h new file mode 100644 index 000000000..00b514874 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/UpdateTurnListResponseMarshaller.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef NSRPC2COMMUNICATION_UI_UPDATETURNLISTRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_UI_UPDATETURNLISTRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/UpdateTurnListResponse.h" + +namespace NsRPC2Communication +{ + namespace UI + { + + struct UpdateTurnListResponseMarshaller + { + static bool checkIntegrity(UpdateTurnListResponse& e); + static bool checkIntegrityConst(const UpdateTurnListResponse& e); + + static bool fromString(const std::string& s,UpdateTurnListResponse& e); + static const std::string toString(const UpdateTurnListResponse& e); + + static bool fromJSON(const Json::Value& s,UpdateTurnListResponse& e); + static Json::Value toJSON(const UpdateTurnListResponse& e); + }; + } +} + +#endif |