diff options
author | khburdette <kburdet1@ford.com> | 2013-04-19 15:58:59 -0400 |
---|---|---|
committer | khburdette <kburdet1@ford.com> | 2013-04-19 15:58:59 -0400 |
commit | a46991cd5da4dbcc5510457c6bae2dab340c1ed2 (patch) | |
tree | 9f4d9ccec060c4b6cd378aa631442f710c140962 /SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication | |
download | smartdevicelink-a46991cd5da4dbcc5510457c6bae2dab340c1ed2.tar.gz |
Initial Ford commit with Core and Proxies
Diffstat (limited to 'SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication')
330 files changed, 34222 insertions, 0 deletions
diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/ActivateApp.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/ActivateApp.cpp new file mode 100644 index 000000000..4335f508b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/ActivateApp.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/BasicCommunication/ActivateApp.h" +#include "../src/../include/JSONHandler/RPC2Objects//Marshaller.h" + +/* + interface NsRPC2Communication::SmartDeviceLinkCore + 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::BasicCommunication; + + +ActivateApp& ActivateApp::operator =(const ActivateApp& c) +{ + appName=c.appName; + appId=c.appId; + return *this; +} + + +ActivateApp::~ActivateApp(void) +{ +} + + +ActivateApp::ActivateApp(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__ACTIVATEAPP) +{ +} + + +ActivateApp::ActivateApp(const ActivateApp& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__ACTIVATEAPP,c.getId()) +{ + *this=c; +} + + +const std::string& ActivateApp::get_appName(void) +{ + return appName; +} + +bool ActivateApp::set_appName(const std::string& appName_) +{ + appName=appName_; + return true; +} + +int ActivateApp::get_appId(void) +{ + return appId; +} + +bool ActivateApp::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool ActivateApp::checkIntegrity(void) +{ + return ActivateAppMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/ActivateAppMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/ActivateAppMarshaller.cpp new file mode 100644 index 000000000..7dea99072 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/ActivateAppMarshaller.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 "../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/ActivateApp.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/ActivateAppMarshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + +bool ActivateAppMarshaller::checkIntegrity(ActivateApp& s) +{ + return checkIntegrityConst(s); +} + + +bool ActivateAppMarshaller::fromString(const std::string& s,ActivateApp& 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 ActivateAppMarshaller::toString(const ActivateApp& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool ActivateAppMarshaller::checkIntegrityConst(const ActivateApp& s) +{ + if(s.appName.length()>100) return false; + + return true; +} + + +Json::Value ActivateAppMarshaller::toJSON(const ActivateApp& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("BasicCommunication.ActivateApp"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["appName"]=Json::Value(e.appName);; + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool ActivateAppMarshaller::fromJSON(const Json::Value& json,ActivateApp& 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("BasicCommunication.ActivateApp")) 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("appName") || !js["appName"].isString()) return false; + c.appName=js["appName"].asString(); + if(c.appName.length()>100) 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/BasicCommunication/ActivateAppMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/ActivateAppMarshaller.h new file mode 100644 index 000000000..0cc715cfc --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/ActivateAppMarshaller.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_SMARTDEVICELINKCORE_ACTIVATEAPPMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_SMARTDEVICELINKCORE_ACTIVATEAPPMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/ActivateApp.h" + +namespace NsRPC2Communication +{ + namespace BasicCommunication + { + + struct ActivateAppMarshaller + { + static bool checkIntegrity(ActivateApp& e); + static bool checkIntegrityConst(const ActivateApp& e); + + static bool fromString(const std::string& s,ActivateApp& e); + static const std::string toString(const ActivateApp& e); + + static bool fromJSON(const Json::Value& s,ActivateApp& e); + static Json::Value toJSON(const ActivateApp& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/ActivateAppResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/ActivateAppResponse.cpp new file mode 100644 index 000000000..d499fbc78 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/ActivateAppResponse.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/BasicCommunication/ActivateAppResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects//Marshaller.h" + +/* + interface NsRPC2Communication::BasicCommunicationication + 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::BasicCommunication; + + +ActivateAppResponse& ActivateAppResponse::operator =(const ActivateAppResponse& c) +{ + return *this; +} + + +ActivateAppResponse::~ActivateAppResponse(void) +{ +} + + +ActivateAppResponse::ActivateAppResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__ACTIVATEAPPRESPONSE) +{ +} + + +ActivateAppResponse::ActivateAppResponse(const ActivateAppResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__ACTIVATEAPPRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool ActivateAppResponse::checkIntegrity(void) +{ + return ActivateAppResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/ActivateAppResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/ActivateAppResponseMarshaller.cpp new file mode 100644 index 000000000..047b05ce0 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/ActivateAppResponseMarshaller.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/BasicCommunication/ActivateAppResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/BasicCommunication/ActivateAppResponseMarshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + +bool ActivateAppResponseMarshaller::checkIntegrity(ActivateAppResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool ActivateAppResponseMarshaller::fromString(const std::string& s,ActivateAppResponse& 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 ActivateAppResponseMarshaller::toString(const ActivateAppResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool ActivateAppResponseMarshaller::checkIntegrityConst(const ActivateAppResponse& s) +{ + return true; +} + + +Json::Value ActivateAppResponseMarshaller::toJSON(const ActivateAppResponse& 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("BasicCommunication.ActivateAppResponse"); + + return json; +} + + +bool ActivateAppResponseMarshaller::fromJSON(const Json::Value& json,ActivateAppResponse& 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("BasicCommunication.ActivateAppResponse")) 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/BasicCommunication/ActivateAppResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/ActivateAppResponseMarshaller.h new file mode 100644 index 000000000..7d7ab0615 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/ActivateAppResponseMarshaller.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_SMARTDEVICELINKCORE_ACTIVATEAPPRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_SMARTDEVICELINKCORE_ACTIVATEAPPRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/ActivateAppResponse.h" + +namespace NsRPC2Communication +{ + namespace BasicCommunication + { + + struct ActivateAppResponseMarshaller + { + static bool checkIntegrity(ActivateAppResponse& e); + static bool checkIntegrityConst(const ActivateAppResponse& e); + + static bool fromString(const std::string& s,ActivateAppResponse& e); + static const std::string toString(const ActivateAppResponse& e); + + static bool fromJSON(const Json::Value& s,ActivateAppResponse& e); + static Json::Value toJSON(const ActivateAppResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetAppList.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetAppList.cpp new file mode 100644 index 000000000..c14852243 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetAppList.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 "../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/GetAppList.h" +#include "../include/JSONHandler/RPC2Objects//Marshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + + +GetAppList& GetAppList::operator =(const GetAppList& c) +{ + return *this; +} + + +GetAppList::~GetAppList(void) +{ +} + + +GetAppList::GetAppList(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__GETAPPLIST) +{ +} + + +GetAppList::GetAppList(const GetAppList& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__GETAPPLIST,c.getId()) +{ + *this=c; +} + + +bool GetAppList::checkIntegrity(void) +{ + return GetAppListMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetAppListMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetAppListMarshaller.cpp new file mode 100644 index 000000000..d2f2cd302 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetAppListMarshaller.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 "../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/GetAppList.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/RPC2ObjectsImpl//NsRPC2Communication/BasicCommunication/GetAppListMarshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + +bool GetAppListMarshaller::checkIntegrity(GetAppList& s) +{ + return checkIntegrityConst(s); +} + + +bool GetAppListMarshaller::fromString(const std::string& s,GetAppList& 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 GetAppListMarshaller::toString(const GetAppList& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool GetAppListMarshaller::checkIntegrityConst(const GetAppList& s) +{ + return true; +} + + +Json::Value GetAppListMarshaller::toJSON(const GetAppList& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("BasicCommunication.GetAppList"); + + json["id"]=Json::Value(e.getId()); + return json; +} + + +bool GetAppListMarshaller::fromJSON(const Json::Value& json,GetAppList& 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("BasicCommunication.GetAppList")) 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/BasicCommunication/GetAppListMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetAppListMarshaller.h new file mode 100644 index 000000000..5fe06a127 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetAppListMarshaller.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_SMARTDEVICELINKCORE_GETAPPLISTMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_SMARTDEVICELINKCORE_GETAPPLISTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/GetAppList.h" + +namespace NsRPC2Communication +{ + namespace BasicCommunication + { + + struct GetAppListMarshaller + { + static bool checkIntegrity(GetAppList& e); + static bool checkIntegrityConst(const GetAppList& e); + + static bool fromString(const std::string& s,GetAppList& e); + static const std::string toString(const GetAppList& e); + + static bool fromJSON(const Json::Value& s,GetAppList& e); + static Json::Value toJSON(const GetAppList& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetAppListResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetAppListResponse.cpp new file mode 100644 index 000000000..4e778f4e4 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetAppListResponse.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 "../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/GetAppListResponse.h" +#include "../include/JSONHandler/RPC2Objects//Marshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + + +GetAppListResponse& GetAppListResponse::operator =(const GetAppListResponse& c) +{ + appList=c.appList; + return *this; +} + + +GetAppListResponse::~GetAppListResponse(void) +{ +} + + +GetAppListResponse::GetAppListResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__GETAPPLISTRESPONSE) +{ +} + + +GetAppListResponse::GetAppListResponse(const GetAppListResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__GETAPPLISTRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +const std::vector< NsSmartDeviceLinkRPCV2::HMIApplication>& GetAppListResponse::get_appList(void) +{ + return appList; +} + +bool GetAppListResponse::set_appList(const std::vector< NsSmartDeviceLinkRPCV2::HMIApplication>& appList_) +{ + appList=appList_; + return true; +} + +bool GetAppListResponse::checkIntegrity(void) +{ + return GetAppListResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetAppListResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetAppListResponseMarshaller.cpp new file mode 100644 index 000000000..66c05d426 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetAppListResponseMarshaller.cpp @@ -0,0 +1,156 @@ +// +// 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/BasicCommunication/GetAppListResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/HMIApplicationMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/BasicCommunication/GetAppListResponseMarshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + +bool GetAppListResponseMarshaller::checkIntegrity(GetAppListResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool GetAppListResponseMarshaller::fromString(const std::string& s,GetAppListResponse& 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 GetAppListResponseMarshaller::toString(const GetAppListResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool GetAppListResponseMarshaller::checkIntegrityConst(const GetAppListResponse& s) +{ + { + unsigned int i=s.appList.size(); + if(i<0) return false; + } + + return true; +} + + +Json::Value GetAppListResponseMarshaller::toJSON(const GetAppListResponse& 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("BasicCommunication.GetAppListResponse"); + + { + unsigned int i=e.appList.size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::HMIApplicationMarshaller::toJSON(e.appList[i]); + + json["result"]["appList"]=j; + } + return json; +} + + +bool GetAppListResponseMarshaller::fromJSON(const Json::Value& json,GetAppListResponse& 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("BasicCommunication.GetAppListResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + if(!js.isMember("appList") || !js["appList"].isArray()) return false; + { + unsigned int i=js["appList"].size(); + if(i<0) return false; + c.appList.resize(i); + while(i--) + { + NsSmartDeviceLinkRPCV2::HMIApplication t; + if(!NsSmartDeviceLinkRPCV2::HMIApplicationMarshaller::fromJSON(js["appList"][i],t)) + return false; + c.appList[i]=t; + } + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetAppListResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetAppListResponseMarshaller.h new file mode 100644 index 000000000..e037e81bf --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetAppListResponseMarshaller.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_SMARTDEVICELINKCORE_GETAPPLISTRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_SMARTDEVICELINKCORE_GETAPPLISTRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/GetAppListResponse.h" + +namespace NsRPC2Communication +{ + namespace BasicCommunication + { + + struct GetAppListResponseMarshaller + { + static bool checkIntegrity(GetAppListResponse& e); + static bool checkIntegrityConst(const GetAppListResponse& e); + + static bool fromString(const std::string& s,GetAppListResponse& e); + static const std::string toString(const GetAppListResponse& e); + + static bool fromJSON(const Json::Value& s,GetAppListResponse& e); + static Json::Value toJSON(const GetAppListResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetDeviceList.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetDeviceList.cpp new file mode 100644 index 000000000..38a3eb208 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetDeviceList.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 "../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/GetDeviceList.h" +#include "../include/JSONHandler/RPC2Objects//Marshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + + +GetDeviceList& GetDeviceList::operator =(const GetDeviceList& c) +{ + return *this; +} + + +GetDeviceList::~GetDeviceList(void) +{ +} + + +GetDeviceList::GetDeviceList(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__GETDEVICELIST) +{ +} + + +GetDeviceList::GetDeviceList(const GetDeviceList& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__GETDEVICELIST,c.getId()) +{ + *this=c; +} + + +bool GetDeviceList::checkIntegrity(void) +{ + return GetDeviceListMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetDeviceListMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetDeviceListMarshaller.cpp new file mode 100644 index 000000000..ad213e0e1 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetDeviceListMarshaller.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/BasicCommunication/GetDeviceList.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/BasicCommunication/GetDeviceListMarshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + +bool GetDeviceListMarshaller::checkIntegrity(GetDeviceList& s) +{ + return checkIntegrityConst(s); +} + + +bool GetDeviceListMarshaller::fromString(const std::string& s,GetDeviceList& 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 GetDeviceListMarshaller::toString(const GetDeviceList& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool GetDeviceListMarshaller::checkIntegrityConst(const GetDeviceList& s) +{ + return true; +} + + +Json::Value GetDeviceListMarshaller::toJSON(const GetDeviceList& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("BasicCommunication.GetDeviceList"); + + json["id"]=Json::Value(e.getId()); + return json; +} + + +bool GetDeviceListMarshaller::fromJSON(const Json::Value& json,GetDeviceList& 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("BasicCommunication.GetDeviceList")) 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/BasicCommunication/GetDeviceListMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetDeviceListMarshaller.h new file mode 100644 index 000000000..e189a62f9 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetDeviceListMarshaller.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_SMARTDEVICELINKCORE_GETDEVICELISTMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_SMARTDEVICELINKCORE_GETDEVICELISTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/GetDeviceList.h" + +namespace NsRPC2Communication +{ + namespace BasicCommunication + { + + struct GetDeviceListMarshaller + { + static bool checkIntegrity(GetDeviceList& e); + static bool checkIntegrityConst(const GetDeviceList& e); + + static bool fromString(const std::string& s,GetDeviceList& e); + static const std::string toString(const GetDeviceList& e); + + static bool fromJSON(const Json::Value& s,GetDeviceList& e); + static Json::Value toJSON(const GetDeviceList& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetDeviceListResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetDeviceListResponse.cpp new file mode 100644 index 000000000..5b55b63c1 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetDeviceListResponse.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 "../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/GetDeviceListResponse.h" +#include "../include/JSONHandler/RPC2Objects//Marshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + + +GetDeviceListResponse& GetDeviceListResponse::operator =(const GetDeviceListResponse& c) +{ + if(deviceList) delete deviceList; + deviceList= c.deviceList ? new std::vector<std::string>(c.deviceList[0]) : 0; + return *this; +} + + +GetDeviceListResponse::~GetDeviceListResponse(void) +{ + if(deviceList) delete deviceList; +} + + +GetDeviceListResponse::GetDeviceListResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__GETDEVICELISTRESPONSE), + deviceList(0) +{ +} + + +GetDeviceListResponse::GetDeviceListResponse(const GetDeviceListResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__GETDEVICELISTRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +const std::vector< std::string>* GetDeviceListResponse::get_deviceList(void) +{ + return deviceList; +} + +bool GetDeviceListResponse::set_deviceList(const std::vector< std::string>& deviceList_) +{ + if(deviceList) delete deviceList; + deviceList=new std::vector< std::string>(deviceList_); + return true; +} + +void GetDeviceListResponse::reset_deviceList(void) +{ + if(deviceList) delete deviceList; + deviceList=0; +} + +bool GetDeviceListResponse::checkIntegrity(void) +{ + return GetDeviceListResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetDeviceListResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetDeviceListResponseMarshaller.cpp new file mode 100644 index 000000000..8a98df3a0 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetDeviceListResponseMarshaller.cpp @@ -0,0 +1,166 @@ +// +// 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/BasicCommunication/GetDeviceListResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/BasicCommunication/GetDeviceListResponseMarshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + +bool GetDeviceListResponseMarshaller::checkIntegrity(GetDeviceListResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool GetDeviceListResponseMarshaller::fromString(const std::string& s,GetDeviceListResponse& 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 GetDeviceListResponseMarshaller::toString(const GetDeviceListResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool GetDeviceListResponseMarshaller::checkIntegrityConst(const GetDeviceListResponse& s) +{ + if(s.deviceList) + { + unsigned int i=s.deviceList[0].size(); + if(i<1) return false; + if(i>100) return false; + } + + return true; +} + + +Json::Value GetDeviceListResponseMarshaller::toJSON(const GetDeviceListResponse& 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("BasicCommunication.GetDeviceListResponse"); + + if(e.deviceList) + { + unsigned int i=e.deviceList[0].size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=Json::Value(e.deviceList[0][i]); + + json["result"]["deviceList"]=j; + } + return json; +} + + +bool GetDeviceListResponseMarshaller::fromJSON(const Json::Value& json,GetDeviceListResponse& 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("BasicCommunication.GetDeviceListResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + if(c.deviceList) delete c.deviceList; + c.deviceList=0; + if(js.isMember("deviceList")) + { + if(!js["deviceList"].isArray()) return false; + unsigned int i=js["deviceList"].size(); + if(i<1) return false; + if(i>100) return false; + + c.deviceList=new std::vector<std::string>(); + c.deviceList->resize(js["deviceList"].size()); + + while(i--) + { + if(!js["deviceList"][i].isString()) + return false; + + c.deviceList[0][i]=js["deviceList"][i].asString(); + } + } + + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetDeviceListResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetDeviceListResponseMarshaller.h new file mode 100644 index 000000000..1528dd1a4 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetDeviceListResponseMarshaller.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_SMARTDEVICELINKCORE_GETDEVICELISTRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_SMARTDEVICELINKCORE_GETDEVICELISTRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/GetDeviceListResponse.h" + +namespace NsRPC2Communication +{ + namespace BasicCommunication + { + + struct GetDeviceListResponseMarshaller + { + static bool checkIntegrity(GetDeviceListResponse& e); + static bool checkIntegrityConst(const GetDeviceListResponse& e); + + static bool fromString(const std::string& s,GetDeviceListResponse& e); + static const std::string toString(const GetDeviceListResponse& e); + + static bool fromJSON(const Json::Value& s,GetDeviceListResponse& e); + static Json::Value toJSON(const GetDeviceListResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppDeactivated.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppDeactivated.cpp new file mode 100644 index 000000000..d1233987d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppDeactivated.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 "../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/OnAppDeactivated.h" +#include "../include/JSONHandler/RPC2Objects//Marshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + + +OnAppDeactivated& OnAppDeactivated::operator =(const OnAppDeactivated& c) +{ + appName=c.appName; + reason=c.reason; + appId=c.appId; + return *this; +} + + +OnAppDeactivated::~OnAppDeactivated(void) +{ +} + + +OnAppDeactivated::OnAppDeactivated(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__ONAPPDEACTIVATED) +{ +} + + +OnAppDeactivated::OnAppDeactivated(const OnAppDeactivated& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__ONAPPDEACTIVATED,c.getId()) +{ + *this=c; +} + + +const std::string& OnAppDeactivated::get_appName(void) +{ + return appName; +} + +bool OnAppDeactivated::set_appName(const std::string& appName_) +{ + appName=appName_; + return true; +} + +const NsSmartDeviceLinkRPCV2::DeactivateReason& OnAppDeactivated::get_reason(void) +{ + return reason; +} + +bool OnAppDeactivated::set_reason(const NsSmartDeviceLinkRPCV2::DeactivateReason& reason_) +{ + reason=reason_; + return true; +} + +int OnAppDeactivated::get_appId(void) +{ + return appId; +} + +bool OnAppDeactivated::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool OnAppDeactivated::checkIntegrity(void) +{ + return OnAppDeactivatedMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppDeactivatedMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppDeactivatedMarshaller.cpp new file mode 100644 index 000000000..89a0d8423 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppDeactivatedMarshaller.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/BasicCommunication/OnAppDeactivated.h" +#include "../src/SDLRPCObjectsImpl/V2/DeactivateReasonMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/BasicCommunication/OnAppDeactivatedMarshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + +bool OnAppDeactivatedMarshaller::checkIntegrity(OnAppDeactivated& s) +{ + return checkIntegrityConst(s); +} + + +bool OnAppDeactivatedMarshaller::fromString(const std::string& s,OnAppDeactivated& 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 OnAppDeactivatedMarshaller::toString(const OnAppDeactivated& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool OnAppDeactivatedMarshaller::checkIntegrityConst(const OnAppDeactivated& s) +{ + if(s.appName.length()>100) return false; + + if(!NsSmartDeviceLinkRPCV2::DeactivateReasonMarshaller::checkIntegrityConst(s.reason)) return false; + + return true; +} + + +Json::Value OnAppDeactivatedMarshaller::toJSON(const OnAppDeactivated& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("BasicCommunication.OnAppDeactivated"); + + json["params"]=Json::Value(Json::objectValue); + json["params"]["appName"]=Json::Value(e.appName);; + json["params"]["reason"]=NsSmartDeviceLinkRPCV2::DeactivateReasonMarshaller::toJSON(e.reason);; + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool OnAppDeactivatedMarshaller::fromJSON(const Json::Value& json,OnAppDeactivated& 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("BasicCommunication.OnAppDeactivated")) return false; + + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + if(!js.isMember("appName") || !js["appName"].isString()) return false; + c.appName=js["appName"].asString(); + if(c.appName.length()>100) return false; + if(!js.isMember("reason") || !NsSmartDeviceLinkRPCV2::DeactivateReasonMarshaller::fromJSON(js["reason"],c.reason)) 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/BasicCommunication/OnAppDeactivatedMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppDeactivatedMarshaller.h new file mode 100644 index 000000000..bcd82d730 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppDeactivatedMarshaller.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_SMARTDEVICELINKCORE_ONAPPDEACTIVATEDMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_SMARTDEVICELINKCORE_ONAPPDEACTIVATEDMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/OnAppDeactivated.h" + +namespace NsRPC2Communication +{ + namespace BasicCommunication + { + + struct OnAppDeactivatedMarshaller + { + static bool checkIntegrity(OnAppDeactivated& e); + static bool checkIntegrityConst(const OnAppDeactivated& e); + + static bool fromString(const std::string& s,OnAppDeactivated& e); + static const std::string toString(const OnAppDeactivated& e); + + static bool fromJSON(const Json::Value& s,OnAppDeactivated& e); + static Json::Value toJSON(const OnAppDeactivated& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppDeactivatedResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppDeactivatedResponse.cpp new file mode 100644 index 000000000..67d305c85 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppDeactivatedResponse.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/BasicCommunication/OnAppDeactivatedResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects//Marshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + + +OnAppDeactivatedResponse& OnAppDeactivatedResponse::operator =(const OnAppDeactivatedResponse& c) +{ + return *this; +} + + +OnAppDeactivatedResponse::~OnAppDeactivatedResponse(void) +{ +} + + +OnAppDeactivatedResponse::OnAppDeactivatedResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__ONAPPDEACTIVATEDRESPONSE) +{ +} + + +OnAppDeactivatedResponse::OnAppDeactivatedResponse(const OnAppDeactivatedResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__ONAPPDEACTIVATEDRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool OnAppDeactivatedResponse::checkIntegrity(void) +{ + return OnAppDeactivatedResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppDeactivatedResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppDeactivatedResponseMarshaller.cpp new file mode 100644 index 000000000..d35e19839 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppDeactivatedResponseMarshaller.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 "../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/OnAppDeactivatedResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/RPC2ObjectsImpl//NsRPC2Communication/BasicCommunication/OnAppDeactivatedResponseMarshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + +bool OnAppDeactivatedResponseMarshaller::checkIntegrity(OnAppDeactivatedResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool OnAppDeactivatedResponseMarshaller::fromString(const std::string& s,OnAppDeactivatedResponse& 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 OnAppDeactivatedResponseMarshaller::toString(const OnAppDeactivatedResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool OnAppDeactivatedResponseMarshaller::checkIntegrityConst(const OnAppDeactivatedResponse& s) +{ + return true; +} + + +Json::Value OnAppDeactivatedResponseMarshaller::toJSON(const OnAppDeactivatedResponse& 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("BasicCommunication.OnAppDeactivatedResponse"); + + return json; +} + + +bool OnAppDeactivatedResponseMarshaller::fromJSON(const Json::Value& json,OnAppDeactivatedResponse& 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("BasicCommunication.OnAppDeactivatedResponse")) 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/BasicCommunication/OnAppDeactivatedResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppDeactivatedResponseMarshaller.h new file mode 100644 index 000000000..28c4da454 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppDeactivatedResponseMarshaller.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_SMARTDEVICELINKCORE_ONAPPDEACTIVATEDRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_SMARTDEVICELINKCORE_ONAPPDEACTIVATEDRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/OnAppDeactivatedResponse.h" + +namespace NsRPC2Communication +{ + namespace BasicCommunication + { + + struct OnAppDeactivatedResponseMarshaller + { + static bool checkIntegrity(OnAppDeactivatedResponse& e); + static bool checkIntegrityConst(const OnAppDeactivatedResponse& e); + + static bool fromString(const std::string& s,OnAppDeactivatedResponse& e); + static const std::string toString(const OnAppDeactivatedResponse& e); + + static bool fromJSON(const Json::Value& s,OnAppDeactivatedResponse& e); + static Json::Value toJSON(const OnAppDeactivatedResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppRegistered.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppRegistered.cpp new file mode 100644 index 000000000..9c78cbd3d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppRegistered.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 "../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/OnAppRegistered.h" +#include "../include/JSONHandler/RPC2Objects//Marshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + + +OnAppRegistered& OnAppRegistered::operator =(const OnAppRegistered& c) +{ + application=c.application; + return *this; +} + + +OnAppRegistered::~OnAppRegistered(void) +{ +} + + +OnAppRegistered::OnAppRegistered(void) : + RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__ONAPPREGISTERED) +{ +} + + +OnAppRegistered::OnAppRegistered(const OnAppRegistered& c) : RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__ONAPPREGISTERED) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::HMIApplication& OnAppRegistered::get_application(void) +{ + return application; +} + +bool OnAppRegistered::set_application(const NsSmartDeviceLinkRPCV2::HMIApplication& application_) +{ + application=application_; + return true; +} + +bool OnAppRegistered::checkIntegrity(void) +{ + return OnAppRegisteredMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppRegisteredMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppRegisteredMarshaller.cpp new file mode 100644 index 000000000..7036d1568 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppRegisteredMarshaller.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/BasicCommunication/OnAppRegistered.h" +#include "../src/SDLRPCObjectsImpl/V2/HMIApplicationMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/BasicCommunication/OnAppRegisteredMarshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + +bool OnAppRegisteredMarshaller::checkIntegrity(OnAppRegistered& s) +{ + return checkIntegrityConst(s); +} + + +bool OnAppRegisteredMarshaller::fromString(const std::string& s,OnAppRegistered& 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 OnAppRegisteredMarshaller::toString(const OnAppRegistered& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool OnAppRegisteredMarshaller::checkIntegrityConst(const OnAppRegistered& s) +{ + if(!NsSmartDeviceLinkRPCV2::HMIApplicationMarshaller::checkIntegrityConst(s.application)) return false; + + return true; +} + + +Json::Value OnAppRegisteredMarshaller::toJSON(const OnAppRegistered& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("BasicCommunication.OnAppRegistered"); + json["params"]=Json::Value(Json::objectValue); + + json["params"]["application"]=NsSmartDeviceLinkRPCV2::HMIApplicationMarshaller::toJSON(e.application);; + return json; +} + + +bool OnAppRegisteredMarshaller::fromJSON(const Json::Value& json,OnAppRegistered& 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("BasicCommunication.OnAppRegistered")) return false; + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + + if(!js.isMember("application") || !NsSmartDeviceLinkRPCV2::HMIApplicationMarshaller::fromJSON(js["application"],c.application)) return false; + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppRegisteredMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppRegisteredMarshaller.h new file mode 100644 index 000000000..6c919bffd --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppRegisteredMarshaller.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_SMARTDEVICELINKCORE_ONAPPREGISTEREDMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_SMARTDEVICELINKCORE_ONAPPREGISTEREDMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/OnAppRegistered.h" + +namespace NsRPC2Communication +{ + namespace BasicCommunication + { + + struct OnAppRegisteredMarshaller + { + static bool checkIntegrity(OnAppRegistered& e); + static bool checkIntegrityConst(const OnAppRegistered& e); + + static bool fromString(const std::string& s,OnAppRegistered& e); + static const std::string toString(const OnAppRegistered& e); + + static bool fromJSON(const Json::Value& s,OnAppRegistered& e); + static Json::Value toJSON(const OnAppRegistered& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppUnregistered.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppUnregistered.cpp new file mode 100644 index 000000000..f7e7e4a5a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppUnregistered.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 "../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/OnAppUnregistered.h" +#include "../include/JSONHandler/RPC2Objects//Marshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + + +OnAppUnregistered& OnAppUnregistered::operator =(const OnAppUnregistered& c) +{ + appName=c.appName; + if(reason) delete reason; + reason= c.reason ? new NsSmartDeviceLinkRPCV2::AppInterfaceUnregisteredReason(c.reason[0]) : 0; + appId=c.appId; + return *this; +} + + +OnAppUnregistered::~OnAppUnregistered(void) +{ + if(reason) delete reason; +} + + +OnAppUnregistered::OnAppUnregistered(void) : + RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__ONAPPUNREGISTERED), + reason(0) +{ +} + + +OnAppUnregistered::OnAppUnregistered(const OnAppUnregistered& c) : RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__ONAPPUNREGISTERED) +{ + *this=c; +} + + +const std::string& OnAppUnregistered::get_appName(void) +{ + return appName; +} + +bool OnAppUnregistered::set_appName(const std::string& appName_) +{ + appName=appName_; + return true; +} + +const NsSmartDeviceLinkRPCV2::AppInterfaceUnregisteredReason* OnAppUnregistered::get_reason(void) +{ + return reason; +} + +bool OnAppUnregistered::set_reason(const NsSmartDeviceLinkRPCV2::AppInterfaceUnregisteredReason& reason_) +{ + if(reason) delete reason; + reason=new NsSmartDeviceLinkRPCV2::AppInterfaceUnregisteredReason(reason_); + return true; +} + +void OnAppUnregistered::reset_reason(void) +{ + if(reason) delete reason; + reason=0; +} + +int OnAppUnregistered::get_appId(void) +{ + return appId; +} + +bool OnAppUnregistered::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool OnAppUnregistered::checkIntegrity(void) +{ + return OnAppUnregisteredMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppUnregisteredMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppUnregisteredMarshaller.cpp new file mode 100644 index 000000000..0ecb87e64 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppUnregisteredMarshaller.cpp @@ -0,0 +1,139 @@ +// +// 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 "../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/OnAppUnregistered.h" +#include "../src/SDLRPCObjectsImpl/V2/AppInterfaceUnregisteredReasonMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/RPC2ObjectsImpl//NsRPC2Communication/BasicCommunication/OnAppUnregisteredMarshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + +bool OnAppUnregisteredMarshaller::checkIntegrity(OnAppUnregistered& s) +{ + return checkIntegrityConst(s); +} + + +bool OnAppUnregisteredMarshaller::fromString(const std::string& s,OnAppUnregistered& 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 OnAppUnregisteredMarshaller::toString(const OnAppUnregistered& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool OnAppUnregisteredMarshaller::checkIntegrityConst(const OnAppUnregistered& s) +{ + if(s.appName.length()>100) return false; + + if(s.reason && (!NsSmartDeviceLinkRPCV2::AppInterfaceUnregisteredReasonMarshaller::checkIntegrityConst(s.reason[0]))) return false; + + return true; +} + + +Json::Value OnAppUnregisteredMarshaller::toJSON(const OnAppUnregistered& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("BasicCommunication.OnAppUnregistered"); + json["params"]=Json::Value(Json::objectValue); + + json["params"]["appName"]=Json::Value(e.appName);; + if(e.reason) + json["params"]["reason"]=NsSmartDeviceLinkRPCV2::AppInterfaceUnregisteredReasonMarshaller::toJSON(e.reason[0]);; + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool OnAppUnregisteredMarshaller::fromJSON(const Json::Value& json,OnAppUnregistered& 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("BasicCommunication.OnAppUnregistered")) return false; + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + + if(!js.isMember("appName") || !js["appName"].isString()) return false; + c.appName=js["appName"].asString(); + if(c.appName.length()>100) return false; + + if(c.reason) delete c.reason; + c.reason=0; + if(js.isMember("reason")) + { + c.reason=new NsSmartDeviceLinkRPCV2::AppInterfaceUnregisteredReason(); + if(!NsSmartDeviceLinkRPCV2::AppInterfaceUnregisteredReasonMarshaller::fromJSON(js["reason"],c.reason[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/BasicCommunication/OnAppUnregisteredMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppUnregisteredMarshaller.h new file mode 100644 index 000000000..91b171826 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnAppUnregisteredMarshaller.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_SMARTDEVICELINKCORE_ONAPPUNREGISTEREDMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_SMARTDEVICELINKCORE_ONAPPUNREGISTEREDMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/OnAppUnregistered.h" + +namespace NsRPC2Communication +{ + namespace BasicCommunication + { + + struct OnAppUnregisteredMarshaller + { + static bool checkIntegrity(OnAppUnregistered& e); + static bool checkIntegrityConst(const OnAppUnregistered& e); + + static bool fromString(const std::string& s,OnAppUnregistered& e); + static const std::string toString(const OnAppUnregistered& e); + + static bool fromJSON(const Json::Value& s,OnAppUnregistered& e); + static Json::Value toJSON(const OnAppUnregistered& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnDeviceListUpdated.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnDeviceListUpdated.cpp new file mode 100644 index 000000000..2691690f1 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnDeviceListUpdated.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 "../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/OnDeviceListUpdated.h" +#include "../include/JSONHandler/RPC2Objects//Marshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + + +OnDeviceListUpdated& OnDeviceListUpdated::operator =(const OnDeviceListUpdated& c) +{ + if(deviceList) delete deviceList; + deviceList= c.deviceList ? new std::vector<std::string>(c.deviceList[0]) : 0; + return *this; +} + + +OnDeviceListUpdated::~OnDeviceListUpdated(void) +{ + if(deviceList) delete deviceList; +} + + +OnDeviceListUpdated::OnDeviceListUpdated(void) : + RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__ONDEVICELISTUPDATED), + deviceList(0) +{ +} + + +OnDeviceListUpdated::OnDeviceListUpdated(const OnDeviceListUpdated& c) : RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__ONDEVICELISTUPDATED) +{ + *this=c; +} + + +const std::vector< std::string>* OnDeviceListUpdated::get_deviceList(void) +{ + return deviceList; +} + +bool OnDeviceListUpdated::set_deviceList(const std::vector< std::string>& deviceList_) +{ + if(deviceList) delete deviceList; + deviceList=new std::vector< std::string>(deviceList_); + return true; +} + +void OnDeviceListUpdated::reset_deviceList(void) +{ + if(deviceList) delete deviceList; + deviceList=0; +} + +bool OnDeviceListUpdated::checkIntegrity(void) +{ + return OnDeviceListUpdatedMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnDeviceListUpdatedMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnDeviceListUpdatedMarshaller.cpp new file mode 100644 index 000000000..90c0182bb --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnDeviceListUpdatedMarshaller.cpp @@ -0,0 +1,154 @@ +// +// 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 "../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/OnDeviceListUpdated.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/RPC2ObjectsImpl//NsRPC2Communication/BasicCommunication/OnDeviceListUpdatedMarshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + +bool OnDeviceListUpdatedMarshaller::checkIntegrity(OnDeviceListUpdated& s) +{ + return checkIntegrityConst(s); +} + + +bool OnDeviceListUpdatedMarshaller::fromString(const std::string& s,OnDeviceListUpdated& 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 OnDeviceListUpdatedMarshaller::toString(const OnDeviceListUpdated& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool OnDeviceListUpdatedMarshaller::checkIntegrityConst(const OnDeviceListUpdated& s) +{ + if(s.deviceList) + { + unsigned int i=s.deviceList[0].size(); + if(i<1) return false; + if(i>100) return false; + } + + return true; +} + + +Json::Value OnDeviceListUpdatedMarshaller::toJSON(const OnDeviceListUpdated& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("BasicCommunication.OnDeviceListUpdated"); + json["params"]=Json::Value(Json::objectValue); + + if(e.deviceList) + { + unsigned int i=e.deviceList[0].size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=Json::Value(e.deviceList[0][i]); + + json["params"]["deviceList"]=j; + } + return json; +} + + +bool OnDeviceListUpdatedMarshaller::fromJSON(const Json::Value& json,OnDeviceListUpdated& 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("BasicCommunication.OnDeviceListUpdated")) return false; + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + + if(c.deviceList) delete c.deviceList; + c.deviceList=0; + if(js.isMember("deviceList")) + { + if(!js["deviceList"].isArray()) return false; + unsigned int i=js["deviceList"].size(); + if(i<1) return false; + if(i>100) return false; + + c.deviceList=new std::vector<std::string>(); + c.deviceList->resize(js["deviceList"].size()); + + while(i--) + { + if(!js["deviceList"][i].isString()) + return false; + + c.deviceList[0][i]=js["deviceList"][i].asString(); + } + } + + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnDeviceListUpdatedMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnDeviceListUpdatedMarshaller.h new file mode 100644 index 000000000..ad26e005e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/OnDeviceListUpdatedMarshaller.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_SMARTDEVICELINKCORE_ONDEVICELISTUPDATEDMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_SMARTDEVICELINKCORE_ONDEVICELISTUPDATEDMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/OnDeviceListUpdated.h" + +namespace NsRPC2Communication +{ + namespace BasicCommunication + { + + struct OnDeviceListUpdatedMarshaller + { + static bool checkIntegrity(OnDeviceListUpdated& e); + static bool checkIntegrityConst(const OnDeviceListUpdated& e); + + static bool fromString(const std::string& s,OnDeviceListUpdated& e); + static const std::string toString(const OnDeviceListUpdated& e); + + static bool fromJSON(const Json::Value& s,OnDeviceListUpdated& e); + static Json::Value toJSON(const OnDeviceListUpdated& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/SendData.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/SendData.cpp new file mode 100644 index 000000000..6584873bc --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/SendData.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 "../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/SendData.h" +#include "../include/JSONHandler/RPC2Objects//Marshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + + +SendData& SendData::operator =(const SendData& c) +{ + data=c.data; + if(url) delete url; + url= c.url ? new std::string(c.url[0]) : 0; + if(timeout) delete timeout; + timeout= c.timeout ? new int(c.timeout[0]) : 0; + return *this; +} + + +SendData::~SendData(void) +{ + if(url) delete url; + if(timeout) delete timeout; +} + + +SendData::SendData(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__SENDDATA), + url(0), + timeout(0) +{ +} + + +SendData::SendData(const SendData& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__SENDDATA,c.getId()) +{ + *this=c; +} + + +const std::vector< std::string>& SendData::get_data(void) +{ + return data; +} + +bool SendData::set_data(const std::vector< std::string>& data_) +{ + data=data_; + return true; +} + +const std::string* SendData::get_url(void) +{ + return url; +} + +bool SendData::set_url(const std::string& url_) +{ + if(url) delete url; + url=new std::string(url_); + return true; +} + +void SendData::reset_url(void) +{ + if(url) delete url; + url=0; +} + +const int* SendData::get_timeout(void) +{ + return timeout; +} + +bool SendData::set_timeout(const int& timeout_) +{ + if(timeout) delete timeout; + timeout=new int(timeout_); + return true; +} + +void SendData::reset_timeout(void) +{ + if(timeout) delete timeout; + timeout=0; +} + +bool SendData::checkIntegrity(void) +{ + return SendDataMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/SendDataMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/SendDataMarshaller.cpp new file mode 100644 index 000000000..8f737acae --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/SendDataMarshaller.cpp @@ -0,0 +1,181 @@ +// +// 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 "../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/SendData.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/RPC2ObjectsImpl//NsRPC2Communication/BasicCommunication/SendDataMarshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + +bool SendDataMarshaller::checkIntegrity(SendData& s) +{ + return checkIntegrityConst(s); +} + + +bool SendDataMarshaller::fromString(const std::string& s,SendData& 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 SendDataMarshaller::toString(const SendData& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SendDataMarshaller::checkIntegrityConst(const SendData& s) +{ + { + unsigned int i=s.data.size(); + if(i<1) return false; + if(i>100) return false; + } + + if(s.url && (s.url[0].length()>1000)) return false; + + if(s.timeout && (s.timeout[0]<-2000000000 || s.timeout[0]>2000000000)) return false; + + return true; +} + + +Json::Value SendDataMarshaller::toJSON(const SendData& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("BasicCommunication.SendData"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + { + unsigned int i=e.data.size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=Json::Value(e.data[i]); + + json["params"]["data"]=j; + } + if(e.url) + json["params"]["url"]=Json::Value(e.url[0]);; + if(e.timeout) + json["params"]["timeout"]=Json::Value(e.timeout[0]);; + return json; +} + + +bool SendDataMarshaller::fromJSON(const Json::Value& json,SendData& 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("BasicCommunication.SendData")) 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("data") || !js["data"].isArray()) + return false; + { + c.data.clear(); + unsigned int i=js["data"].size(); + if(i<1) return false; + if(i>100) return false; + c.data.resize(i); + while(i--) + { + if(!js["data"][i].isString()) + return false; + c.data[i]=js["data"][i].asString(); + + } + } + + + if(c.url) delete c.url; + c.url=0; + if(js.isMember("url")) + { + if(!js["url"].isString()) return false; + c.url=new std::string(); + c.url[0]=js["url"].asString(); + if(c.url[0].length()>1000) return false; + + } + + if(c.timeout) delete c.timeout; + c.timeout=0; + if(js.isMember("timeout")) + { + if(!js["timeout"].isInt()) return false; + c.timeout=new int(); + c.timeout[0]=js["timeout"].asInt(); + if(c.timeout[0]<-2000000000 || c.timeout[0]>2000000000) return false; + + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/SendDataMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/SendDataMarshaller.h new file mode 100644 index 000000000..f20fbeb5a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/SendDataMarshaller.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_SMARTDEVICELINKCORE_SENDDATAMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_SMARTDEVICELINKCORE_SENDDATAMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/SendData.h" + +namespace NsRPC2Communication +{ + namespace BasicCommunication + { + + struct SendDataMarshaller + { + static bool checkIntegrity(SendData& e); + static bool checkIntegrityConst(const SendData& e); + + static bool fromString(const std::string& s,SendData& e); + static const std::string toString(const SendData& e); + + static bool fromJSON(const Json::Value& s,SendData& e); + static Json::Value toJSON(const SendData& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/SendDataResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/SendDataResponse.cpp new file mode 100644 index 000000000..db77e7e39 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/SendDataResponse.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 "../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/SendDataResponse.h" +#include "../include/JSONHandler/RPC2Objects//Marshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + + +SendDataResponse& SendDataResponse::operator =(const SendDataResponse& c) +{ + return *this; +} + + +SendDataResponse::~SendDataResponse(void) +{ +} + + +SendDataResponse::SendDataResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__SENDDATARESPONSE) +{ +} + + +SendDataResponse::SendDataResponse(const SendDataResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_BASICCOMMUNICATION__SENDDATARESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool SendDataResponse::checkIntegrity(void) +{ + return SendDataResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/SendDataResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/SendDataResponseMarshaller.cpp new file mode 100644 index 000000000..8a494799a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/SendDataResponseMarshaller.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 "../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/SendDataResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/RPC2ObjectsImpl//NsRPC2Communication/BasicCommunication/SendDataResponseMarshaller.h" + +/* + interface NsRPC2Communication::BasicCommunication + 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::BasicCommunication; + +bool SendDataResponseMarshaller::checkIntegrity(SendDataResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool SendDataResponseMarshaller::fromString(const std::string& s,SendDataResponse& 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 SendDataResponseMarshaller::toString(const SendDataResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SendDataResponseMarshaller::checkIntegrityConst(const SendDataResponse& s) +{ + return true; +} + + +Json::Value SendDataResponseMarshaller::toJSON(const SendDataResponse& 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("BasicCommunication.SendDataResponse"); + + return json; +} + + +bool SendDataResponseMarshaller::fromJSON(const Json::Value& json,SendDataResponse& 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("BasicCommunication.SendDataResponse")) 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/BasicCommunication/SendDataResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/SendDataResponseMarshaller.h new file mode 100644 index 000000000..94974d99c --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/SendDataResponseMarshaller.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_SMARTDEVICELINKCORE_SENDDATARESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_SMARTDEVICELINKCORE_SENDDATARESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/SendDataResponse.h" + +namespace NsRPC2Communication +{ + namespace BasicCommunication + { + + struct SendDataResponseMarshaller + { + static bool checkIntegrity(SendDataResponse& e); + static bool checkIntegrityConst(const SendDataResponse& e); + + static bool fromString(const std::string& s,SendDataResponse& e); + static const std::string toString(const SendDataResponse& e); + + static bool fromJSON(const Json::Value& s,SendDataResponse& e); + static Json::Value toJSON(const SendDataResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/GetCapabilities.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/GetCapabilities.cpp new file mode 100644 index 000000000..4a90e5e58 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/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/Buttons/GetCapabilities.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::Buttons + 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::Buttons; + + +GetCapabilities& GetCapabilities::operator =(const GetCapabilities& c) +{ + return *this; +} + + +GetCapabilities::~GetCapabilities(void) +{ +} + + +GetCapabilities::GetCapabilities(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_BUTTONS__GETCAPABILITIES) +{ +} + + +GetCapabilities::GetCapabilities(const GetCapabilities& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_BUTTONS__GETCAPABILITIES,c.getId()) +{ + *this=c; +} + + +bool GetCapabilities::checkIntegrity(void) +{ + return GetCapabilitiesMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/GetCapabilitiesMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/GetCapabilitiesMarshaller.cpp new file mode 100644 index 000000000..d1d22df2d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/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/Buttons/GetCapabilities.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/Buttons/GetCapabilitiesMarshaller.h" + +/* + interface NsRPC2Communication::Buttons + 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::Buttons; + +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("Buttons.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("Buttons.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/Buttons/GetCapabilitiesMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/GetCapabilitiesMarshaller.h new file mode 100644 index 000000000..3d5104802 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/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_BUTTONS_GETCAPABILITIESMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_BUTTONS_GETCAPABILITIESMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/Buttons/GetCapabilities.h" + +namespace NsRPC2Communication +{ + namespace Buttons + { + + 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/Buttons/GetCapabilitiesResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/GetCapabilitiesResponse.cpp new file mode 100644 index 000000000..f6f3b7467 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/GetCapabilitiesResponse.cpp @@ -0,0 +1,107 @@ +// +// 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/Buttons/GetCapabilitiesResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::Buttons + 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::Buttons; + + +GetCapabilitiesResponse& GetCapabilitiesResponse::operator =(const GetCapabilitiesResponse& c) +{ + capabilities=c.capabilities; + if(presetBankCapabilities) delete presetBankCapabilities; + presetBankCapabilities= c.presetBankCapabilities ? new NsSmartDeviceLinkRPCV2::PresetBankCapabilities(c.presetBankCapabilities[0]) : 0; + return *this; +} + + +GetCapabilitiesResponse::~GetCapabilitiesResponse(void) +{ + if(presetBankCapabilities) delete presetBankCapabilities; +} + + +GetCapabilitiesResponse::GetCapabilitiesResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_BUTTONS__GETCAPABILITIESRESPONSE), + presetBankCapabilities(0) +{ +} + + +GetCapabilitiesResponse::GetCapabilitiesResponse(const GetCapabilitiesResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_BUTTONS__GETCAPABILITIESRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +const std::vector< NsSmartDeviceLinkRPCV2::ButtonCapabilities>& GetCapabilitiesResponse::get_capabilities(void) +{ + return capabilities; +} + +bool GetCapabilitiesResponse::set_capabilities(const std::vector< NsSmartDeviceLinkRPCV2::ButtonCapabilities>& capabilities_) +{ + capabilities=capabilities_; + return true; +} + +const NsSmartDeviceLinkRPCV2::PresetBankCapabilities* GetCapabilitiesResponse::get_presetBankCapabilities(void) +{ + return presetBankCapabilities; +} + +bool GetCapabilitiesResponse::set_presetBankCapabilities(const NsSmartDeviceLinkRPCV2::PresetBankCapabilities& presetBankCapabilities_) +{ + if(presetBankCapabilities) delete presetBankCapabilities; + presetBankCapabilities=new NsSmartDeviceLinkRPCV2::PresetBankCapabilities(presetBankCapabilities_); + return true; +} + +void GetCapabilitiesResponse::reset_presetBankCapabilities(void) +{ + if(presetBankCapabilities) delete presetBankCapabilities; + presetBankCapabilities=0; +} + +bool GetCapabilitiesResponse::checkIntegrity(void) +{ + return GetCapabilitiesResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/GetCapabilitiesResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/GetCapabilitiesResponseMarshaller.cpp new file mode 100644 index 000000000..840da1191 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/GetCapabilitiesResponseMarshaller.cpp @@ -0,0 +1,171 @@ +// +// 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/Buttons/GetCapabilitiesResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ButtonCapabilitiesMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/PresetBankCapabilitiesMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/Buttons/GetCapabilitiesResponseMarshaller.h" + +/* + interface NsRPC2Communication::Buttons + 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::Buttons; + +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) +{ + { + unsigned int i=s.capabilities.size(); + if(i<1) return false; + if(i>100) return false; + } + + if(s.presetBankCapabilities && (!NsSmartDeviceLinkRPCV2::PresetBankCapabilitiesMarshaller::checkIntegrityConst(s.presetBankCapabilities[0]))) 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("Buttons.GetCapabilitiesResponse"); + + { + unsigned int i=e.capabilities.size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::ButtonCapabilitiesMarshaller::toJSON(e.capabilities[i]); + + json["result"]["capabilities"]=j; + } + if(e.presetBankCapabilities) + json["result"]["presetBankCapabilities"]=NsSmartDeviceLinkRPCV2::PresetBankCapabilitiesMarshaller::toJSON(e.presetBankCapabilities[0]);; + 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("Buttons.GetCapabilitiesResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + if(!js.isMember("capabilities") || !js["capabilities"].isArray()) return false; + { + unsigned int i=js["capabilities"].size(); + if(i<1) return false; + if(i>100) return false; + c.capabilities.resize(i); + while(i--) + { + NsSmartDeviceLinkRPCV2::ButtonCapabilities t; + if(!NsSmartDeviceLinkRPCV2::ButtonCapabilitiesMarshaller::fromJSON(js["capabilities"][i],t)) + return false; + c.capabilities[i]=t; + } + } + + if(c.presetBankCapabilities) delete c.presetBankCapabilities; + c.presetBankCapabilities=0; + if(js.isMember("presetBankCapabilities")) + { + c.presetBankCapabilities=new NsSmartDeviceLinkRPCV2::PresetBankCapabilities(); + if(!NsSmartDeviceLinkRPCV2::PresetBankCapabilitiesMarshaller::fromJSON(js["presetBankCapabilities"],c.presetBankCapabilities[0])) return false; + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/GetCapabilitiesResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/GetCapabilitiesResponseMarshaller.h new file mode 100644 index 000000000..ec0f76042 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/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_BUTTONS_GETCAPABILITIESRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_BUTTONS_GETCAPABILITIESRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/Buttons/GetCapabilitiesResponse.h" + +namespace NsRPC2Communication +{ + namespace Buttons + { + + 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/Buttons/OnButtonEvent.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/OnButtonEvent.cpp new file mode 100644 index 000000000..9a5d976e2 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/OnButtonEvent.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/Buttons/OnButtonEvent.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::Buttons + 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::Buttons; + + +OnButtonEvent& OnButtonEvent::operator =(const OnButtonEvent& c) +{ + name=c.name; + mode=c.mode; + if(customButtonID) delete customButtonID; + customButtonID= c.customButtonID ? new unsigned int(c.customButtonID[0]) : 0; + return *this; +} + + +OnButtonEvent::~OnButtonEvent(void) +{ + if(customButtonID) delete customButtonID; +} + + +OnButtonEvent::OnButtonEvent(void) : + RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_BUTTONS__ONBUTTONEVENT), + customButtonID(0) +{ +} + + +OnButtonEvent::OnButtonEvent(const OnButtonEvent& c) : RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_BUTTONS__ONBUTTONEVENT) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::ButtonName& OnButtonEvent::get_name(void) +{ + return name; +} + +bool OnButtonEvent::set_name(const NsSmartDeviceLinkRPCV2::ButtonName& name_) +{ + name=name_; + return true; +} + +const NsSmartDeviceLinkRPCV2::ButtonEventMode& OnButtonEvent::get_mode(void) +{ + return mode; +} + +bool OnButtonEvent::set_mode(const NsSmartDeviceLinkRPCV2::ButtonEventMode& mode_) +{ + mode=mode_; + return true; +} + +const unsigned int* OnButtonEvent::get_customButtonID(void) +{ + return customButtonID; +} + +bool OnButtonEvent::set_customButtonID(const unsigned int& customButtonID_) +{ + if(customButtonID) delete customButtonID; + customButtonID=new unsigned int(customButtonID_); + return true; +} + +void OnButtonEvent::reset_customButtonID(void) +{ + if(customButtonID) delete customButtonID; + customButtonID=0; +} + +bool OnButtonEvent::checkIntegrity(void) +{ + return OnButtonEventMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/OnButtonEventMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/OnButtonEventMarshaller.cpp new file mode 100644 index 000000000..3de10cfbf --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/OnButtonEventMarshaller.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/Buttons/OnButtonEvent.h" +#include "../src/SDLRPCObjectsImpl/V2/ButtonNameMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ButtonEventModeMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/Buttons/OnButtonEventMarshaller.h" + +/* + interface NsRPC2Communication::Buttons + 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::Buttons; + +bool OnButtonEventMarshaller::checkIntegrity(OnButtonEvent& s) +{ + return checkIntegrityConst(s); +} + + +bool OnButtonEventMarshaller::fromString(const std::string& s,OnButtonEvent& 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 OnButtonEventMarshaller::toString(const OnButtonEvent& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool OnButtonEventMarshaller::checkIntegrityConst(const OnButtonEvent& s) +{ + if(!NsSmartDeviceLinkRPCV2::ButtonNameMarshaller::checkIntegrityConst(s.name)) return false; + + if(!NsSmartDeviceLinkRPCV2::ButtonEventModeMarshaller::checkIntegrityConst(s.mode)) return false; + + if(s.customButtonID && (s.customButtonID[0]>65536)) return false; + + return true; +} + + +Json::Value OnButtonEventMarshaller::toJSON(const OnButtonEvent& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("Buttons.OnButtonEvent"); + json["params"]=Json::Value(Json::objectValue); + + json["params"]["name"]=NsSmartDeviceLinkRPCV2::ButtonNameMarshaller::toJSON(e.name);; + json["params"]["mode"]=NsSmartDeviceLinkRPCV2::ButtonEventModeMarshaller::toJSON(e.mode);; + if(e.customButtonID) + json["params"]["customButtonID"]=Json::Value(e.customButtonID[0]);; + return json; +} + + +bool OnButtonEventMarshaller::fromJSON(const Json::Value& json,OnButtonEvent& 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("Buttons.OnButtonEvent")) return false; + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + + if(!js.isMember("name") || !NsSmartDeviceLinkRPCV2::ButtonNameMarshaller::fromJSON(js["name"],c.name)) return false; + + if(!js.isMember("mode") || !NsSmartDeviceLinkRPCV2::ButtonEventModeMarshaller::fromJSON(js["mode"],c.mode)) return false; + + if(c.customButtonID) delete c.customButtonID; + c.customButtonID=0; + if(js.isMember("customButtonID")) + { + if(!js["customButtonID"].isInt()) return false; + c.customButtonID=new unsigned int(); + c.customButtonID[0]=js["customButtonID"].asInt(); + if(c.customButtonID[0]>65536) return false; + + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/OnButtonEventMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/OnButtonEventMarshaller.h new file mode 100644 index 000000000..993bf2858 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/OnButtonEventMarshaller.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_BUTTONS_ONBUTTONEVENTMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_BUTTONS_ONBUTTONEVENTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/Buttons/OnButtonEvent.h" + +namespace NsRPC2Communication +{ + namespace Buttons + { + + struct OnButtonEventMarshaller + { + static bool checkIntegrity(OnButtonEvent& e); + static bool checkIntegrityConst(const OnButtonEvent& e); + + static bool fromString(const std::string& s,OnButtonEvent& e); + static const std::string toString(const OnButtonEvent& e); + + static bool fromJSON(const Json::Value& s,OnButtonEvent& e); + static Json::Value toJSON(const OnButtonEvent& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/OnButtonPress.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/OnButtonPress.cpp new file mode 100644 index 000000000..41d06216e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/OnButtonPress.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/Buttons/OnButtonPress.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::Buttons + 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::Buttons; + + +OnButtonPress& OnButtonPress::operator =(const OnButtonPress& c) +{ + name=c.name; + mode=c.mode; + if(customButtonID) delete customButtonID; + customButtonID= c.customButtonID ? new unsigned int(c.customButtonID[0]) : 0; + return *this; +} + + +OnButtonPress::~OnButtonPress(void) +{ + if(customButtonID) delete customButtonID; +} + + +OnButtonPress::OnButtonPress(void) : + RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_BUTTONS__ONBUTTONPRESS), + customButtonID(0) +{ +} + + +OnButtonPress::OnButtonPress(const OnButtonPress& c) : RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_BUTTONS__ONBUTTONPRESS) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::ButtonName& OnButtonPress::get_name(void) +{ + return name; +} + +bool OnButtonPress::set_name(const NsSmartDeviceLinkRPCV2::ButtonName& name_) +{ + name=name_; + return true; +} + +const NsSmartDeviceLinkRPCV2::ButtonPressMode& OnButtonPress::get_mode(void) +{ + return mode; +} + +bool OnButtonPress::set_mode(const NsSmartDeviceLinkRPCV2::ButtonPressMode& mode_) +{ + mode=mode_; + return true; +} + +const unsigned int* OnButtonPress::get_customButtonID(void) +{ + return customButtonID; +} + +bool OnButtonPress::set_customButtonID(const unsigned int& customButtonID_) +{ + if(customButtonID) delete customButtonID; + customButtonID=new unsigned int(customButtonID_); + return true; +} + +void OnButtonPress::reset_customButtonID(void) +{ + if(customButtonID) delete customButtonID; + customButtonID=0; +} + +bool OnButtonPress::checkIntegrity(void) +{ + return OnButtonPressMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/OnButtonPressMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/OnButtonPressMarshaller.cpp new file mode 100644 index 000000000..0f6406656 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/OnButtonPressMarshaller.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/Buttons/OnButtonPress.h" +#include "../src/SDLRPCObjectsImpl/V2/ButtonNameMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ButtonPressModeMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/Buttons/OnButtonPressMarshaller.h" + +/* + interface NsRPC2Communication::Buttons + 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::Buttons; + +bool OnButtonPressMarshaller::checkIntegrity(OnButtonPress& s) +{ + return checkIntegrityConst(s); +} + + +bool OnButtonPressMarshaller::fromString(const std::string& s,OnButtonPress& 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 OnButtonPressMarshaller::toString(const OnButtonPress& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool OnButtonPressMarshaller::checkIntegrityConst(const OnButtonPress& s) +{ + if(!NsSmartDeviceLinkRPCV2::ButtonNameMarshaller::checkIntegrityConst(s.name)) return false; + + if(!NsSmartDeviceLinkRPCV2::ButtonPressModeMarshaller::checkIntegrityConst(s.mode)) return false; + + if(s.customButtonID && (s.customButtonID[0]>65536)) return false; + + return true; +} + + +Json::Value OnButtonPressMarshaller::toJSON(const OnButtonPress& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("Buttons.OnButtonPress"); + json["params"]=Json::Value(Json::objectValue); + + json["params"]["name"]=NsSmartDeviceLinkRPCV2::ButtonNameMarshaller::toJSON(e.name);; + json["params"]["mode"]=NsSmartDeviceLinkRPCV2::ButtonPressModeMarshaller::toJSON(e.mode);; + if(e.customButtonID) + json["params"]["customButtonID"]=Json::Value(e.customButtonID[0]);; + return json; +} + + +bool OnButtonPressMarshaller::fromJSON(const Json::Value& json,OnButtonPress& 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("Buttons.OnButtonPress")) return false; + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + + if(!js.isMember("name") || !NsSmartDeviceLinkRPCV2::ButtonNameMarshaller::fromJSON(js["name"],c.name)) return false; + + if(!js.isMember("mode") || !NsSmartDeviceLinkRPCV2::ButtonPressModeMarshaller::fromJSON(js["mode"],c.mode)) return false; + + if(c.customButtonID) delete c.customButtonID; + c.customButtonID=0; + if(js.isMember("customButtonID")) + { + if(!js["customButtonID"].isInt()) return false; + c.customButtonID=new unsigned int(); + c.customButtonID[0]=js["customButtonID"].asInt(); + if(c.customButtonID[0]>65536) return false; + + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/OnButtonPressMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/OnButtonPressMarshaller.h new file mode 100644 index 000000000..56d99c1e1 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/Buttons/OnButtonPressMarshaller.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_BUTTONS_ONBUTTONPRESSMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_BUTTONS_ONBUTTONPRESSMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/Buttons/OnButtonPress.h" + +namespace NsRPC2Communication +{ + namespace Buttons + { + + struct OnButtonPressMarshaller + { + static bool checkIntegrity(OnButtonPress& e); + static bool checkIntegrityConst(const OnButtonPress& e); + + static bool fromString(const std::string& s,OnButtonPress& e); + static const std::string toString(const OnButtonPress& e); + + static bool fromJSON(const Json::Value& s,OnButtonPress& e); + static Json::Value toJSON(const OnButtonPress& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/ChangeRegistration.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/ChangeRegistration.cpp new file mode 100644 index 000000000..677b85010 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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/TTS/ChangeRegistration.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + + +ChangeRegistration& ChangeRegistration::operator =(const ChangeRegistration& c) +{ + language=c.language; + appId=c.appId; + return *this; +} + + +ChangeRegistration::~ChangeRegistration(void) +{ +} + + +ChangeRegistration::ChangeRegistration(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__CHANGEREGISTRATION) +{ +} + + +ChangeRegistration::ChangeRegistration(const ChangeRegistration& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__CHANGEREGISTRATION,c.getId()) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::Language& ChangeRegistration::get_language(void) +{ + return language; +} + +bool ChangeRegistration::set_language(const NsSmartDeviceLinkRPCV2::Language& language_) +{ + language=language_; + 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/TTS/ChangeRegistrationMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/ChangeRegistrationMarshaller.cpp new file mode 100644 index 000000000..8caea11e6 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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/TTS/ChangeRegistration.h" +#include "../src/SDLRPCObjectsImpl/V2/LanguageMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/TTS/ChangeRegistrationMarshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + +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.language)) 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("TTS.ChangeRegistration"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["language"]=NsSmartDeviceLinkRPCV2::LanguageMarshaller::toJSON(e.language);; + 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("TTS.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("language") || !NsSmartDeviceLinkRPCV2::LanguageMarshaller::fromJSON(js["language"],c.language)) 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/TTS/ChangeRegistrationMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/ChangeRegistrationMarshaller.h new file mode 100644 index 000000000..4dea50265 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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_TTS_CHANGEREGISTRATIONMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_TTS_CHANGEREGISTRATIONMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/TTS/ChangeRegistration.h" + +namespace NsRPC2Communication +{ + namespace TTS + { + + 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/TTS/ChangeRegistrationResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/ChangeRegistrationResponse.cpp new file mode 100644 index 000000000..ac9e9e605 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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/TTS/ChangeRegistrationResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + + +ChangeRegistrationResponse& ChangeRegistrationResponse::operator =(const ChangeRegistrationResponse& c) +{ + return *this; +} + + +ChangeRegistrationResponse::~ChangeRegistrationResponse(void) +{ +} + + +ChangeRegistrationResponse::ChangeRegistrationResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__CHANGEREGISTRATIONRESPONSE) +{ +} + + +ChangeRegistrationResponse::ChangeRegistrationResponse(const ChangeRegistrationResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__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/TTS/ChangeRegistrationResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/ChangeRegistrationResponseMarshaller.cpp new file mode 100644 index 000000000..dc3906a48 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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/TTS/ChangeRegistrationResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/TTS/ChangeRegistrationResponseMarshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + +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("TTS.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("TTS.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/TTS/ChangeRegistrationResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/ChangeRegistrationResponseMarshaller.h new file mode 100644 index 000000000..1e2827c6c --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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_TTS_CHANGEREGISTRATIONRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_TTS_CHANGEREGISTRATIONRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/TTS/ChangeRegistrationResponse.h" + +namespace NsRPC2Communication +{ + namespace TTS + { + + 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/TTS/GetCapabilities.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetCapabilities.cpp new file mode 100644 index 000000000..2d795d56b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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/TTS/GetCapabilities.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + + +GetCapabilities& GetCapabilities::operator =(const GetCapabilities& c) +{ + return *this; +} + + +GetCapabilities::~GetCapabilities(void) +{ +} + + +GetCapabilities::GetCapabilities(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__GETCAPABILITIES) +{ +} + + +GetCapabilities::GetCapabilities(const GetCapabilities& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__GETCAPABILITIES,c.getId()) +{ + *this=c; +} + + +bool GetCapabilities::checkIntegrity(void) +{ + return GetCapabilitiesMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetCapabilitiesMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetCapabilitiesMarshaller.cpp new file mode 100644 index 000000000..53f80bf36 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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/TTS/GetCapabilities.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/TTS/GetCapabilitiesMarshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + +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("TTS.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("TTS.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/TTS/GetCapabilitiesMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetCapabilitiesMarshaller.h new file mode 100644 index 000000000..a51b33f6e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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_TTS_GETCAPABILITIESMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_TTS_GETCAPABILITIESMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/TTS/GetCapabilities.h" + +namespace NsRPC2Communication +{ + namespace TTS + { + + 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/TTS/GetCapabilitiesResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetCapabilitiesResponse.cpp new file mode 100644 index 000000000..c89469c1d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetCapabilitiesResponse.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/TTS/GetCapabilitiesResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + + +GetCapabilitiesResponse& GetCapabilitiesResponse::operator =(const GetCapabilitiesResponse& c) +{ + capabilities=c.capabilities; + return *this; +} + + +GetCapabilitiesResponse::~GetCapabilitiesResponse(void) +{ +} + + +GetCapabilitiesResponse::GetCapabilitiesResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__GETCAPABILITIESRESPONSE) +{ +} + + +GetCapabilitiesResponse::GetCapabilitiesResponse(const GetCapabilitiesResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__GETCAPABILITIESRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +const std::vector< NsSmartDeviceLinkRPCV2::SpeechCapabilities>& GetCapabilitiesResponse::get_capabilities(void) +{ + return capabilities; +} + +bool GetCapabilitiesResponse::set_capabilities(const std::vector< NsSmartDeviceLinkRPCV2::SpeechCapabilities>& capabilities_) +{ + capabilities=capabilities_; + return true; +} + +bool GetCapabilitiesResponse::checkIntegrity(void) +{ + return GetCapabilitiesResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetCapabilitiesResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetCapabilitiesResponseMarshaller.cpp new file mode 100644 index 000000000..33f5c88ca --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetCapabilitiesResponseMarshaller.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/TTS/GetCapabilitiesResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/SpeechCapabilitiesMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/TTS/GetCapabilitiesResponseMarshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + +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) +{ + { + unsigned int i=s.capabilities.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("TTS.GetCapabilitiesResponse"); + + { + unsigned int i=e.capabilities.size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::SpeechCapabilitiesMarshaller::toJSON(e.capabilities[i]); + + json["result"]["capabilities"]=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("TTS.GetCapabilitiesResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + if(!js.isMember("capabilities") || !js["capabilities"].isArray()) return false; + { + unsigned int i=js["capabilities"].size(); + if(i<1) return false; + if(i>100) return false; + c.capabilities.resize(i); + while(i--) + { + NsSmartDeviceLinkRPCV2::SpeechCapabilities t; + if(!NsSmartDeviceLinkRPCV2::SpeechCapabilitiesMarshaller::fromJSON(js["capabilities"][i],t)) + return false; + c.capabilities[i]=t; + } + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetCapabilitiesResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetCapabilitiesResponseMarshaller.h new file mode 100644 index 000000000..312fb9d61 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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_TTS_GETCAPABILITIESRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_TTS_GETCAPABILITIESRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/TTS/GetCapabilitiesResponse.h" + +namespace NsRPC2Communication +{ + namespace TTS + { + + 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/TTS/GetLanguage.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetLanguage.cpp new file mode 100644 index 000000000..aa76e3acd --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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/TTS/GetLanguage.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + + +GetLanguage& GetLanguage::operator =(const GetLanguage& c) +{ + return *this; +} + + +GetLanguage::~GetLanguage(void) +{ +} + + +GetLanguage::GetLanguage(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__GETLANGUAGE) +{ +} + + +GetLanguage::GetLanguage(const GetLanguage& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__GETLANGUAGE,c.getId()) +{ + *this=c; +} + + +bool GetLanguage::checkIntegrity(void) +{ + return GetLanguageMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetLanguageMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetLanguageMarshaller.cpp new file mode 100644 index 000000000..c6f3b9405 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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/TTS/GetLanguage.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/TTS/GetLanguageMarshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + +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("TTS.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("TTS.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/TTS/GetLanguageMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetLanguageMarshaller.h new file mode 100644 index 000000000..2ec47e7d5 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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_TTS_GETLANGUAGEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_TTS_GETLANGUAGEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/TTS/GetLanguage.h" + +namespace NsRPC2Communication +{ + namespace TTS + { + + 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/TTS/GetLanguageResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetLanguageResponse.cpp new file mode 100644 index 000000000..388dc5b2a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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/TTS/GetLanguageResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + + +GetLanguageResponse& GetLanguageResponse::operator =(const GetLanguageResponse& c) +{ + language=c.language; + return *this; +} + + +GetLanguageResponse::~GetLanguageResponse(void) +{ +} + + +GetLanguageResponse::GetLanguageResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__GETLANGUAGERESPONSE) +{ +} + + +GetLanguageResponse::GetLanguageResponse(const GetLanguageResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__GETLANGUAGERESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::Language& GetLanguageResponse::get_language(void) +{ + return language; +} + +bool GetLanguageResponse::set_language(const NsSmartDeviceLinkRPCV2::Language& language_) +{ + language=language_; + return true; +} + +bool GetLanguageResponse::checkIntegrity(void) +{ + return GetLanguageResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetLanguageResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetLanguageResponseMarshaller.cpp new file mode 100644 index 000000000..072c870b2 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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/TTS/GetLanguageResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/LanguageMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/TTS/GetLanguageResponseMarshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + +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.language)) 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("TTS.GetLanguageResponse"); + + json["result"]["language"]=NsSmartDeviceLinkRPCV2::LanguageMarshaller::toJSON(e.language);; + 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("TTS.GetLanguageResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + if(!js.isMember("language") || !NsSmartDeviceLinkRPCV2::LanguageMarshaller::fromJSON(js["language"],c.language)) return false; + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetLanguageResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetLanguageResponseMarshaller.h new file mode 100644 index 000000000..e8cddbb1c --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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_TTS_GETLANGUAGERESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_TTS_GETLANGUAGERESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/TTS/GetLanguageResponse.h" + +namespace NsRPC2Communication +{ + namespace TTS + { + + 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/TTS/GetSupportedLanguages.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetSupportedLanguages.cpp new file mode 100644 index 000000000..6e866e448 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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/TTS/GetSupportedLanguages.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + + +GetSupportedLanguages& GetSupportedLanguages::operator =(const GetSupportedLanguages& c) +{ + return *this; +} + + +GetSupportedLanguages::~GetSupportedLanguages(void) +{ +} + + +GetSupportedLanguages::GetSupportedLanguages(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__GETSUPPORTEDLANGUAGES) +{ +} + + +GetSupportedLanguages::GetSupportedLanguages(const GetSupportedLanguages& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__GETSUPPORTEDLANGUAGES,c.getId()) +{ + *this=c; +} + + +bool GetSupportedLanguages::checkIntegrity(void) +{ + return GetSupportedLanguagesMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetSupportedLanguagesMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetSupportedLanguagesMarshaller.cpp new file mode 100644 index 000000000..032c44710 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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/TTS/GetSupportedLanguages.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/TTS/GetSupportedLanguagesMarshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + +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("TTS.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("TTS.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/TTS/GetSupportedLanguagesMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetSupportedLanguagesMarshaller.h new file mode 100644 index 000000000..6c1cac285 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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_TTS_GETSUPPORTEDLANGUAGESMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_TTS_GETSUPPORTEDLANGUAGESMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/TTS/GetSupportedLanguages.h" + +namespace NsRPC2Communication +{ + namespace TTS + { + + 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/TTS/GetSupportedLanguagesResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetSupportedLanguagesResponse.cpp new file mode 100644 index 000000000..cc2034235 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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/TTS/GetSupportedLanguagesResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + + +GetSupportedLanguagesResponse& GetSupportedLanguagesResponse::operator =(const GetSupportedLanguagesResponse& c) +{ + languages=c.languages; + return *this; +} + + +GetSupportedLanguagesResponse::~GetSupportedLanguagesResponse(void) +{ +} + + +GetSupportedLanguagesResponse::GetSupportedLanguagesResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__GETSUPPORTEDLANGUAGESRESPONSE) +{ +} + + +GetSupportedLanguagesResponse::GetSupportedLanguagesResponse(const GetSupportedLanguagesResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__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/TTS/GetSupportedLanguagesResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetSupportedLanguagesResponseMarshaller.cpp new file mode 100644 index 000000000..950fccce3 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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/TTS/GetSupportedLanguagesResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/LanguageMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/TTS/GetSupportedLanguagesResponseMarshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + +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("TTS.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("TTS.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/TTS/GetSupportedLanguagesResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/GetSupportedLanguagesResponseMarshaller.h new file mode 100644 index 000000000..f47d3e77e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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_TTS_GETSUPPORTEDLANGUAGESRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_TTS_GETSUPPORTEDLANGUAGESRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/TTS/GetSupportedLanguagesResponse.h" + +namespace NsRPC2Communication +{ + namespace TTS + { + + 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/TTS/OnLanguageChange.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/OnLanguageChange.cpp new file mode 100644 index 000000000..085226645 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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/TTS/OnLanguageChange.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + + +OnLanguageChange& OnLanguageChange::operator =(const OnLanguageChange& c) +{ + language=c.language; + return *this; +} + + +OnLanguageChange::~OnLanguageChange(void) +{ +} + + +OnLanguageChange::OnLanguageChange(void) : + RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__ONLANGUAGECHANGE) +{ +} + + +OnLanguageChange::OnLanguageChange(const OnLanguageChange& c) : RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__ONLANGUAGECHANGE) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::Language& OnLanguageChange::get_language(void) +{ + return language; +} + +bool OnLanguageChange::set_language(const NsSmartDeviceLinkRPCV2::Language& language_) +{ + language=language_; + return true; +} + +bool OnLanguageChange::checkIntegrity(void) +{ + return OnLanguageChangeMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/OnLanguageChangeMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/OnLanguageChangeMarshaller.cpp new file mode 100644 index 000000000..950bb3602 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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/TTS/OnLanguageChange.h" +#include "../src/SDLRPCObjectsImpl/V2/LanguageMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/TTS/OnLanguageChangeMarshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + +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.language)) 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("TTS.OnLanguageChange"); + json["params"]=Json::Value(Json::objectValue); + + json["params"]["language"]=NsSmartDeviceLinkRPCV2::LanguageMarshaller::toJSON(e.language);; + 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("TTS.OnLanguageChange")) return false; + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + + if(!js.isMember("language") || !NsSmartDeviceLinkRPCV2::LanguageMarshaller::fromJSON(js["language"],c.language)) return false; + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/OnLanguageChangeMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/OnLanguageChangeMarshaller.h new file mode 100644 index 000000000..69273ac53 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/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_TTS_ONLANGUAGECHANGEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_TTS_ONLANGUAGECHANGEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/TTS/OnLanguageChange.h" + +namespace NsRPC2Communication +{ + namespace TTS + { + + 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/TTS/Speak.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/Speak.cpp new file mode 100644 index 000000000..1c40aae0c --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/Speak.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/TTS/Speak.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + + +Speak& Speak::operator =(const Speak& c) +{ + ttsChunks=c.ttsChunks; + appId=c.appId; + return *this; +} + + +Speak::~Speak(void) +{ +} + + +Speak::Speak(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__SPEAK) +{ +} + + +Speak::Speak(const Speak& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__SPEAK,c.getId()) +{ + *this=c; +} + + +const std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>& Speak::get_ttsChunks(void) +{ + return ttsChunks; +} + +bool Speak::set_ttsChunks(const std::vector< NsSmartDeviceLinkRPCV2::TTSChunk>& ttsChunks_) +{ + ttsChunks=ttsChunks_; + return true; +} + +int Speak::get_appId(void) +{ + return appId; +} + +bool Speak::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool Speak::checkIntegrity(void) +{ + return SpeakMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/SpeakMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/SpeakMarshaller.cpp new file mode 100644 index 000000000..38003bc7a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/SpeakMarshaller.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/TTS/Speak.h" +#include "../src/SDLRPCObjectsImpl/V2/TTSChunkMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/TTS/SpeakMarshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + +bool SpeakMarshaller::checkIntegrity(Speak& s) +{ + return checkIntegrityConst(s); +} + + +bool SpeakMarshaller::fromString(const std::string& s,Speak& 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 SpeakMarshaller::toString(const Speak& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SpeakMarshaller::checkIntegrityConst(const Speak& s) +{ + { + unsigned int i=s.ttsChunks.size(); + if(i<1) return false; + if(i>100) return false; + } + + return true; +} + + +Json::Value SpeakMarshaller::toJSON(const Speak& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("TTS.Speak"); + + 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; + } + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool SpeakMarshaller::fromJSON(const Json::Value& json,Speak& 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("TTS.Speak")) 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("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/TTS/SpeakMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/SpeakMarshaller.h new file mode 100644 index 000000000..9a1b602f4 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/SpeakMarshaller.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_TTS_SPEAKMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_TTS_SPEAKMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/TTS/Speak.h" + +namespace NsRPC2Communication +{ + namespace TTS + { + + struct SpeakMarshaller + { + static bool checkIntegrity(Speak& e); + static bool checkIntegrityConst(const Speak& e); + + static bool fromString(const std::string& s,Speak& e); + static const std::string toString(const Speak& e); + + static bool fromJSON(const Json::Value& s,Speak& e); + static Json::Value toJSON(const Speak& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/SpeakResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/SpeakResponse.cpp new file mode 100644 index 000000000..c75c589c9 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/SpeakResponse.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/TTS/SpeakResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + + +SpeakResponse& SpeakResponse::operator =(const SpeakResponse& c) +{ + return *this; +} + + +SpeakResponse::~SpeakResponse(void) +{ +} + + +SpeakResponse::SpeakResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__SPEAKRESPONSE) +{ +} + + +SpeakResponse::SpeakResponse(const SpeakResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_TTS__SPEAKRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +bool SpeakResponse::checkIntegrity(void) +{ + return SpeakResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/SpeakResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/SpeakResponseMarshaller.cpp new file mode 100644 index 000000000..ff0c51db3 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/SpeakResponseMarshaller.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/TTS/SpeakResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/TTS/SpeakResponseMarshaller.h" + +/* + interface NsRPC2Communication::TTS + 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::TTS; + +bool SpeakResponseMarshaller::checkIntegrity(SpeakResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool SpeakResponseMarshaller::fromString(const std::string& s,SpeakResponse& 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 SpeakResponseMarshaller::toString(const SpeakResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SpeakResponseMarshaller::checkIntegrityConst(const SpeakResponse& s) +{ + return true; +} + + +Json::Value SpeakResponseMarshaller::toJSON(const SpeakResponse& 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("TTS.SpeakResponse"); + + return json; +} + + +bool SpeakResponseMarshaller::fromJSON(const Json::Value& json,SpeakResponse& 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("TTS.SpeakResponse")) 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/TTS/SpeakResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/SpeakResponseMarshaller.h new file mode 100644 index 000000000..c8929c25f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/TTS/SpeakResponseMarshaller.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_TTS_SPEAKRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_TTS_SPEAKRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/TTS/SpeakResponse.h" + +namespace NsRPC2Communication +{ + namespace TTS + { + + struct SpeakResponseMarshaller + { + static bool checkIntegrity(SpeakResponse& e); + static bool checkIntegrityConst(const SpeakResponse& e); + + static bool fromString(const std::string& s,SpeakResponse& e); + static const std::string toString(const SpeakResponse& e); + + static bool fromJSON(const Json::Value& s,SpeakResponse& e); + static Json::Value toJSON(const SpeakResponse& e); + }; + } +} + +#endif 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 diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/AddCommand.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/AddCommand.cpp new file mode 100644 index 000000000..654b41e3d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/AddCommand.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/VR/AddCommand.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + + +AddCommand& AddCommand::operator =(const AddCommand& c) +{ + cmdId=c.cmdId; + vrCommands=c.vrCommands; + appId=c.appId; + return *this; +} + + +AddCommand::~AddCommand(void) +{ +} + + +AddCommand::AddCommand(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__ADDCOMMAND) +{ +} + + +AddCommand::AddCommand(const AddCommand& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__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 std::vector< std::string>& AddCommand::get_vrCommands(void) +{ + return vrCommands; +} + +bool AddCommand::set_vrCommands(const std::vector< std::string>& vrCommands_) +{ + vrCommands=vrCommands_; + return true; +} + +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/VR/AddCommandMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/AddCommandMarshaller.cpp new file mode 100644 index 000000000..8732d1e64 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/AddCommandMarshaller.cpp @@ -0,0 +1,167 @@ +// +// 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/VR/AddCommand.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VR/AddCommandMarshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + +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; + + { + unsigned int i=s.vrCommands.size(); + if(i<1) return false; + if(i>100) return false; + while(i--) + { + if(s.vrCommands[i].length()>99) 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("VR.AddCommand"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["cmdId"]=Json::Value(e.cmdId);; + { + unsigned int i=e.vrCommands.size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=Json::Value(e.vrCommands[i]); + + json["params"]["vrCommands"]=j; + } + 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("VR.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("vrCommands") || !js["vrCommands"].isArray()) + return false; + { + c.vrCommands.clear(); + unsigned int i=js["vrCommands"].size(); + if(i<1) return false; + if(i>100) return false; + c.vrCommands.resize(i); + while(i--) + { + if(!js["vrCommands"][i].isString()) + return false; + c.vrCommands[i]=js["vrCommands"][i].asString(); + if(c.vrCommands[i].length()>99) 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/VR/AddCommandMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/AddCommandMarshaller.h new file mode 100644 index 000000000..7ba2de53a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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_VR_ADDCOMMANDMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VR_ADDCOMMANDMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VR/AddCommand.h" + +namespace NsRPC2Communication +{ + namespace VR + { + + 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/VR/AddCommandResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/AddCommandResponse.cpp new file mode 100644 index 000000000..96bcf628e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/AddCommandResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + + +AddCommandResponse& AddCommandResponse::operator =(const AddCommandResponse& c) +{ + return *this; +} + + +AddCommandResponse::~AddCommandResponse(void) +{ +} + + +AddCommandResponse::AddCommandResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__ADDCOMMANDRESPONSE) +{ +} + + +AddCommandResponse::AddCommandResponse(const AddCommandResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__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/VR/AddCommandResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/AddCommandResponseMarshaller.cpp new file mode 100644 index 000000000..a640a3139 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/AddCommandResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VR/AddCommandResponseMarshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + +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("VR.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("VR.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/VR/AddCommandResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/AddCommandResponseMarshaller.h new file mode 100644 index 000000000..caae5f540 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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_VR_ADDCOMMANDRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VR_ADDCOMMANDRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VR/AddCommandResponse.h" + +namespace NsRPC2Communication +{ + namespace VR + { + + 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/VR/ChangeRegistration.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/ChangeRegistration.cpp new file mode 100644 index 000000000..c07053b9b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/ChangeRegistration.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + + +ChangeRegistration& ChangeRegistration::operator =(const ChangeRegistration& c) +{ + language=c.language; + appId=c.appId; + return *this; +} + + +ChangeRegistration::~ChangeRegistration(void) +{ +} + + +ChangeRegistration::ChangeRegistration(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__CHANGEREGISTRATION) +{ +} + + +ChangeRegistration::ChangeRegistration(const ChangeRegistration& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__CHANGEREGISTRATION,c.getId()) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::Language& ChangeRegistration::get_language(void) +{ + return language; +} + +bool ChangeRegistration::set_language(const NsSmartDeviceLinkRPCV2::Language& language_) +{ + language=language_; + 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/VR/ChangeRegistrationMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/ChangeRegistrationMarshaller.cpp new file mode 100644 index 000000000..57c3f2dd0 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/ChangeRegistration.h" +#include "../src/SDLRPCObjectsImpl/V2/LanguageMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VR/ChangeRegistrationMarshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + +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.language)) 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("VR.ChangeRegistration"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["language"]=NsSmartDeviceLinkRPCV2::LanguageMarshaller::toJSON(e.language);; + 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("VR.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("language") || !NsSmartDeviceLinkRPCV2::LanguageMarshaller::fromJSON(js["language"],c.language)) 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/VR/ChangeRegistrationMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/ChangeRegistrationMarshaller.h new file mode 100644 index 000000000..faa5a8d8a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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_VR_CHANGEREGISTRATIONMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VR_CHANGEREGISTRATIONMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VR/ChangeRegistration.h" + +namespace NsRPC2Communication +{ + namespace VR + { + + 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/VR/ChangeRegistrationResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/ChangeRegistrationResponse.cpp new file mode 100644 index 000000000..ac09f306f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/ChangeRegistrationResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + + +ChangeRegistrationResponse& ChangeRegistrationResponse::operator =(const ChangeRegistrationResponse& c) +{ + return *this; +} + + +ChangeRegistrationResponse::~ChangeRegistrationResponse(void) +{ +} + + +ChangeRegistrationResponse::ChangeRegistrationResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__CHANGEREGISTRATIONRESPONSE) +{ +} + + +ChangeRegistrationResponse::ChangeRegistrationResponse(const ChangeRegistrationResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__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/VR/ChangeRegistrationResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/ChangeRegistrationResponseMarshaller.cpp new file mode 100644 index 000000000..6e724f0d8 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/ChangeRegistrationResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VR/ChangeRegistrationResponseMarshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + +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("VR.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("VR.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/VR/ChangeRegistrationResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/ChangeRegistrationResponseMarshaller.h new file mode 100644 index 000000000..631a4636d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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_VR_CHANGEREGISTRATIONRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VR_CHANGEREGISTRATIONRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VR/ChangeRegistrationResponse.h" + +namespace NsRPC2Communication +{ + namespace VR + { + + 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/VR/DeleteCommand.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/DeleteCommand.cpp new file mode 100644 index 000000000..c7a1eb60f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/DeleteCommand.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + + +DeleteCommand& DeleteCommand::operator =(const DeleteCommand& c) +{ + cmdId=c.cmdId; + appId=c.appId; + return *this; +} + + +DeleteCommand::~DeleteCommand(void) +{ +} + + +DeleteCommand::DeleteCommand(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__DELETECOMMAND) +{ +} + + +DeleteCommand::DeleteCommand(const DeleteCommand& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__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/VR/DeleteCommandMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/DeleteCommandMarshaller.cpp new file mode 100644 index 000000000..f640777cb --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/DeleteCommand.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VR/DeleteCommandMarshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + +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("VR.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("VR.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/VR/DeleteCommandMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/DeleteCommandMarshaller.h new file mode 100644 index 000000000..e3d2e9394 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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_VR_DELETECOMMANDMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VR_DELETECOMMANDMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VR/DeleteCommand.h" + +namespace NsRPC2Communication +{ + namespace VR + { + + 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/VR/DeleteCommandResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/DeleteCommandResponse.cpp new file mode 100644 index 000000000..58ec913c3 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/DeleteCommandResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + + +DeleteCommandResponse& DeleteCommandResponse::operator =(const DeleteCommandResponse& c) +{ + return *this; +} + + +DeleteCommandResponse::~DeleteCommandResponse(void) +{ +} + + +DeleteCommandResponse::DeleteCommandResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__DELETECOMMANDRESPONSE) +{ +} + + +DeleteCommandResponse::DeleteCommandResponse(const DeleteCommandResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__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/VR/DeleteCommandResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/DeleteCommandResponseMarshaller.cpp new file mode 100644 index 000000000..9cc603e86 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/DeleteCommandResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VR/DeleteCommandResponseMarshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + +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("VR.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("VR.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/VR/DeleteCommandResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/DeleteCommandResponseMarshaller.h new file mode 100644 index 000000000..1cd11b9b0 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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_VR_DELETECOMMANDRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VR_DELETECOMMANDRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VR/DeleteCommandResponse.h" + +namespace NsRPC2Communication +{ + namespace VR + { + + 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/VR/GetCapabilities.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetCapabilities.cpp new file mode 100644 index 000000000..94737ac60 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/GetCapabilities.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + + +GetCapabilities& GetCapabilities::operator =(const GetCapabilities& c) +{ + return *this; +} + + +GetCapabilities::~GetCapabilities(void) +{ +} + + +GetCapabilities::GetCapabilities(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__GETCAPABILITIES) +{ +} + + +GetCapabilities::GetCapabilities(const GetCapabilities& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__GETCAPABILITIES,c.getId()) +{ + *this=c; +} + + +bool GetCapabilities::checkIntegrity(void) +{ + return GetCapabilitiesMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetCapabilitiesMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetCapabilitiesMarshaller.cpp new file mode 100644 index 000000000..b22296f50 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/GetCapabilities.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VR/GetCapabilitiesMarshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + +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("VR.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("VR.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/VR/GetCapabilitiesMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetCapabilitiesMarshaller.h new file mode 100644 index 000000000..1136747da --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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_VR_GETCAPABILITIESMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VR_GETCAPABILITIESMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VR/GetCapabilities.h" + +namespace NsRPC2Communication +{ + namespace VR + { + + 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/VR/GetCapabilitiesResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetCapabilitiesResponse.cpp new file mode 100644 index 000000000..2fdc952ae --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetCapabilitiesResponse.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/VR/GetCapabilitiesResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + + +GetCapabilitiesResponse& GetCapabilitiesResponse::operator =(const GetCapabilitiesResponse& c) +{ + capabilities=c.capabilities; + return *this; +} + + +GetCapabilitiesResponse::~GetCapabilitiesResponse(void) +{ +} + + +GetCapabilitiesResponse::GetCapabilitiesResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__GETCAPABILITIESRESPONSE) +{ +} + + +GetCapabilitiesResponse::GetCapabilitiesResponse(const GetCapabilitiesResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__GETCAPABILITIESRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +const std::vector< NsSmartDeviceLinkRPCV2::VrCapabilities>& GetCapabilitiesResponse::get_capabilities(void) +{ + return capabilities; +} + +bool GetCapabilitiesResponse::set_capabilities(const std::vector< NsSmartDeviceLinkRPCV2::VrCapabilities>& capabilities_) +{ + capabilities=capabilities_; + return true; +} + +bool GetCapabilitiesResponse::checkIntegrity(void) +{ + return GetCapabilitiesResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetCapabilitiesResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetCapabilitiesResponseMarshaller.cpp new file mode 100644 index 000000000..b8aeace1f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetCapabilitiesResponseMarshaller.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/VR/GetCapabilitiesResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/VrCapabilitiesMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VR/GetCapabilitiesResponseMarshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + +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) +{ + { + unsigned int i=s.capabilities.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("VR.GetCapabilitiesResponse"); + + { + unsigned int i=e.capabilities.size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::VrCapabilitiesMarshaller::toJSON(e.capabilities[i]); + + json["result"]["capabilities"]=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("VR.GetCapabilitiesResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + if(!js.isMember("capabilities") || !js["capabilities"].isArray()) return false; + { + unsigned int i=js["capabilities"].size(); + if(i<1) return false; + if(i>100) return false; + c.capabilities.resize(i); + while(i--) + { + NsSmartDeviceLinkRPCV2::VrCapabilities t; + if(!NsSmartDeviceLinkRPCV2::VrCapabilitiesMarshaller::fromJSON(js["capabilities"][i],t)) + return false; + c.capabilities[i]=t; + } + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetCapabilitiesResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetCapabilitiesResponseMarshaller.h new file mode 100644 index 000000000..243c1c48b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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_VR_GETCAPABILITIESRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VR_GETCAPABILITIESRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VR/GetCapabilitiesResponse.h" + +namespace NsRPC2Communication +{ + namespace VR + { + + 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/VR/GetLanguage.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetLanguage.cpp new file mode 100644 index 000000000..c7282c494 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/GetLanguage.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + + +GetLanguage& GetLanguage::operator =(const GetLanguage& c) +{ + return *this; +} + + +GetLanguage::~GetLanguage(void) +{ +} + + +GetLanguage::GetLanguage(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__GETLANGUAGE) +{ +} + + +GetLanguage::GetLanguage(const GetLanguage& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__GETLANGUAGE,c.getId()) +{ + *this=c; +} + + +bool GetLanguage::checkIntegrity(void) +{ + return GetLanguageMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetLanguageMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetLanguageMarshaller.cpp new file mode 100644 index 000000000..cf84bb503 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/GetLanguage.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VR/GetLanguageMarshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + +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("VR.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("VR.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/VR/GetLanguageMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetLanguageMarshaller.h new file mode 100644 index 000000000..58456a6bc --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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_VR_GETLANGUAGEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VR_GETLANGUAGEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VR/GetLanguage.h" + +namespace NsRPC2Communication +{ + namespace VR + { + + 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/VR/GetLanguageResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetLanguageResponse.cpp new file mode 100644 index 000000000..09542f5e8 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/GetLanguageResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + + +GetLanguageResponse& GetLanguageResponse::operator =(const GetLanguageResponse& c) +{ + language=c.language; + return *this; +} + + +GetLanguageResponse::~GetLanguageResponse(void) +{ +} + + +GetLanguageResponse::GetLanguageResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__GETLANGUAGERESPONSE) +{ +} + + +GetLanguageResponse::GetLanguageResponse(const GetLanguageResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__GETLANGUAGERESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::Language& GetLanguageResponse::get_language(void) +{ + return language; +} + +bool GetLanguageResponse::set_language(const NsSmartDeviceLinkRPCV2::Language& language_) +{ + language=language_; + return true; +} + +bool GetLanguageResponse::checkIntegrity(void) +{ + return GetLanguageResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetLanguageResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetLanguageResponseMarshaller.cpp new file mode 100644 index 000000000..6ccd0ac06 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/GetLanguageResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/LanguageMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VR/GetLanguageResponseMarshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + +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.language)) 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("VR.GetLanguageResponse"); + + json["result"]["language"]=NsSmartDeviceLinkRPCV2::LanguageMarshaller::toJSON(e.language);; + 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("VR.GetLanguageResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + if(!js.isMember("language") || !NsSmartDeviceLinkRPCV2::LanguageMarshaller::fromJSON(js["language"],c.language)) return false; + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetLanguageResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetLanguageResponseMarshaller.h new file mode 100644 index 000000000..50f3610b1 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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_VR_GETLANGUAGERESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VR_GETLANGUAGERESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VR/GetLanguageResponse.h" + +namespace NsRPC2Communication +{ + namespace VR + { + + 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/VR/GetSupportedLanguages.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetSupportedLanguages.cpp new file mode 100644 index 000000000..bd9c31219 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/GetSupportedLanguages.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + + +GetSupportedLanguages& GetSupportedLanguages::operator =(const GetSupportedLanguages& c) +{ + return *this; +} + + +GetSupportedLanguages::~GetSupportedLanguages(void) +{ +} + + +GetSupportedLanguages::GetSupportedLanguages(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__GETSUPPORTEDLANGUAGES) +{ +} + + +GetSupportedLanguages::GetSupportedLanguages(const GetSupportedLanguages& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__GETSUPPORTEDLANGUAGES,c.getId()) +{ + *this=c; +} + + +bool GetSupportedLanguages::checkIntegrity(void) +{ + return GetSupportedLanguagesMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetSupportedLanguagesMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetSupportedLanguagesMarshaller.cpp new file mode 100644 index 000000000..7d7862d78 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/GetSupportedLanguages.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VR/GetSupportedLanguagesMarshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + +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("VR.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("VR.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/VR/GetSupportedLanguagesMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetSupportedLanguagesMarshaller.h new file mode 100644 index 000000000..a18a11f5a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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_VR_GETSUPPORTEDLANGUAGESMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VR_GETSUPPORTEDLANGUAGESMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VR/GetSupportedLanguages.h" + +namespace NsRPC2Communication +{ + namespace VR + { + + 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/VR/GetSupportedLanguagesResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetSupportedLanguagesResponse.cpp new file mode 100644 index 000000000..fb9aea6ec --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/GetSupportedLanguagesResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + + +GetSupportedLanguagesResponse& GetSupportedLanguagesResponse::operator =(const GetSupportedLanguagesResponse& c) +{ + languages=c.languages; + return *this; +} + + +GetSupportedLanguagesResponse::~GetSupportedLanguagesResponse(void) +{ +} + + +GetSupportedLanguagesResponse::GetSupportedLanguagesResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__GETSUPPORTEDLANGUAGESRESPONSE) +{ +} + + +GetSupportedLanguagesResponse::GetSupportedLanguagesResponse(const GetSupportedLanguagesResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__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/VR/GetSupportedLanguagesResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetSupportedLanguagesResponseMarshaller.cpp new file mode 100644 index 000000000..4c43853e3 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/GetSupportedLanguagesResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/LanguageMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VR/GetSupportedLanguagesResponseMarshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + +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("VR.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("VR.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/VR/GetSupportedLanguagesResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/GetSupportedLanguagesResponseMarshaller.h new file mode 100644 index 000000000..998a5c093 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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_VR_GETSUPPORTEDLANGUAGESRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VR_GETSUPPORTEDLANGUAGESRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VR/GetSupportedLanguagesResponse.h" + +namespace NsRPC2Communication +{ + namespace VR + { + + 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/VR/OnCommand.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/OnCommand.cpp new file mode 100644 index 000000000..b40b2b0ac --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/OnCommand.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + + +OnCommand& OnCommand::operator =(const OnCommand& c) +{ + cmdID=c.cmdID; + appId=c.appId; + return *this; +} + + +OnCommand::~OnCommand(void) +{ +} + + +OnCommand::OnCommand(void) : + RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__ONCOMMAND) +{ +} + + +OnCommand::OnCommand(const OnCommand& c) : RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__ONCOMMAND) +{ + *this=c; +} + + +unsigned int OnCommand::get_cmdID(void) +{ + return cmdID; +} + +bool OnCommand::set_cmdID(unsigned int cmdID_) +{ + cmdID=cmdID_; + 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/VR/OnCommandMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/OnCommandMarshaller.cpp new file mode 100644 index 000000000..dac3df5aa --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/OnCommand.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VR/OnCommandMarshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + +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.cmdID>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("VR.OnCommand"); + json["params"]=Json::Value(Json::objectValue); + + json["params"]["cmdID"]=Json::Value(e.cmdID);; + 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("VR.OnCommand")) return false; + 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/VR/OnCommandMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/OnCommandMarshaller.h new file mode 100644 index 000000000..0e523d280 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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_VR_ONCOMMANDMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VR_ONCOMMANDMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VR/OnCommand.h" + +namespace NsRPC2Communication +{ + namespace VR + { + + 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/VR/OnLanguageChange.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/OnLanguageChange.cpp new file mode 100644 index 000000000..4f7b7605d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/OnLanguageChange.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + + +OnLanguageChange& OnLanguageChange::operator =(const OnLanguageChange& c) +{ + language=c.language; + return *this; +} + + +OnLanguageChange::~OnLanguageChange(void) +{ +} + + +OnLanguageChange::OnLanguageChange(void) : + RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__ONLANGUAGECHANGE) +{ +} + + +OnLanguageChange::OnLanguageChange(const OnLanguageChange& c) : RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_VR__ONLANGUAGECHANGE) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::Language& OnLanguageChange::get_language(void) +{ + return language; +} + +bool OnLanguageChange::set_language(const NsSmartDeviceLinkRPCV2::Language& language_) +{ + language=language_; + return true; +} + +bool OnLanguageChange::checkIntegrity(void) +{ + return OnLanguageChangeMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/OnLanguageChangeMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/OnLanguageChangeMarshaller.cpp new file mode 100644 index 000000000..34d9ab363 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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/VR/OnLanguageChange.h" +#include "../src/SDLRPCObjectsImpl/V2/LanguageMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VR/OnLanguageChangeMarshaller.h" + +/* + interface NsRPC2Communication::VR + 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::VR; + +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.language)) 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("VR.OnLanguageChange"); + json["params"]=Json::Value(Json::objectValue); + + json["params"]["language"]=NsSmartDeviceLinkRPCV2::LanguageMarshaller::toJSON(e.language);; + 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("VR.OnLanguageChange")) return false; + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + + if(!js.isMember("language") || !NsSmartDeviceLinkRPCV2::LanguageMarshaller::fromJSON(js["language"],c.language)) return false; + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/OnLanguageChangeMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/OnLanguageChangeMarshaller.h new file mode 100644 index 000000000..b80d7b952 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VR/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_VR_ONLANGUAGECHANGEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VR_ONLANGUAGECHANGEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VR/OnLanguageChange.h" + +namespace NsRPC2Communication +{ + namespace VR + { + + 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/VehicleInfo/GetDTCs.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetDTCs.cpp new file mode 100644 index 000000000..a3c87aca2 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetDTCs.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/VehicleInfo/GetDTCs.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VehicleInfo + 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::VehicleInfo; + + +GetDTCs& GetDTCs::operator =(const GetDTCs& c) +{ + ecuName=c.ecuName; + if(encrypted) delete encrypted; + encrypted= c.encrypted ? new bool(c.encrypted[0]) : 0; + appId=c.appId; + return *this; +} + + +GetDTCs::~GetDTCs(void) +{ + if(encrypted) delete encrypted; +} + + +GetDTCs::GetDTCs(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VEHICLEINFO__GETDTCS), + encrypted(0) +{ +} + + +GetDTCs::GetDTCs(const GetDTCs& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VEHICLEINFO__GETDTCS,c.getId()) +{ + *this=c; +} + + +unsigned int GetDTCs::get_ecuName(void) +{ + return ecuName; +} + +bool GetDTCs::set_ecuName(unsigned int ecuName_) +{ + ecuName=ecuName_; + return true; +} + +const bool* GetDTCs::get_encrypted(void) +{ + return encrypted; +} + +bool GetDTCs::set_encrypted(const bool& encrypted_) +{ + if(encrypted) delete encrypted; + encrypted=new bool(encrypted_); + return true; +} + +void GetDTCs::reset_encrypted(void) +{ + if(encrypted) delete encrypted; + encrypted=0; +} + +int GetDTCs::get_appId(void) +{ + return appId; +} + +bool GetDTCs::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool GetDTCs::checkIntegrity(void) +{ + return GetDTCsMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetDTCsMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetDTCsMarshaller.cpp new file mode 100644 index 000000000..f02c40215 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetDTCsMarshaller.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/VehicleInfo/GetDTCs.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VehicleInfo/GetDTCsMarshaller.h" + +/* + interface NsRPC2Communication::VehicleInfo + 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::VehicleInfo; + +bool GetDTCsMarshaller::checkIntegrity(GetDTCs& s) +{ + return checkIntegrityConst(s); +} + + +bool GetDTCsMarshaller::fromString(const std::string& s,GetDTCs& 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 GetDTCsMarshaller::toString(const GetDTCs& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool GetDTCsMarshaller::checkIntegrityConst(const GetDTCs& s) +{ + if(s.ecuName>65535) return false; + + return true; +} + + +Json::Value GetDTCsMarshaller::toJSON(const GetDTCs& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("VehicleInfo.GetDTCs"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["ecuName"]=Json::Value(e.ecuName);; + if(e.encrypted) + json["params"]["encrypted"]=Json::Value(e.encrypted[0]);; + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool GetDTCsMarshaller::fromJSON(const Json::Value& json,GetDTCs& 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("VehicleInfo.GetDTCs")) 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("ecuName") || !js["ecuName"].isInt()) return false; + c.ecuName=js["ecuName"].asInt(); + if(c.ecuName>65535) return false; + + if(c.encrypted) delete c.encrypted; + c.encrypted=0; + if(js.isMember("encrypted")) + { + if(!js["encrypted"].isBool()) return false; + c.encrypted=new bool(); + c.encrypted[0]=js["encrypted"].asBool(); + + } + + 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/VehicleInfo/GetDTCsMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetDTCsMarshaller.h new file mode 100644 index 000000000..aae1bde8d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetDTCsMarshaller.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_VEHICLEINFO_GETDTCSMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VEHICLEINFO_GETDTCSMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VehicleInfo/GetDTCs.h" + +namespace NsRPC2Communication +{ + namespace VehicleInfo + { + + struct GetDTCsMarshaller + { + static bool checkIntegrity(GetDTCs& e); + static bool checkIntegrityConst(const GetDTCs& e); + + static bool fromString(const std::string& s,GetDTCs& e); + static const std::string toString(const GetDTCs& e); + + static bool fromJSON(const Json::Value& s,GetDTCs& e); + static Json::Value toJSON(const GetDTCs& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetDTCsResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetDTCsResponse.cpp new file mode 100644 index 000000000..04d170d97 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetDTCsResponse.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/VehicleInfo/GetDTCsResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VehicleInfo + 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::VehicleInfo; + + +GetDTCsResponse& GetDTCsResponse::operator =(const GetDTCsResponse& c) +{ + if(dtcList) delete dtcList; + dtcList= c.dtcList ? new std::vector<NsSmartDeviceLinkRPCV2::DTC>(c.dtcList[0]) : 0; + return *this; +} + + +GetDTCsResponse::~GetDTCsResponse(void) +{ + if(dtcList) delete dtcList; +} + + +GetDTCsResponse::GetDTCsResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VEHICLEINFO__GETDTCSRESPONSE), + dtcList(0) +{ +} + + +GetDTCsResponse::GetDTCsResponse(const GetDTCsResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VEHICLEINFO__GETDTCSRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +const std::vector< NsSmartDeviceLinkRPCV2::DTC>* GetDTCsResponse::get_dtcList(void) +{ + return dtcList; +} + +bool GetDTCsResponse::set_dtcList(const std::vector< NsSmartDeviceLinkRPCV2::DTC>& dtcList_) +{ + if(dtcList) delete dtcList; + dtcList=new std::vector< NsSmartDeviceLinkRPCV2::DTC>(dtcList_); + return true; +} + +void GetDTCsResponse::reset_dtcList(void) +{ + if(dtcList) delete dtcList; + dtcList=0; +} + +bool GetDTCsResponse::checkIntegrity(void) +{ + return GetDTCsResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetDTCsResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetDTCsResponseMarshaller.cpp new file mode 100644 index 000000000..c2cd4ec6c --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetDTCsResponseMarshaller.cpp @@ -0,0 +1,162 @@ +// +// 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/VehicleInfo/GetDTCsResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/DTCMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VehicleInfo/GetDTCsResponseMarshaller.h" + +/* + interface NsRPC2Communication::VehicleInfo + 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::VehicleInfo; + +bool GetDTCsResponseMarshaller::checkIntegrity(GetDTCsResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool GetDTCsResponseMarshaller::fromString(const std::string& s,GetDTCsResponse& 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 GetDTCsResponseMarshaller::toString(const GetDTCsResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool GetDTCsResponseMarshaller::checkIntegrityConst(const GetDTCsResponse& s) +{ + if(s.dtcList) + { + unsigned int i=s.dtcList[0].size(); + if(i<1) return false; + if(i>100) return false; + } + + return true; +} + + +Json::Value GetDTCsResponseMarshaller::toJSON(const GetDTCsResponse& 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("VehicleInfo.GetDTCsResponse"); + + if(e.dtcList) + { + unsigned int i=e.dtcList[0].size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::DTCMarshaller::toJSON(e.dtcList[0][i]); + + json["result"]["dtcList"]=j; + } + return json; +} + + +bool GetDTCsResponseMarshaller::fromJSON(const Json::Value& json,GetDTCsResponse& 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("VehicleInfo.GetDTCsResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + if(c.dtcList) delete c.dtcList; + c.dtcList=0; + if(js.isMember("dtcList")) + { + if(!js["dtcList"].isArray()) return false; + unsigned int i=js["dtcList"].size(); + if(i<1) return false; + if(i>100) return false; + + c.dtcList=new std::vector<NsSmartDeviceLinkRPCV2::DTC>(); + c.dtcList->resize(js["dtcList"].size()); + + while(i--) + if(!NsSmartDeviceLinkRPCV2::DTCMarshaller::fromJSON(js["dtcList"][i],c.dtcList[0][i])) return false; + } + + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetDTCsResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetDTCsResponseMarshaller.h new file mode 100644 index 000000000..9737b7f96 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetDTCsResponseMarshaller.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_VEHICLEINFO_GETDTCSRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VEHICLEINFO_GETDTCSRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VehicleInfo/GetDTCsResponse.h" + +namespace NsRPC2Communication +{ + namespace VehicleInfo + { + + struct GetDTCsResponseMarshaller + { + static bool checkIntegrity(GetDTCsResponse& e); + static bool checkIntegrityConst(const GetDTCsResponse& e); + + static bool fromString(const std::string& s,GetDTCsResponse& e); + static const std::string toString(const GetDTCsResponse& e); + + static bool fromJSON(const Json::Value& s,GetDTCsResponse& e); + static Json::Value toJSON(const GetDTCsResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleData.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleData.cpp new file mode 100644 index 000000000..89ea015b3 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleData.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/VehicleInfo/GetVehicleData.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VehicleInfo + 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::VehicleInfo; + + +GetVehicleData& GetVehicleData::operator =(const GetVehicleData& c) +{ + dataType=c.dataType; + appId=c.appId; + return *this; +} + + +GetVehicleData::~GetVehicleData(void) +{ +} + + +GetVehicleData::GetVehicleData(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VEHICLEINFO__GETVEHICLEDATA) +{ +} + + +GetVehicleData::GetVehicleData(const GetVehicleData& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VEHICLEINFO__GETVEHICLEDATA,c.getId()) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::VehicleDataType& GetVehicleData::get_dataType(void) +{ + return dataType; +} + +bool GetVehicleData::set_dataType(const NsSmartDeviceLinkRPCV2::VehicleDataType& dataType_) +{ + dataType=dataType_; + return true; +} + +int GetVehicleData::get_appId(void) +{ + return appId; +} + +bool GetVehicleData::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool GetVehicleData::checkIntegrity(void) +{ + return GetVehicleDataMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleDataMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleDataMarshaller.cpp new file mode 100644 index 000000000..338a3852c --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleDataMarshaller.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/VehicleInfo/GetVehicleData.h" +#include "../src/SDLRPCObjectsImpl/V2/VehicleDataTypeMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VehicleInfo/GetVehicleDataMarshaller.h" + +/* + interface NsRPC2Communication::VehicleInfo + 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::VehicleInfo; + +bool GetVehicleDataMarshaller::checkIntegrity(GetVehicleData& s) +{ + return checkIntegrityConst(s); +} + + +bool GetVehicleDataMarshaller::fromString(const std::string& s,GetVehicleData& 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 GetVehicleDataMarshaller::toString(const GetVehicleData& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool GetVehicleDataMarshaller::checkIntegrityConst(const GetVehicleData& s) +{ + if(!NsSmartDeviceLinkRPCV2::VehicleDataTypeMarshaller::checkIntegrityConst(s.dataType)) return false; + + return true; +} + + +Json::Value GetVehicleDataMarshaller::toJSON(const GetVehicleData& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("VehicleInfo.GetVehicleData"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["dataType"]=NsSmartDeviceLinkRPCV2::VehicleDataTypeMarshaller::toJSON(e.dataType);; + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool GetVehicleDataMarshaller::fromJSON(const Json::Value& json,GetVehicleData& 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("VehicleInfo.GetVehicleData")) 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("dataType") || !NsSmartDeviceLinkRPCV2::VehicleDataTypeMarshaller::fromJSON(js["dataType"],c.dataType)) 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/VehicleInfo/GetVehicleDataMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleDataMarshaller.h new file mode 100644 index 000000000..d5137291a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleDataMarshaller.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_VEHICLEINFO_GETVEHICLEDATAMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VEHICLEINFO_GETVEHICLEDATAMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VehicleInfo/GetVehicleData.h" + +namespace NsRPC2Communication +{ + namespace VehicleInfo + { + + struct GetVehicleDataMarshaller + { + static bool checkIntegrity(GetVehicleData& e); + static bool checkIntegrityConst(const GetVehicleData& e); + + static bool fromString(const std::string& s,GetVehicleData& e); + static const std::string toString(const GetVehicleData& e); + + static bool fromJSON(const Json::Value& s,GetVehicleData& e); + static Json::Value toJSON(const GetVehicleData& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleDataResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleDataResponse.cpp new file mode 100644 index 000000000..0f26b8428 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleDataResponse.cpp @@ -0,0 +1,447 @@ +// +// 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/VehicleInfo/GetVehicleDataResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VehicleInfo + 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::VehicleInfo; + + +GetVehicleDataResponse& GetVehicleDataResponse::operator =(const GetVehicleDataResponse& c) +{ + if(gps) delete gps; + gps= c.gps ? new NsSmartDeviceLinkRPCV2::GPSData(c.gps[0]) : 0; + if(speed) delete speed; + speed= c.speed ? new float(c.speed[0]) : 0; + if(rpm) delete rpm; + rpm= c.rpm ? new unsigned int(c.rpm[0]) : 0; + if(fuelLevel) delete fuelLevel; + fuelLevel= c.fuelLevel ? new float(c.fuelLevel[0]) : 0; + if(avgFuelEconomy) delete avgFuelEconomy; + avgFuelEconomy= c.avgFuelEconomy ? new float(c.avgFuelEconomy[0]) : 0; + if(batteryVoltage) delete batteryVoltage; + batteryVoltage= c.batteryVoltage ? new float(c.batteryVoltage[0]) : 0; + if(externalTemperature) delete externalTemperature; + externalTemperature= c.externalTemperature ? new float(c.externalTemperature[0]) : 0; + if(vin) delete vin; + vin= c.vin ? new std::string(c.vin[0]) : 0; + if(prndl) delete prndl; + prndl= c.prndl ? new NsSmartDeviceLinkRPCV2::PRNDL(c.prndl[0]) : 0; + if(tirePressure) delete tirePressure; + tirePressure= c.tirePressure ? new NsSmartDeviceLinkRPCV2::TireStatus(c.tirePressure[0]) : 0; + if(batteryPackVoltage) delete batteryPackVoltage; + batteryPackVoltage= c.batteryPackVoltage ? new float(c.batteryPackVoltage[0]) : 0; + if(batteryPackCurrent) delete batteryPackCurrent; + batteryPackCurrent= c.batteryPackCurrent ? new float(c.batteryPackCurrent[0]) : 0; + if(batteryPackTemperature) delete batteryPackTemperature; + batteryPackTemperature= c.batteryPackTemperature ? new int(c.batteryPackTemperature[0]) : 0; + if(engineTorque) delete engineTorque; + engineTorque= c.engineTorque ? new int(c.engineTorque[0]) : 0; + if(odometer) delete odometer; + odometer= c.odometer ? new unsigned int(c.odometer[0]) : 0; + if(tripOdometer) delete tripOdometer; + tripOdometer= c.tripOdometer ? new unsigned int(c.tripOdometer[0]) : 0; + if(satRadioESN) delete satRadioESN; + satRadioESN= c.satRadioESN ? new std::string(c.satRadioESN[0]) : 0; + return *this; +} + + +GetVehicleDataResponse::~GetVehicleDataResponse(void) +{ + if(gps) delete gps; + if(speed) delete speed; + if(rpm) delete rpm; + if(fuelLevel) delete fuelLevel; + if(avgFuelEconomy) delete avgFuelEconomy; + if(batteryVoltage) delete batteryVoltage; + if(externalTemperature) delete externalTemperature; + if(vin) delete vin; + if(prndl) delete prndl; + if(tirePressure) delete tirePressure; + if(batteryPackVoltage) delete batteryPackVoltage; + if(batteryPackCurrent) delete batteryPackCurrent; + if(batteryPackTemperature) delete batteryPackTemperature; + if(engineTorque) delete engineTorque; + if(odometer) delete odometer; + if(tripOdometer) delete tripOdometer; + if(satRadioESN) delete satRadioESN; +} + + +GetVehicleDataResponse::GetVehicleDataResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VEHICLEINFO__GETVEHICLEDATARESPONSE), + gps(0), + speed(0), + rpm(0), + fuelLevel(0), + avgFuelEconomy(0), + batteryVoltage(0), + externalTemperature(0), + vin(0), + prndl(0), + tirePressure(0), + batteryPackVoltage(0), + batteryPackCurrent(0), + batteryPackTemperature(0), + engineTorque(0), + odometer(0), + tripOdometer(0), + satRadioESN(0) +{ +} + + +GetVehicleDataResponse::GetVehicleDataResponse(const GetVehicleDataResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VEHICLEINFO__GETVEHICLEDATARESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::GPSData* GetVehicleDataResponse::get_gps(void) +{ + return gps; +} + +bool GetVehicleDataResponse::set_gps(const NsSmartDeviceLinkRPCV2::GPSData& gps_) +{ + if(gps) delete gps; + gps=new NsSmartDeviceLinkRPCV2::GPSData(gps_); + return true; +} + +void GetVehicleDataResponse::reset_gps(void) +{ + if(gps) delete gps; + gps=0; +} + +const float* GetVehicleDataResponse::get_speed(void) +{ + return speed; +} + +bool GetVehicleDataResponse::set_speed(const float& speed_) +{ + if(speed) delete speed; + speed=new float(speed_); + return true; +} + +void GetVehicleDataResponse::reset_speed(void) +{ + if(speed) delete speed; + speed=0; +} + +const unsigned int* GetVehicleDataResponse::get_rpm(void) +{ + return rpm; +} + +bool GetVehicleDataResponse::set_rpm(const unsigned int& rpm_) +{ + if(rpm) delete rpm; + rpm=new unsigned int(rpm_); + return true; +} + +void GetVehicleDataResponse::reset_rpm(void) +{ + if(rpm) delete rpm; + rpm=0; +} + +const float* GetVehicleDataResponse::get_fuelLevel(void) +{ + return fuelLevel; +} + +bool GetVehicleDataResponse::set_fuelLevel(const float& fuelLevel_) +{ + if(fuelLevel) delete fuelLevel; + fuelLevel=new float(fuelLevel_); + return true; +} + +void GetVehicleDataResponse::reset_fuelLevel(void) +{ + if(fuelLevel) delete fuelLevel; + fuelLevel=0; +} + +const float* GetVehicleDataResponse::get_avgFuelEconomy(void) +{ + return avgFuelEconomy; +} + +bool GetVehicleDataResponse::set_avgFuelEconomy(const float& avgFuelEconomy_) +{ + if(avgFuelEconomy) delete avgFuelEconomy; + avgFuelEconomy=new float(avgFuelEconomy_); + return true; +} + +void GetVehicleDataResponse::reset_avgFuelEconomy(void) +{ + if(avgFuelEconomy) delete avgFuelEconomy; + avgFuelEconomy=0; +} + +const float* GetVehicleDataResponse::get_batteryVoltage(void) +{ + return batteryVoltage; +} + +bool GetVehicleDataResponse::set_batteryVoltage(const float& batteryVoltage_) +{ + if(batteryVoltage) delete batteryVoltage; + batteryVoltage=new float(batteryVoltage_); + return true; +} + +void GetVehicleDataResponse::reset_batteryVoltage(void) +{ + if(batteryVoltage) delete batteryVoltage; + batteryVoltage=0; +} + +const float* GetVehicleDataResponse::get_externalTemperature(void) +{ + return externalTemperature; +} + +bool GetVehicleDataResponse::set_externalTemperature(const float& externalTemperature_) +{ + if(externalTemperature) delete externalTemperature; + externalTemperature=new float(externalTemperature_); + return true; +} + +void GetVehicleDataResponse::reset_externalTemperature(void) +{ + if(externalTemperature) delete externalTemperature; + externalTemperature=0; +} + +const std::string* GetVehicleDataResponse::get_vin(void) +{ + return vin; +} + +bool GetVehicleDataResponse::set_vin(const std::string& vin_) +{ + if(vin) delete vin; + vin=new std::string(vin_); + return true; +} + +void GetVehicleDataResponse::reset_vin(void) +{ + if(vin) delete vin; + vin=0; +} + +const NsSmartDeviceLinkRPCV2::PRNDL* GetVehicleDataResponse::get_prndl(void) +{ + return prndl; +} + +bool GetVehicleDataResponse::set_prndl(const NsSmartDeviceLinkRPCV2::PRNDL& prndl_) +{ + if(prndl) delete prndl; + prndl=new NsSmartDeviceLinkRPCV2::PRNDL(prndl_); + return true; +} + +void GetVehicleDataResponse::reset_prndl(void) +{ + if(prndl) delete prndl; + prndl=0; +} + +const NsSmartDeviceLinkRPCV2::TireStatus* GetVehicleDataResponse::get_tirePressure(void) +{ + return tirePressure; +} + +bool GetVehicleDataResponse::set_tirePressure(const NsSmartDeviceLinkRPCV2::TireStatus& tirePressure_) +{ + if(tirePressure) delete tirePressure; + tirePressure=new NsSmartDeviceLinkRPCV2::TireStatus(tirePressure_); + return true; +} + +void GetVehicleDataResponse::reset_tirePressure(void) +{ + if(tirePressure) delete tirePressure; + tirePressure=0; +} + +const float* GetVehicleDataResponse::get_batteryPackVoltage(void) +{ + return batteryPackVoltage; +} + +bool GetVehicleDataResponse::set_batteryPackVoltage(const float& batteryPackVoltage_) +{ + if(batteryPackVoltage) delete batteryPackVoltage; + batteryPackVoltage=new float(batteryPackVoltage_); + return true; +} + +void GetVehicleDataResponse::reset_batteryPackVoltage(void) +{ + if(batteryPackVoltage) delete batteryPackVoltage; + batteryPackVoltage=0; +} + +const float* GetVehicleDataResponse::get_batteryPackCurrent(void) +{ + return batteryPackCurrent; +} + +bool GetVehicleDataResponse::set_batteryPackCurrent(const float& batteryPackCurrent_) +{ + if(batteryPackCurrent) delete batteryPackCurrent; + batteryPackCurrent=new float(batteryPackCurrent_); + return true; +} + +void GetVehicleDataResponse::reset_batteryPackCurrent(void) +{ + if(batteryPackCurrent) delete batteryPackCurrent; + batteryPackCurrent=0; +} + +const int* GetVehicleDataResponse::get_batteryPackTemperature(void) +{ + return batteryPackTemperature; +} + +bool GetVehicleDataResponse::set_batteryPackTemperature(const int& batteryPackTemperature_) +{ + if(batteryPackTemperature) delete batteryPackTemperature; + batteryPackTemperature=new int(batteryPackTemperature_); + return true; +} + +void GetVehicleDataResponse::reset_batteryPackTemperature(void) +{ + if(batteryPackTemperature) delete batteryPackTemperature; + batteryPackTemperature=0; +} + +const int* GetVehicleDataResponse::get_engineTorque(void) +{ + return engineTorque; +} + +bool GetVehicleDataResponse::set_engineTorque(const int& engineTorque_) +{ + if(engineTorque) delete engineTorque; + engineTorque=new int(engineTorque_); + return true; +} + +void GetVehicleDataResponse::reset_engineTorque(void) +{ + if(engineTorque) delete engineTorque; + engineTorque=0; +} + +const unsigned int* GetVehicleDataResponse::get_odometer(void) +{ + return odometer; +} + +bool GetVehicleDataResponse::set_odometer(const unsigned int& odometer_) +{ + if(odometer) delete odometer; + odometer=new unsigned int(odometer_); + return true; +} + +void GetVehicleDataResponse::reset_odometer(void) +{ + if(odometer) delete odometer; + odometer=0; +} + +const unsigned int* GetVehicleDataResponse::get_tripOdometer(void) +{ + return tripOdometer; +} + +bool GetVehicleDataResponse::set_tripOdometer(const unsigned int& tripOdometer_) +{ + if(tripOdometer) delete tripOdometer; + tripOdometer=new unsigned int(tripOdometer_); + return true; +} + +void GetVehicleDataResponse::reset_tripOdometer(void) +{ + if(tripOdometer) delete tripOdometer; + tripOdometer=0; +} + +const std::string* GetVehicleDataResponse::get_satRadioESN(void) +{ + return satRadioESN; +} + +bool GetVehicleDataResponse::set_satRadioESN(const std::string& satRadioESN_) +{ + if(satRadioESN) delete satRadioESN; + satRadioESN=new std::string(satRadioESN_); + return true; +} + +void GetVehicleDataResponse::reset_satRadioESN(void) +{ + if(satRadioESN) delete satRadioESN; + satRadioESN=0; +} + +bool GetVehicleDataResponse::checkIntegrity(void) +{ + return GetVehicleDataResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleDataResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleDataResponseMarshaller.cpp new file mode 100644 index 000000000..b6179c15f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleDataResponseMarshaller.cpp @@ -0,0 +1,376 @@ +// +// 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/VehicleInfo/GetVehicleDataResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/GPSDataMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/PRNDLMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/TireStatusMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VehicleInfo/GetVehicleDataResponseMarshaller.h" + +/* + interface NsRPC2Communication::VehicleInfo + 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::VehicleInfo; + +bool GetVehicleDataResponseMarshaller::checkIntegrity(GetVehicleDataResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool GetVehicleDataResponseMarshaller::fromString(const std::string& s,GetVehicleDataResponse& 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 GetVehicleDataResponseMarshaller::toString(const GetVehicleDataResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool GetVehicleDataResponseMarshaller::checkIntegrityConst(const GetVehicleDataResponse& s) +{ + if(s.gps && (!NsSmartDeviceLinkRPCV2::GPSDataMarshaller::checkIntegrityConst(s.gps[0]))) return false; + + if(s.speed && (s.speed[0]<-100 || s.speed[0]>500)) return false; + + if(s.rpm && (s.rpm[0]>20000)) return false; + + if(s.fuelLevel && (s.fuelLevel[0]<0 || s.fuelLevel[0]>100)) return false; + + if(s.avgFuelEconomy && (s.avgFuelEconomy[0]<0 || s.avgFuelEconomy[0]>7000)) return false; + + if(s.batteryVoltage && (s.batteryVoltage[0]<0 || s.batteryVoltage[0]>26)) return false; + + if(s.externalTemperature && (s.externalTemperature[0]<-40 || s.externalTemperature[0]>100)) return false; + + if(s.vin && (s.vin[0].length()>17)) return false; + + if(s.prndl && (!NsSmartDeviceLinkRPCV2::PRNDLMarshaller::checkIntegrityConst(s.prndl[0]))) return false; + + if(s.tirePressure && (!NsSmartDeviceLinkRPCV2::TireStatusMarshaller::checkIntegrityConst(s.tirePressure[0]))) return false; + + if(s.batteryPackVoltage && (s.batteryPackVoltage[0]<-1000 || s.batteryPackVoltage[0]>1000)) return false; + + if(s.batteryPackCurrent && (s.batteryPackCurrent[0]<-1000 || s.batteryPackCurrent[0]>1000)) return false; + + if(s.batteryPackTemperature && (s.batteryPackTemperature[0]<-50 || s.batteryPackTemperature[0]>250)) return false; + + if(s.engineTorque && (s.engineTorque[0]<-10000 || s.engineTorque[0]>55000)) return false; + + if(s.odometer && (s.odometer[0]>2000000)) return false; + + if(s.tripOdometer && (s.tripOdometer[0]>2000000)) return false; + + if(s.satRadioESN && (s.satRadioESN[0].length()>500)) return false; + + return true; +} + + +Json::Value GetVehicleDataResponseMarshaller::toJSON(const GetVehicleDataResponse& 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("VehicleInfo.GetVehicleDataResponse"); + + if(e.gps) + json["result"]["gps"]=NsSmartDeviceLinkRPCV2::GPSDataMarshaller::toJSON(e.gps[0]);; + if(e.speed) + json["result"]["speed"]=Json::Value(e.speed[0]);; + if(e.rpm) + json["result"]["rpm"]=Json::Value(e.rpm[0]);; + if(e.fuelLevel) + json["result"]["fuelLevel"]=Json::Value(e.fuelLevel[0]);; + if(e.avgFuelEconomy) + json["result"]["avgFuelEconomy"]=Json::Value(e.avgFuelEconomy[0]);; + if(e.batteryVoltage) + json["result"]["batteryVoltage"]=Json::Value(e.batteryVoltage[0]);; + if(e.externalTemperature) + json["result"]["externalTemperature"]=Json::Value(e.externalTemperature[0]);; + if(e.vin) + json["result"]["vin"]=Json::Value(e.vin[0]);; + if(e.prndl) + json["result"]["prndl"]=NsSmartDeviceLinkRPCV2::PRNDLMarshaller::toJSON(e.prndl[0]);; + if(e.tirePressure) + json["result"]["tirePressure"]=NsSmartDeviceLinkRPCV2::TireStatusMarshaller::toJSON(e.tirePressure[0]);; + if(e.batteryPackVoltage) + json["result"]["batteryPackVoltage"]=Json::Value(e.batteryPackVoltage[0]);; + if(e.batteryPackCurrent) + json["result"]["batteryPackCurrent"]=Json::Value(e.batteryPackCurrent[0]);; + if(e.batteryPackTemperature) + json["result"]["batteryPackTemperature"]=Json::Value(e.batteryPackTemperature[0]);; + if(e.engineTorque) + json["result"]["engineTorque"]=Json::Value(e.engineTorque[0]);; + if(e.odometer) + json["result"]["odometer"]=Json::Value(e.odometer[0]);; + if(e.tripOdometer) + json["result"]["tripOdometer"]=Json::Value(e.tripOdometer[0]);; + if(e.satRadioESN) + json["result"]["satRadioESN"]=Json::Value(e.satRadioESN[0]);; + return json; +} + + +bool GetVehicleDataResponseMarshaller::fromJSON(const Json::Value& json,GetVehicleDataResponse& 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("VehicleInfo.GetVehicleDataResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + if(c.gps) delete c.gps; + c.gps=0; + if(js.isMember("gps")) + { + c.gps=new NsSmartDeviceLinkRPCV2::GPSData(); + if(!NsSmartDeviceLinkRPCV2::GPSDataMarshaller::fromJSON(js["gps"],c.gps[0])) return false; + } + + if(c.speed) delete c.speed; + c.speed=0; + if(js.isMember("speed")) + { + if(!js["speed"].isNumeric()) return false; + c.speed=new float(); + c.speed[0]=js["speed"].asDouble(); + if(c.speed[0]<-100 || c.speed[0]>500) return false; + + } + + if(c.rpm) delete c.rpm; + c.rpm=0; + if(js.isMember("rpm")) + { + if(!js["rpm"].isInt()) return false; + c.rpm=new unsigned int(); + c.rpm[0]=js["rpm"].asInt(); + if(c.rpm[0]>20000) return false; + + } + + if(c.fuelLevel) delete c.fuelLevel; + c.fuelLevel=0; + if(js.isMember("fuelLevel")) + { + if(!js["fuelLevel"].isNumeric()) return false; + c.fuelLevel=new float(); + c.fuelLevel[0]=js["fuelLevel"].asDouble(); + if(c.fuelLevel[0]<0 || c.fuelLevel[0]>100) return false; + + } + + if(c.avgFuelEconomy) delete c.avgFuelEconomy; + c.avgFuelEconomy=0; + if(js.isMember("avgFuelEconomy")) + { + if(!js["avgFuelEconomy"].isNumeric()) return false; + c.avgFuelEconomy=new float(); + c.avgFuelEconomy[0]=js["avgFuelEconomy"].asDouble(); + if(c.avgFuelEconomy[0]<0 || c.avgFuelEconomy[0]>7000) return false; + + } + + if(c.batteryVoltage) delete c.batteryVoltage; + c.batteryVoltage=0; + if(js.isMember("batteryVoltage")) + { + if(!js["batteryVoltage"].isNumeric()) return false; + c.batteryVoltage=new float(); + c.batteryVoltage[0]=js["batteryVoltage"].asDouble(); + if(c.batteryVoltage[0]<0 || c.batteryVoltage[0]>26) return false; + + } + + if(c.externalTemperature) delete c.externalTemperature; + c.externalTemperature=0; + if(js.isMember("externalTemperature")) + { + if(!js["externalTemperature"].isNumeric()) return false; + c.externalTemperature=new float(); + c.externalTemperature[0]=js["externalTemperature"].asDouble(); + if(c.externalTemperature[0]<-40 || c.externalTemperature[0]>100) return false; + + } + + if(c.vin) delete c.vin; + c.vin=0; + if(js.isMember("vin")) + { + if(!js["vin"].isString()) return false; + c.vin=new std::string(); + c.vin[0]=js["vin"].asString(); + if(c.vin[0].length()>17) return false; + + } + + if(c.prndl) delete c.prndl; + c.prndl=0; + if(js.isMember("prndl")) + { + c.prndl=new NsSmartDeviceLinkRPCV2::PRNDL(); + if(!NsSmartDeviceLinkRPCV2::PRNDLMarshaller::fromJSON(js["prndl"],c.prndl[0])) return false; + } + + if(c.tirePressure) delete c.tirePressure; + c.tirePressure=0; + if(js.isMember("tirePressure")) + { + c.tirePressure=new NsSmartDeviceLinkRPCV2::TireStatus(); + if(!NsSmartDeviceLinkRPCV2::TireStatusMarshaller::fromJSON(js["tirePressure"],c.tirePressure[0])) return false; + } + + if(c.batteryPackVoltage) delete c.batteryPackVoltage; + c.batteryPackVoltage=0; + if(js.isMember("batteryPackVoltage")) + { + if(!js["batteryPackVoltage"].isNumeric()) return false; + c.batteryPackVoltage=new float(); + c.batteryPackVoltage[0]=js["batteryPackVoltage"].asDouble(); + if(c.batteryPackVoltage[0]<-1000 || c.batteryPackVoltage[0]>1000) return false; + + } + + if(c.batteryPackCurrent) delete c.batteryPackCurrent; + c.batteryPackCurrent=0; + if(js.isMember("batteryPackCurrent")) + { + if(!js["batteryPackCurrent"].isNumeric()) return false; + c.batteryPackCurrent=new float(); + c.batteryPackCurrent[0]=js["batteryPackCurrent"].asDouble(); + if(c.batteryPackCurrent[0]<-1000 || c.batteryPackCurrent[0]>1000) return false; + + } + + if(c.batteryPackTemperature) delete c.batteryPackTemperature; + c.batteryPackTemperature=0; + if(js.isMember("batteryPackTemperature")) + { + if(!js["batteryPackTemperature"].isInt()) return false; + c.batteryPackTemperature=new int(); + c.batteryPackTemperature[0]=js["batteryPackTemperature"].asInt(); + if(c.batteryPackTemperature[0]<-50 || c.batteryPackTemperature[0]>250) return false; + + } + + if(c.engineTorque) delete c.engineTorque; + c.engineTorque=0; + if(js.isMember("engineTorque")) + { + if(!js["engineTorque"].isInt()) return false; + c.engineTorque=new int(); + c.engineTorque[0]=js["engineTorque"].asInt(); + if(c.engineTorque[0]<-10000 || c.engineTorque[0]>55000) return false; + + } + + if(c.odometer) delete c.odometer; + c.odometer=0; + if(js.isMember("odometer")) + { + if(!js["odometer"].isInt()) return false; + c.odometer=new unsigned int(); + c.odometer[0]=js["odometer"].asInt(); + if(c.odometer[0]>2000000) return false; + + } + + if(c.tripOdometer) delete c.tripOdometer; + c.tripOdometer=0; + if(js.isMember("tripOdometer")) + { + if(!js["tripOdometer"].isInt()) return false; + c.tripOdometer=new unsigned int(); + c.tripOdometer[0]=js["tripOdometer"].asInt(); + if(c.tripOdometer[0]>2000000) return false; + + } + + if(c.satRadioESN) delete c.satRadioESN; + c.satRadioESN=0; + if(js.isMember("satRadioESN")) + { + if(!js["satRadioESN"].isString()) return false; + c.satRadioESN=new std::string(); + c.satRadioESN[0]=js["satRadioESN"].asString(); + if(c.satRadioESN[0].length()>500) return false; + + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleDataResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleDataResponseMarshaller.h new file mode 100644 index 000000000..becf1489a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleDataResponseMarshaller.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_VEHICLEINFO_GETVEHICLEDATARESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VEHICLEINFO_GETVEHICLEDATARESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VehicleInfo/GetVehicleDataResponse.h" + +namespace NsRPC2Communication +{ + namespace VehicleInfo + { + + struct GetVehicleDataResponseMarshaller + { + static bool checkIntegrity(GetVehicleDataResponse& e); + static bool checkIntegrityConst(const GetVehicleDataResponse& e); + + static bool fromString(const std::string& s,GetVehicleDataResponse& e); + static const std::string toString(const GetVehicleDataResponse& e); + + static bool fromJSON(const Json::Value& s,GetVehicleDataResponse& e); + static Json::Value toJSON(const GetVehicleDataResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleType.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleType.cpp new file mode 100644 index 000000000..0530d3d7e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleType.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/VehicleInfo/GetVehicleType.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VehicleInfo + 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::VehicleInfo; + + +GetVehicleType& GetVehicleType::operator =(const GetVehicleType& c) +{ + return *this; +} + + +GetVehicleType::~GetVehicleType(void) +{ +} + + +GetVehicleType::GetVehicleType(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VEHICLEINFO__GETVEHICLETYPE) +{ +} + + +GetVehicleType::GetVehicleType(const GetVehicleType& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VEHICLEINFO__GETVEHICLETYPE,c.getId()) +{ + *this=c; +} + + +bool GetVehicleType::checkIntegrity(void) +{ + return GetVehicleTypeMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleTypeMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleTypeMarshaller.cpp new file mode 100644 index 000000000..86ed85b95 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleTypeMarshaller.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/VehicleInfo/GetVehicleType.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VehicleInfo/GetVehicleTypeMarshaller.h" + +/* + interface NsRPC2Communication::VehicleInfo + 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::VehicleInfo; + +bool GetVehicleTypeMarshaller::checkIntegrity(GetVehicleType& s) +{ + return checkIntegrityConst(s); +} + + +bool GetVehicleTypeMarshaller::fromString(const std::string& s,GetVehicleType& 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 GetVehicleTypeMarshaller::toString(const GetVehicleType& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool GetVehicleTypeMarshaller::checkIntegrityConst(const GetVehicleType& s) +{ + return true; +} + + +Json::Value GetVehicleTypeMarshaller::toJSON(const GetVehicleType& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("VehicleInfo.GetVehicleType"); + + json["id"]=Json::Value(e.getId()); + return json; +} + + +bool GetVehicleTypeMarshaller::fromJSON(const Json::Value& json,GetVehicleType& 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("VehicleInfo.GetVehicleType")) 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/VehicleInfo/GetVehicleTypeMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleTypeMarshaller.h new file mode 100644 index 000000000..f70919c4b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleTypeMarshaller.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_VEHICLEINFO_GETVEHICLETYPEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VEHICLEINFO_GETVEHICLETYPEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VehicleInfo/GetVehicleType.h" + +namespace NsRPC2Communication +{ + namespace VehicleInfo + { + + struct GetVehicleTypeMarshaller + { + static bool checkIntegrity(GetVehicleType& e); + static bool checkIntegrityConst(const GetVehicleType& e); + + static bool fromString(const std::string& s,GetVehicleType& e); + static const std::string toString(const GetVehicleType& e); + + static bool fromJSON(const Json::Value& s,GetVehicleType& e); + static Json::Value toJSON(const GetVehicleType& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleTypeResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleTypeResponse.cpp new file mode 100644 index 000000000..edd196ab1 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleTypeResponse.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/VehicleInfo/GetVehicleTypeResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VehicleInfo + 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::VehicleInfo; + + +GetVehicleTypeResponse& GetVehicleTypeResponse::operator =(const GetVehicleTypeResponse& c) +{ + vehicleType=c.vehicleType; + return *this; +} + + +GetVehicleTypeResponse::~GetVehicleTypeResponse(void) +{ +} + + +GetVehicleTypeResponse::GetVehicleTypeResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VEHICLEINFO__GETVEHICLETYPERESPONSE) +{ +} + + +GetVehicleTypeResponse::GetVehicleTypeResponse(const GetVehicleTypeResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VEHICLEINFO__GETVEHICLETYPERESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::VehicleType& GetVehicleTypeResponse::get_vehicleType(void) +{ + return vehicleType; +} + +bool GetVehicleTypeResponse::set_vehicleType(const NsSmartDeviceLinkRPCV2::VehicleType& vehicleType_) +{ + vehicleType=vehicleType_; + return true; +} + +bool GetVehicleTypeResponse::checkIntegrity(void) +{ + return GetVehicleTypeResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleTypeResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleTypeResponseMarshaller.cpp new file mode 100644 index 000000000..aca11b6b4 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleTypeResponseMarshaller.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/VehicleInfo/GetVehicleTypeResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/VehicleTypeMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VehicleInfo/GetVehicleTypeResponseMarshaller.h" + +/* + interface NsRPC2Communication::VehicleInfo + 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::VehicleInfo; + +bool GetVehicleTypeResponseMarshaller::checkIntegrity(GetVehicleTypeResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool GetVehicleTypeResponseMarshaller::fromString(const std::string& s,GetVehicleTypeResponse& 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 GetVehicleTypeResponseMarshaller::toString(const GetVehicleTypeResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool GetVehicleTypeResponseMarshaller::checkIntegrityConst(const GetVehicleTypeResponse& s) +{ + if(!NsSmartDeviceLinkRPCV2::VehicleTypeMarshaller::checkIntegrityConst(s.vehicleType)) return false; + + return true; +} + + +Json::Value GetVehicleTypeResponseMarshaller::toJSON(const GetVehicleTypeResponse& 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("VehicleInfo.GetVehicleTypeResponse"); + + json["result"]["vehicleType"]=NsSmartDeviceLinkRPCV2::VehicleTypeMarshaller::toJSON(e.vehicleType);; + return json; +} + + +bool GetVehicleTypeResponseMarshaller::fromJSON(const Json::Value& json,GetVehicleTypeResponse& 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("VehicleInfo.GetVehicleTypeResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + if(!js.isMember("vehicleType") || !NsSmartDeviceLinkRPCV2::VehicleTypeMarshaller::fromJSON(js["vehicleType"],c.vehicleType)) return false; + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleTypeResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleTypeResponseMarshaller.h new file mode 100644 index 000000000..5bf7d997e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/GetVehicleTypeResponseMarshaller.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_VEHICLEINFO_GETVEHICLETYPERESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VEHICLEINFO_GETVEHICLETYPERESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VehicleInfo/GetVehicleTypeResponse.h" + +namespace NsRPC2Communication +{ + namespace VehicleInfo + { + + struct GetVehicleTypeResponseMarshaller + { + static bool checkIntegrity(GetVehicleTypeResponse& e); + static bool checkIntegrityConst(const GetVehicleTypeResponse& e); + + static bool fromString(const std::string& s,GetVehicleTypeResponse& e); + static const std::string toString(const GetVehicleTypeResponse& e); + + static bool fromJSON(const Json::Value& s,GetVehicleTypeResponse& e); + static Json::Value toJSON(const GetVehicleTypeResponse& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/OnVehicleData.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/OnVehicleData.cpp new file mode 100644 index 000000000..966f64c20 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/OnVehicleData.cpp @@ -0,0 +1,447 @@ +// +// 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/VehicleInfo/OnVehicleData.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VehicleInfo + 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::VehicleInfo; + + +OnVehicleData& OnVehicleData::operator =(const OnVehicleData& c) +{ + if(gps) delete gps; + gps= c.gps ? new NsSmartDeviceLinkRPCV2::GPSData(c.gps[0]) : 0; + if(speed) delete speed; + speed= c.speed ? new float(c.speed[0]) : 0; + if(rpm) delete rpm; + rpm= c.rpm ? new unsigned int(c.rpm[0]) : 0; + if(fuelLevel) delete fuelLevel; + fuelLevel= c.fuelLevel ? new float(c.fuelLevel[0]) : 0; + if(avgFuelEconomy) delete avgFuelEconomy; + avgFuelEconomy= c.avgFuelEconomy ? new float(c.avgFuelEconomy[0]) : 0; + if(batteryVoltage) delete batteryVoltage; + batteryVoltage= c.batteryVoltage ? new float(c.batteryVoltage[0]) : 0; + if(externalTemperature) delete externalTemperature; + externalTemperature= c.externalTemperature ? new float(c.externalTemperature[0]) : 0; + if(vin) delete vin; + vin= c.vin ? new std::string(c.vin[0]) : 0; + if(prndl) delete prndl; + prndl= c.prndl ? new NsSmartDeviceLinkRPCV2::PRNDL(c.prndl[0]) : 0; + if(tirePressure) delete tirePressure; + tirePressure= c.tirePressure ? new NsSmartDeviceLinkRPCV2::TireStatus(c.tirePressure[0]) : 0; + if(batteryPackVoltage) delete batteryPackVoltage; + batteryPackVoltage= c.batteryPackVoltage ? new float(c.batteryPackVoltage[0]) : 0; + if(batteryPackCurrent) delete batteryPackCurrent; + batteryPackCurrent= c.batteryPackCurrent ? new float(c.batteryPackCurrent[0]) : 0; + if(batteryPackTemperature) delete batteryPackTemperature; + batteryPackTemperature= c.batteryPackTemperature ? new int(c.batteryPackTemperature[0]) : 0; + if(engineTorque) delete engineTorque; + engineTorque= c.engineTorque ? new int(c.engineTorque[0]) : 0; + if(odometer) delete odometer; + odometer= c.odometer ? new unsigned int(c.odometer[0]) : 0; + if(tripOdometer) delete tripOdometer; + tripOdometer= c.tripOdometer ? new unsigned int(c.tripOdometer[0]) : 0; + if(genericbinary) delete genericbinary; + genericbinary= c.genericbinary ? new std::string(c.genericbinary[0]) : 0; + return *this; +} + + +OnVehicleData::~OnVehicleData(void) +{ + if(gps) delete gps; + if(speed) delete speed; + if(rpm) delete rpm; + if(fuelLevel) delete fuelLevel; + if(avgFuelEconomy) delete avgFuelEconomy; + if(batteryVoltage) delete batteryVoltage; + if(externalTemperature) delete externalTemperature; + if(vin) delete vin; + if(prndl) delete prndl; + if(tirePressure) delete tirePressure; + if(batteryPackVoltage) delete batteryPackVoltage; + if(batteryPackCurrent) delete batteryPackCurrent; + if(batteryPackTemperature) delete batteryPackTemperature; + if(engineTorque) delete engineTorque; + if(odometer) delete odometer; + if(tripOdometer) delete tripOdometer; + if(genericbinary) delete genericbinary; +} + + +OnVehicleData::OnVehicleData(void) : + RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_VEHICLEINFO__ONVEHICLEDATA), + gps(0), + speed(0), + rpm(0), + fuelLevel(0), + avgFuelEconomy(0), + batteryVoltage(0), + externalTemperature(0), + vin(0), + prndl(0), + tirePressure(0), + batteryPackVoltage(0), + batteryPackCurrent(0), + batteryPackTemperature(0), + engineTorque(0), + odometer(0), + tripOdometer(0), + genericbinary(0) +{ +} + + +OnVehicleData::OnVehicleData(const OnVehicleData& c) : RPC2Notification(Marshaller::METHOD_NSRPC2COMMUNICATION_VEHICLEINFO__ONVEHICLEDATA) +{ + *this=c; +} + + +const NsSmartDeviceLinkRPCV2::GPSData* OnVehicleData::get_gps(void) +{ + return gps; +} + +bool OnVehicleData::set_gps(const NsSmartDeviceLinkRPCV2::GPSData& gps_) +{ + if(gps) delete gps; + gps=new NsSmartDeviceLinkRPCV2::GPSData(gps_); + return true; +} + +void OnVehicleData::reset_gps(void) +{ + if(gps) delete gps; + gps=0; +} + +const float* OnVehicleData::get_speed(void) +{ + return speed; +} + +bool OnVehicleData::set_speed(const float& speed_) +{ + if(speed) delete speed; + speed=new float(speed_); + return true; +} + +void OnVehicleData::reset_speed(void) +{ + if(speed) delete speed; + speed=0; +} + +const unsigned int* OnVehicleData::get_rpm(void) +{ + return rpm; +} + +bool OnVehicleData::set_rpm(const unsigned int& rpm_) +{ + if(rpm) delete rpm; + rpm=new unsigned int(rpm_); + return true; +} + +void OnVehicleData::reset_rpm(void) +{ + if(rpm) delete rpm; + rpm=0; +} + +const float* OnVehicleData::get_fuelLevel(void) +{ + return fuelLevel; +} + +bool OnVehicleData::set_fuelLevel(const float& fuelLevel_) +{ + if(fuelLevel) delete fuelLevel; + fuelLevel=new float(fuelLevel_); + return true; +} + +void OnVehicleData::reset_fuelLevel(void) +{ + if(fuelLevel) delete fuelLevel; + fuelLevel=0; +} + +const float* OnVehicleData::get_avgFuelEconomy(void) +{ + return avgFuelEconomy; +} + +bool OnVehicleData::set_avgFuelEconomy(const float& avgFuelEconomy_) +{ + if(avgFuelEconomy) delete avgFuelEconomy; + avgFuelEconomy=new float(avgFuelEconomy_); + return true; +} + +void OnVehicleData::reset_avgFuelEconomy(void) +{ + if(avgFuelEconomy) delete avgFuelEconomy; + avgFuelEconomy=0; +} + +const float* OnVehicleData::get_batteryVoltage(void) +{ + return batteryVoltage; +} + +bool OnVehicleData::set_batteryVoltage(const float& batteryVoltage_) +{ + if(batteryVoltage) delete batteryVoltage; + batteryVoltage=new float(batteryVoltage_); + return true; +} + +void OnVehicleData::reset_batteryVoltage(void) +{ + if(batteryVoltage) delete batteryVoltage; + batteryVoltage=0; +} + +const float* OnVehicleData::get_externalTemperature(void) +{ + return externalTemperature; +} + +bool OnVehicleData::set_externalTemperature(const float& externalTemperature_) +{ + if(externalTemperature) delete externalTemperature; + externalTemperature=new float(externalTemperature_); + return true; +} + +void OnVehicleData::reset_externalTemperature(void) +{ + if(externalTemperature) delete externalTemperature; + externalTemperature=0; +} + +const std::string* OnVehicleData::get_vin(void) +{ + return vin; +} + +bool OnVehicleData::set_vin(const std::string& vin_) +{ + if(vin) delete vin; + vin=new std::string(vin_); + return true; +} + +void OnVehicleData::reset_vin(void) +{ + if(vin) delete vin; + vin=0; +} + +const NsSmartDeviceLinkRPCV2::PRNDL* OnVehicleData::get_prndl(void) +{ + return prndl; +} + +bool OnVehicleData::set_prndl(const NsSmartDeviceLinkRPCV2::PRNDL& prndl_) +{ + if(prndl) delete prndl; + prndl=new NsSmartDeviceLinkRPCV2::PRNDL(prndl_); + return true; +} + +void OnVehicleData::reset_prndl(void) +{ + if(prndl) delete prndl; + prndl=0; +} + +const NsSmartDeviceLinkRPCV2::TireStatus* OnVehicleData::get_tirePressure(void) +{ + return tirePressure; +} + +bool OnVehicleData::set_tirePressure(const NsSmartDeviceLinkRPCV2::TireStatus& tirePressure_) +{ + if(tirePressure) delete tirePressure; + tirePressure=new NsSmartDeviceLinkRPCV2::TireStatus(tirePressure_); + return true; +} + +void OnVehicleData::reset_tirePressure(void) +{ + if(tirePressure) delete tirePressure; + tirePressure=0; +} + +const float* OnVehicleData::get_batteryPackVoltage(void) +{ + return batteryPackVoltage; +} + +bool OnVehicleData::set_batteryPackVoltage(const float& batteryPackVoltage_) +{ + if(batteryPackVoltage) delete batteryPackVoltage; + batteryPackVoltage=new float(batteryPackVoltage_); + return true; +} + +void OnVehicleData::reset_batteryPackVoltage(void) +{ + if(batteryPackVoltage) delete batteryPackVoltage; + batteryPackVoltage=0; +} + +const float* OnVehicleData::get_batteryPackCurrent(void) +{ + return batteryPackCurrent; +} + +bool OnVehicleData::set_batteryPackCurrent(const float& batteryPackCurrent_) +{ + if(batteryPackCurrent) delete batteryPackCurrent; + batteryPackCurrent=new float(batteryPackCurrent_); + return true; +} + +void OnVehicleData::reset_batteryPackCurrent(void) +{ + if(batteryPackCurrent) delete batteryPackCurrent; + batteryPackCurrent=0; +} + +const int* OnVehicleData::get_batteryPackTemperature(void) +{ + return batteryPackTemperature; +} + +bool OnVehicleData::set_batteryPackTemperature(const int& batteryPackTemperature_) +{ + if(batteryPackTemperature) delete batteryPackTemperature; + batteryPackTemperature=new int(batteryPackTemperature_); + return true; +} + +void OnVehicleData::reset_batteryPackTemperature(void) +{ + if(batteryPackTemperature) delete batteryPackTemperature; + batteryPackTemperature=0; +} + +const int* OnVehicleData::get_engineTorque(void) +{ + return engineTorque; +} + +bool OnVehicleData::set_engineTorque(const int& engineTorque_) +{ + if(engineTorque) delete engineTorque; + engineTorque=new int(engineTorque_); + return true; +} + +void OnVehicleData::reset_engineTorque(void) +{ + if(engineTorque) delete engineTorque; + engineTorque=0; +} + +const unsigned int* OnVehicleData::get_odometer(void) +{ + return odometer; +} + +bool OnVehicleData::set_odometer(const unsigned int& odometer_) +{ + if(odometer) delete odometer; + odometer=new unsigned int(odometer_); + return true; +} + +void OnVehicleData::reset_odometer(void) +{ + if(odometer) delete odometer; + odometer=0; +} + +const unsigned int* OnVehicleData::get_tripOdometer(void) +{ + return tripOdometer; +} + +bool OnVehicleData::set_tripOdometer(const unsigned int& tripOdometer_) +{ + if(tripOdometer) delete tripOdometer; + tripOdometer=new unsigned int(tripOdometer_); + return true; +} + +void OnVehicleData::reset_tripOdometer(void) +{ + if(tripOdometer) delete tripOdometer; + tripOdometer=0; +} + +const std::string* OnVehicleData::get_genericbinary(void) +{ + return genericbinary; +} + +bool OnVehicleData::set_genericbinary(const std::string& genericbinary_) +{ + if(genericbinary) delete genericbinary; + genericbinary=new std::string(genericbinary_); + return true; +} + +void OnVehicleData::reset_genericbinary(void) +{ + if(genericbinary) delete genericbinary; + genericbinary=0; +} + +bool OnVehicleData::checkIntegrity(void) +{ + return OnVehicleDataMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/OnVehicleDataMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/OnVehicleDataMarshaller.cpp new file mode 100644 index 000000000..cf8a85b3a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/OnVehicleDataMarshaller.cpp @@ -0,0 +1,364 @@ +// +// 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/VehicleInfo/OnVehicleData.h" +#include "../src/SDLRPCObjectsImpl/V2/GPSDataMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/PRNDLMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/TireStatusMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VehicleInfo/OnVehicleDataMarshaller.h" + +/* + interface NsRPC2Communication::VehicleInfo + 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::VehicleInfo; + +bool OnVehicleDataMarshaller::checkIntegrity(OnVehicleData& s) +{ + return checkIntegrityConst(s); +} + + +bool OnVehicleDataMarshaller::fromString(const std::string& s,OnVehicleData& 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 OnVehicleDataMarshaller::toString(const OnVehicleData& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool OnVehicleDataMarshaller::checkIntegrityConst(const OnVehicleData& s) +{ + if(s.gps && (!NsSmartDeviceLinkRPCV2::GPSDataMarshaller::checkIntegrityConst(s.gps[0]))) return false; + + if(s.speed && (s.speed[0]<-100 || s.speed[0]>500)) return false; + + if(s.rpm && (s.rpm[0]>20000)) return false; + + if(s.fuelLevel && (s.fuelLevel[0]<0 || s.fuelLevel[0]>100)) return false; + + if(s.avgFuelEconomy && (s.avgFuelEconomy[0]<0 || s.avgFuelEconomy[0]>7000)) return false; + + if(s.batteryVoltage && (s.batteryVoltage[0]<0 || s.batteryVoltage[0]>26)) return false; + + if(s.externalTemperature && (s.externalTemperature[0]<-40 || s.externalTemperature[0]>100)) return false; + + if(s.vin && (s.vin[0].length()>17)) return false; + + if(s.prndl && (!NsSmartDeviceLinkRPCV2::PRNDLMarshaller::checkIntegrityConst(s.prndl[0]))) return false; + + if(s.tirePressure && (!NsSmartDeviceLinkRPCV2::TireStatusMarshaller::checkIntegrityConst(s.tirePressure[0]))) return false; + + if(s.batteryPackVoltage && (s.batteryPackVoltage[0]<-1000 || s.batteryPackVoltage[0]>1000)) return false; + + if(s.batteryPackCurrent && (s.batteryPackCurrent[0]<-1000 || s.batteryPackCurrent[0]>1000)) return false; + + if(s.batteryPackTemperature && (s.batteryPackTemperature[0]<-50 || s.batteryPackTemperature[0]>250)) return false; + + if(s.engineTorque && (s.engineTorque[0]<-10000 || s.engineTorque[0]>55000)) return false; + + if(s.odometer && (s.odometer[0]>2000000)) return false; + + if(s.tripOdometer && (s.tripOdometer[0]>2000000)) return false; + + if(s.genericbinary && (s.genericbinary[0].length()>500)) return false; + + return true; +} + + +Json::Value OnVehicleDataMarshaller::toJSON(const OnVehicleData& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("VehicleInfo.OnVehicleData"); + json["params"]=Json::Value(Json::objectValue); + + if(e.gps) + json["params"]["gps"]=NsSmartDeviceLinkRPCV2::GPSDataMarshaller::toJSON(e.gps[0]);; + if(e.speed) + json["params"]["speed"]=Json::Value(e.speed[0]);; + if(e.rpm) + json["params"]["rpm"]=Json::Value(e.rpm[0]);; + if(e.fuelLevel) + json["params"]["fuelLevel"]=Json::Value(e.fuelLevel[0]);; + if(e.avgFuelEconomy) + json["params"]["avgFuelEconomy"]=Json::Value(e.avgFuelEconomy[0]);; + if(e.batteryVoltage) + json["params"]["batteryVoltage"]=Json::Value(e.batteryVoltage[0]);; + if(e.externalTemperature) + json["params"]["externalTemperature"]=Json::Value(e.externalTemperature[0]);; + if(e.vin) + json["params"]["vin"]=Json::Value(e.vin[0]);; + if(e.prndl) + json["params"]["prndl"]=NsSmartDeviceLinkRPCV2::PRNDLMarshaller::toJSON(e.prndl[0]);; + if(e.tirePressure) + json["params"]["tirePressure"]=NsSmartDeviceLinkRPCV2::TireStatusMarshaller::toJSON(e.tirePressure[0]);; + if(e.batteryPackVoltage) + json["params"]["batteryPackVoltage"]=Json::Value(e.batteryPackVoltage[0]);; + if(e.batteryPackCurrent) + json["params"]["batteryPackCurrent"]=Json::Value(e.batteryPackCurrent[0]);; + if(e.batteryPackTemperature) + json["params"]["batteryPackTemperature"]=Json::Value(e.batteryPackTemperature[0]);; + if(e.engineTorque) + json["params"]["engineTorque"]=Json::Value(e.engineTorque[0]);; + if(e.odometer) + json["params"]["odometer"]=Json::Value(e.odometer[0]);; + if(e.tripOdometer) + json["params"]["tripOdometer"]=Json::Value(e.tripOdometer[0]);; + if(e.genericbinary) + json["params"]["genericbinary"]=Json::Value(e.genericbinary[0]);; + return json; +} + + +bool OnVehicleDataMarshaller::fromJSON(const Json::Value& json,OnVehicleData& 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("VehicleInfo.OnVehicleData")) return false; + if(!json.isMember("params")) return false; + + Json::Value js=json["params"]; + if(!js.isObject()) return false; + + if(c.gps) delete c.gps; + c.gps=0; + if(js.isMember("gps")) + { + c.gps=new NsSmartDeviceLinkRPCV2::GPSData(); + if(!NsSmartDeviceLinkRPCV2::GPSDataMarshaller::fromJSON(js["gps"],c.gps[0])) return false; + } + + if(c.speed) delete c.speed; + c.speed=0; + if(js.isMember("speed")) + { + if(!js["speed"].isNumeric()) return false; + c.speed=new float(); + c.speed[0]=js["speed"].asDouble(); + if(c.speed[0]<-100 || c.speed[0]>500) return false; + + } + + if(c.rpm) delete c.rpm; + c.rpm=0; + if(js.isMember("rpm")) + { + if(!js["rpm"].isInt()) return false; + c.rpm=new unsigned int(); + c.rpm[0]=js["rpm"].asInt(); + if(c.rpm[0]>20000) return false; + + } + + if(c.fuelLevel) delete c.fuelLevel; + c.fuelLevel=0; + if(js.isMember("fuelLevel")) + { + if(!js["fuelLevel"].isNumeric()) return false; + c.fuelLevel=new float(); + c.fuelLevel[0]=js["fuelLevel"].asDouble(); + if(c.fuelLevel[0]<0 || c.fuelLevel[0]>100) return false; + + } + + if(c.avgFuelEconomy) delete c.avgFuelEconomy; + c.avgFuelEconomy=0; + if(js.isMember("avgFuelEconomy")) + { + if(!js["avgFuelEconomy"].isNumeric()) return false; + c.avgFuelEconomy=new float(); + c.avgFuelEconomy[0]=js["avgFuelEconomy"].asDouble(); + if(c.avgFuelEconomy[0]<0 || c.avgFuelEconomy[0]>7000) return false; + + } + + if(c.batteryVoltage) delete c.batteryVoltage; + c.batteryVoltage=0; + if(js.isMember("batteryVoltage")) + { + if(!js["batteryVoltage"].isNumeric()) return false; + c.batteryVoltage=new float(); + c.batteryVoltage[0]=js["batteryVoltage"].asDouble(); + if(c.batteryVoltage[0]<0 || c.batteryVoltage[0]>26) return false; + + } + + if(c.externalTemperature) delete c.externalTemperature; + c.externalTemperature=0; + if(js.isMember("externalTemperature")) + { + if(!js["externalTemperature"].isNumeric()) return false; + c.externalTemperature=new float(); + c.externalTemperature[0]=js["externalTemperature"].asDouble(); + if(c.externalTemperature[0]<-40 || c.externalTemperature[0]>100) return false; + + } + + if(c.vin) delete c.vin; + c.vin=0; + if(js.isMember("vin")) + { + if(!js["vin"].isString()) return false; + c.vin=new std::string(); + c.vin[0]=js["vin"].asString(); + if(c.vin[0].length()>17) return false; + + } + + if(c.prndl) delete c.prndl; + c.prndl=0; + if(js.isMember("prndl")) + { + c.prndl=new NsSmartDeviceLinkRPCV2::PRNDL(); + if(!NsSmartDeviceLinkRPCV2::PRNDLMarshaller::fromJSON(js["prndl"],c.prndl[0])) return false; + } + + if(c.tirePressure) delete c.tirePressure; + c.tirePressure=0; + if(js.isMember("tirePressure")) + { + c.tirePressure=new NsSmartDeviceLinkRPCV2::TireStatus(); + if(!NsSmartDeviceLinkRPCV2::TireStatusMarshaller::fromJSON(js["tirePressure"],c.tirePressure[0])) return false; + } + + if(c.batteryPackVoltage) delete c.batteryPackVoltage; + c.batteryPackVoltage=0; + if(js.isMember("batteryPackVoltage")) + { + if(!js["batteryPackVoltage"].isNumeric()) return false; + c.batteryPackVoltage=new float(); + c.batteryPackVoltage[0]=js["batteryPackVoltage"].asDouble(); + if(c.batteryPackVoltage[0]<-1000 || c.batteryPackVoltage[0]>1000) return false; + + } + + if(c.batteryPackCurrent) delete c.batteryPackCurrent; + c.batteryPackCurrent=0; + if(js.isMember("batteryPackCurrent")) + { + if(!js["batteryPackCurrent"].isNumeric()) return false; + c.batteryPackCurrent=new float(); + c.batteryPackCurrent[0]=js["batteryPackCurrent"].asDouble(); + if(c.batteryPackCurrent[0]<-1000 || c.batteryPackCurrent[0]>1000) return false; + + } + + if(c.batteryPackTemperature) delete c.batteryPackTemperature; + c.batteryPackTemperature=0; + if(js.isMember("batteryPackTemperature")) + { + if(!js["batteryPackTemperature"].isInt()) return false; + c.batteryPackTemperature=new int(); + c.batteryPackTemperature[0]=js["batteryPackTemperature"].asInt(); + if(c.batteryPackTemperature[0]<-50 || c.batteryPackTemperature[0]>250) return false; + + } + + if(c.engineTorque) delete c.engineTorque; + c.engineTorque=0; + if(js.isMember("engineTorque")) + { + if(!js["engineTorque"].isInt()) return false; + c.engineTorque=new int(); + c.engineTorque[0]=js["engineTorque"].asInt(); + if(c.engineTorque[0]<-10000 || c.engineTorque[0]>55000) return false; + + } + + if(c.odometer) delete c.odometer; + c.odometer=0; + if(js.isMember("odometer")) + { + if(!js["odometer"].isInt()) return false; + c.odometer=new unsigned int(); + c.odometer[0]=js["odometer"].asInt(); + if(c.odometer[0]>2000000) return false; + + } + + if(c.tripOdometer) delete c.tripOdometer; + c.tripOdometer=0; + if(js.isMember("tripOdometer")) + { + if(!js["tripOdometer"].isInt()) return false; + c.tripOdometer=new unsigned int(); + c.tripOdometer[0]=js["tripOdometer"].asInt(); + if(c.tripOdometer[0]>2000000) return false; + + } + + if(c.genericbinary) delete c.genericbinary; + c.genericbinary=0; + if(js.isMember("genericbinary")) + { + if(!js["genericbinary"].isString()) return false; + c.genericbinary=new std::string(); + c.genericbinary[0]=js["genericbinary"].asString(); + if(c.genericbinary[0].length()>500) return false; + + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/OnVehicleDataMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/OnVehicleDataMarshaller.h new file mode 100644 index 000000000..912f4c6a4 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/OnVehicleDataMarshaller.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_VEHICLEINFO_ONVEHICLEDATAMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VEHICLEINFO_ONVEHICLEDATAMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VehicleInfo/OnVehicleData.h" + +namespace NsRPC2Communication +{ + namespace VehicleInfo + { + + struct OnVehicleDataMarshaller + { + static bool checkIntegrity(OnVehicleData& e); + static bool checkIntegrityConst(const OnVehicleData& e); + + static bool fromString(const std::string& s,OnVehicleData& e); + static const std::string toString(const OnVehicleData& e); + + static bool fromJSON(const Json::Value& s,OnVehicleData& e); + static Json::Value toJSON(const OnVehicleData& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/ReadDID.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/ReadDID.cpp new file mode 100644 index 000000000..a860aa8b9 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/ReadDID.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/VehicleInfo/ReadDID.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VehicleInfo + 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::VehicleInfo; + + +ReadDID& ReadDID::operator =(const ReadDID& c) +{ + ecuName=c.ecuName; + didLocation=c.didLocation; + if(encrypted) delete encrypted; + encrypted= c.encrypted ? new bool(c.encrypted[0]) : 0; + appId=c.appId; + return *this; +} + + +ReadDID::~ReadDID(void) +{ + if(encrypted) delete encrypted; +} + + +ReadDID::ReadDID(void) : + RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VEHICLEINFO__READDID), + encrypted(0) +{ +} + + +ReadDID::ReadDID(const ReadDID& c) : RPC2Request(Marshaller::METHOD_NSRPC2COMMUNICATION_VEHICLEINFO__READDID,c.getId()) +{ + *this=c; +} + + +unsigned int ReadDID::get_ecuName(void) +{ + return ecuName; +} + +bool ReadDID::set_ecuName(unsigned int ecuName_) +{ + ecuName=ecuName_; + return true; +} + +const std::vector< unsigned int>& ReadDID::get_didLocation(void) +{ + return didLocation; +} + +bool ReadDID::set_didLocation(const std::vector< unsigned int>& didLocation_) +{ + didLocation=didLocation_; + return true; +} + +const bool* ReadDID::get_encrypted(void) +{ + return encrypted; +} + +bool ReadDID::set_encrypted(const bool& encrypted_) +{ + if(encrypted) delete encrypted; + encrypted=new bool(encrypted_); + return true; +} + +void ReadDID::reset_encrypted(void) +{ + if(encrypted) delete encrypted; + encrypted=0; +} + +int ReadDID::get_appId(void) +{ + return appId; +} + +bool ReadDID::set_appId(int appId_) +{ + appId=appId_; + return true; +} + +bool ReadDID::checkIntegrity(void) +{ + return ReadDIDMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/ReadDIDMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/ReadDIDMarshaller.cpp new file mode 100644 index 000000000..3d0eb43eb --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/ReadDIDMarshaller.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/VehicleInfo/ReadDID.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VehicleInfo/ReadDIDMarshaller.h" + +/* + interface NsRPC2Communication::VehicleInfo + 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::VehicleInfo; + +bool ReadDIDMarshaller::checkIntegrity(ReadDID& s) +{ + return checkIntegrityConst(s); +} + + +bool ReadDIDMarshaller::fromString(const std::string& s,ReadDID& 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 ReadDIDMarshaller::toString(const ReadDID& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool ReadDIDMarshaller::checkIntegrityConst(const ReadDID& s) +{ + if(s.ecuName>65535) return false; + + { + unsigned int i=s.didLocation.size(); + if(i<0) return false; + if(i>1000) return false; + while(i--) + { + if(s.didLocation[i]>65535) return false; + } + } + + return true; +} + + +Json::Value ReadDIDMarshaller::toJSON(const ReadDID& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["jsonrpc"]=Json::Value("2.0"); + json["method"]=Json::Value("VehicleInfo.ReadDID"); + + json["id"]=Json::Value(e.getId()); + json["params"]=Json::Value(Json::objectValue); + json["params"]["ecuName"]=Json::Value(e.ecuName);; + { + unsigned int i=e.didLocation.size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=Json::Value(e.didLocation[i]); + + json["params"]["didLocation"]=j; + } + if(e.encrypted) + json["params"]["encrypted"]=Json::Value(e.encrypted[0]);; + json["params"]["appId"]=Json::Value(e.appId);; + return json; +} + + +bool ReadDIDMarshaller::fromJSON(const Json::Value& json,ReadDID& 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("VehicleInfo.ReadDID")) 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("ecuName") || !js["ecuName"].isInt()) return false; + c.ecuName=js["ecuName"].asInt(); + if(c.ecuName>65535) return false; + + if(!js.isMember("didLocation") || !js["didLocation"].isArray()) + return false; + { + c.didLocation.clear(); + unsigned int i=js["didLocation"].size(); + if(i<0) return false; + if(i>1000) return false; + c.didLocation.resize(i); + while(i--) + { + if(!js["didLocation"][i].isInt()) + return false; + c.didLocation[i]=js["didLocation"][i].asInt(); + if(c.didLocation[i]>65535) return false; + + } + } + + + if(c.encrypted) delete c.encrypted; + c.encrypted=0; + if(js.isMember("encrypted")) + { + if(!js["encrypted"].isBool()) return false; + c.encrypted=new bool(); + c.encrypted[0]=js["encrypted"].asBool(); + + } + + 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/VehicleInfo/ReadDIDMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/ReadDIDMarshaller.h new file mode 100644 index 000000000..3d5b431ff --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/ReadDIDMarshaller.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_VEHICLEINFO_READDIDMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VEHICLEINFO_READDIDMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VehicleInfo/ReadDID.h" + +namespace NsRPC2Communication +{ + namespace VehicleInfo + { + + struct ReadDIDMarshaller + { + static bool checkIntegrity(ReadDID& e); + static bool checkIntegrityConst(const ReadDID& e); + + static bool fromString(const std::string& s,ReadDID& e); + static const std::string toString(const ReadDID& e); + + static bool fromJSON(const Json::Value& s,ReadDID& e); + static Json::Value toJSON(const ReadDID& e); + }; + } +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/ReadDIDResponse.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/ReadDIDResponse.cpp new file mode 100644 index 000000000..010903695 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/ReadDIDResponse.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/VehicleInfo/ReadDIDResponse.h" +#include "../src/../include/JSONHandler/RPC2Objects/Marshaller.h" + +/* + interface NsRPC2Communication::VehicleInfo + 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::VehicleInfo; + + +ReadDIDResponse& ReadDIDResponse::operator =(const ReadDIDResponse& c) +{ + if(dataResult) delete dataResult; + dataResult= c.dataResult ? new std::vector<NsSmartDeviceLinkRPCV2::VehicleDataResultCode>(c.dataResult[0]) : 0; + if(data) delete data; + data= c.data ? new std::vector<std::string>(c.data[0]) : 0; + return *this; +} + + +ReadDIDResponse::~ReadDIDResponse(void) +{ + if(dataResult) delete dataResult; + if(data) delete data; +} + + +ReadDIDResponse::ReadDIDResponse(void) : + RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VEHICLEINFO__READDIDRESPONSE), + dataResult(0), + data(0) +{ +} + + +ReadDIDResponse::ReadDIDResponse(const ReadDIDResponse& c) : RPC2Response(Marshaller::METHOD_NSRPC2COMMUNICATION_VEHICLEINFO__READDIDRESPONSE,c.getId(),c.getResult()) +{ + *this=c; +} + + +const std::vector< NsSmartDeviceLinkRPCV2::VehicleDataResultCode>* ReadDIDResponse::get_dataResult(void) +{ + return dataResult; +} + +bool ReadDIDResponse::set_dataResult(const std::vector< NsSmartDeviceLinkRPCV2::VehicleDataResultCode>& dataResult_) +{ + if(dataResult) delete dataResult; + dataResult=new std::vector< NsSmartDeviceLinkRPCV2::VehicleDataResultCode>(dataResult_); + return true; +} + +void ReadDIDResponse::reset_dataResult(void) +{ + if(dataResult) delete dataResult; + dataResult=0; +} + +const std::vector< std::string>* ReadDIDResponse::get_data(void) +{ + return data; +} + +bool ReadDIDResponse::set_data(const std::vector< std::string>& data_) +{ + if(data) delete data; + data=new std::vector< std::string>(data_); + return true; +} + +void ReadDIDResponse::reset_data(void) +{ + if(data) delete data; + data=0; +} + +bool ReadDIDResponse::checkIntegrity(void) +{ + return ReadDIDResponseMarshaller::checkIntegrity(*this); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/ReadDIDResponseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/ReadDIDResponseMarshaller.cpp new file mode 100644 index 000000000..618c98f11 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/ReadDIDResponseMarshaller.cpp @@ -0,0 +1,206 @@ +// +// 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/VehicleInfo/ReadDIDResponse.h" +#include "../src/SDLRPCObjectsImpl/V2/VehicleDataResultCodeMarshaller.h" +#include "../src/SDLRPCObjectsImpl/V2/ResultMarshaller.h" +#include "../src/../src/RPC2ObjectsImpl//NsRPC2Communication/VehicleInfo/ReadDIDResponseMarshaller.h" + +/* + interface NsRPC2Communication::VehicleInfo + 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::VehicleInfo; + +bool ReadDIDResponseMarshaller::checkIntegrity(ReadDIDResponse& s) +{ + return checkIntegrityConst(s); +} + + +bool ReadDIDResponseMarshaller::fromString(const std::string& s,ReadDIDResponse& 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 ReadDIDResponseMarshaller::toString(const ReadDIDResponse& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool ReadDIDResponseMarshaller::checkIntegrityConst(const ReadDIDResponse& s) +{ + if(s.dataResult) + { + unsigned int i=s.dataResult[0].size(); + if(i<0) return false; + if(i>1000) return false; + } + + if(s.data) + { + unsigned int i=s.data[0].size(); + if(i<0) return false; + if(i>1000) return false; + while(i--) + { + if(s.data[0][i].length()>5000) return false; + } + } + + return true; +} + + +Json::Value ReadDIDResponseMarshaller::toJSON(const ReadDIDResponse& 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("VehicleInfo.ReadDIDResponse"); + + if(e.dataResult) + { + unsigned int i=e.dataResult[0].size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=NsSmartDeviceLinkRPCV2::VehicleDataResultCodeMarshaller::toJSON(e.dataResult[0][i]); + + json["result"]["dataResult"]=j; + } + if(e.data) + { + unsigned int i=e.data[0].size(); + Json::Value j=Json::Value(Json::arrayValue); + j.resize(i); + while(i--) + j[i]=Json::Value(e.data[0][i]); + + json["result"]["data"]=j; + } + return json; +} + + +bool ReadDIDResponseMarshaller::fromJSON(const Json::Value& json,ReadDIDResponse& 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("VehicleInfo.ReadDIDResponse")) return false; + + if(!NsSmartDeviceLinkRPCV2::ResultMarshaller::fromJSON(js["resultCode"],r)) return false; + c.setResult(r.get()); + if(c.dataResult) delete c.dataResult; + c.dataResult=0; + if(js.isMember("dataResult")) + { + if(!js["dataResult"].isArray()) return false; + unsigned int i=js["dataResult"].size(); + if(i<0) return false; + if(i>1000) return false; + + c.dataResult=new std::vector<NsSmartDeviceLinkRPCV2::VehicleDataResultCode>(); + c.dataResult->resize(js["dataResult"].size()); + + while(i--) + if(!NsSmartDeviceLinkRPCV2::VehicleDataResultCodeMarshaller::fromJSON(js["dataResult"][i],c.dataResult[0][i])) return false; + } + + + if(c.data) delete c.data; + c.data=0; + if(js.isMember("data")) + { + if(!js["data"].isArray()) return false; + unsigned int i=js["data"].size(); + if(i<0) return false; + if(i>1000) return false; + + c.data=new std::vector<std::string>(); + c.data->resize(js["data"].size()); + + while(i--) + { + if(!js["data"][i].isString()) + return false; + + c.data[0][i]=js["data"][i].asString(); + if(c.data[0][i].length()>5000) return false; + } + } + + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} diff --git a/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/ReadDIDResponseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/ReadDIDResponseMarshaller.h new file mode 100644 index 000000000..597656970 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/VehicleInfo/ReadDIDResponseMarshaller.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_VEHICLEINFO_READDIDRESPONSEMARSHALLER_INCLUDE +#define NSRPC2COMMUNICATION_VEHICLEINFO_READDIDRESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/VehicleInfo/ReadDIDResponse.h" + +namespace NsRPC2Communication +{ + namespace VehicleInfo + { + + struct ReadDIDResponseMarshaller + { + static bool checkIntegrity(ReadDIDResponse& e); + static bool checkIntegrityConst(const ReadDIDResponse& e); + + static bool fromString(const std::string& s,ReadDIDResponse& e); + static const std::string toString(const ReadDIDResponse& e); + + static bool fromJSON(const Json::Value& s,ReadDIDResponse& e); + static Json::Value toJSON(const ReadDIDResponse& e); + }; + } +} + +#endif |