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/SDLRPCObjectsImpl/V1 | |
download | smartdevicelink-a46991cd5da4dbcc5510457c6bae2dab340c1ed2.tar.gz |
Initial Ford commit with Core and Proxies
Diffstat (limited to 'SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1')
260 files changed, 27671 insertions, 0 deletions
diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddCommand_request.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddCommand_request.cpp new file mode 100644 index 000000000..954282cb2 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddCommand_request.cpp @@ -0,0 +1,152 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/AddCommand_request.h" +#include "AddCommand_requestMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "MenuParamsMarshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +AddCommand_request& AddCommand_request::operator =(const AddCommand_request& c) +{ + cmdID= c.cmdID; + menuParams= c.menuParams ? new MenuParams(c.menuParams[0]) : 0; + vrCommands= c.vrCommands ? new std::vector<std::string>(c.vrCommands[0]) : 0; + + return *this;} + + +AddCommand_request::~AddCommand_request(void) +{ + if(menuParams) + delete menuParams; + if(vrCommands) + delete vrCommands; +} + + +AddCommand_request::AddCommand_request(const AddCommand_request& c) +{ + *this=c; +} + + +bool AddCommand_request::checkIntegrity(void) +{ + return AddCommand_requestMarshaller::checkIntegrity(*this); +} + + +AddCommand_request::AddCommand_request(void) : SDLRPCRequest(PROTOCOL_VERSION,Marshaller::METHOD_ADDCOMMAND_REQUEST), + menuParams(0), + vrCommands(0) +{ +} + + + +bool AddCommand_request::set_cmdID(unsigned int cmdID_) +{ + if(cmdID_>2000000000) return false; + cmdID=cmdID_; + return true; +} + +bool AddCommand_request::set_menuParams(const MenuParams& menuParams_) +{ + if(!MenuParamsMarshaller::checkIntegrityConst(menuParams_)) return false; + delete menuParams; + menuParams=0; + + menuParams=new MenuParams(menuParams_); + return true; +} + +void AddCommand_request::reset_menuParams(void) +{ + if(menuParams) + delete menuParams; + menuParams=0; +} + +bool AddCommand_request::set_vrCommands(const std::vector<std::string>& vrCommands_) +{ + unsigned int i=vrCommands_.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(vrCommands_[i].length()>99) return false; + } + delete vrCommands; + vrCommands=0; + + vrCommands=new std::vector<std::string>(vrCommands_); + return true; +} + +void AddCommand_request::reset_vrCommands(void) +{ + if(vrCommands) + delete vrCommands; + vrCommands=0; +} + + + + +unsigned int AddCommand_request::get_cmdID(void) const +{ + return cmdID; +} + +const MenuParams* AddCommand_request::get_menuParams(void) const +{ + return menuParams; +} + +const std::vector<std::string>* AddCommand_request::get_vrCommands(void) const +{ + return vrCommands; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddCommand_requestMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddCommand_requestMarshaller.cpp new file mode 100644 index 000000000..673614e65 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddCommand_requestMarshaller.cpp @@ -0,0 +1,185 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/AddCommand_request.h" +#include "MenuParamsMarshaller.h" + +#include "AddCommand_requestMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool AddCommand_requestMarshaller::checkIntegrity(AddCommand_request& s) +{ + return checkIntegrityConst(s); +} + + +bool AddCommand_requestMarshaller::fromString(const std::string& s,AddCommand_request& 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 AddCommand_requestMarshaller::toString(const AddCommand_request& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool AddCommand_requestMarshaller::checkIntegrityConst(const AddCommand_request& s) +{ + if(s.cmdID>2000000000) return false; + if(s.menuParams && !MenuParamsMarshaller::checkIntegrityConst(*s.menuParams)) return false; + if(s.vrCommands) + { + unsigned int i=s.vrCommands[0].size(); + if(i>100 || i<1) return false; + while(i--) + { + if(s.vrCommands[0][i].length()>99) return false; + } + } + return true; +} + +Json::Value AddCommand_requestMarshaller::toJSON(const AddCommand_request& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["request"]=Json::Value(Json::objectValue); + json["request"]["name"]=Json::Value("AddCommand"); + json["request"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["cmdID"]=Json::Value(e.cmdID); + + if(e.menuParams) + j["menuParams"]=MenuParamsMarshaller::toJSON(*e.menuParams); + + if(e.vrCommands) + { + unsigned int sz=e.vrCommands->size(); + j["vrCommands"]=Json::Value(Json::arrayValue); + j["vrCommands"].resize(sz); + for(unsigned int i=0;i<sz;i++) + j["vrCommands"][i]=Json::Value(e.vrCommands[0][i]); + } + + json["request"]["parameters"]=j; + return json; +} + + +bool AddCommand_requestMarshaller::fromJSON(const Json::Value& js,AddCommand_request& c) +{ + if(c.menuParams) delete c.menuParams; + c.menuParams=0; + + if(c.vrCommands) delete c.vrCommands; + c.vrCommands=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("request")) return false; + + if(!js["request"].isObject()) return false; + const Json::Value& j2=js["request"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("AddCommand")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("cmdID")) return false; + { + const Json::Value& j=json["cmdID"]; + if(!j.isInt()) return false; + c.cmdID=j.asInt(); + } + if(json.isMember("menuParams")) + { + const Json::Value& j=json["menuParams"]; + c.menuParams=new MenuParams(); + if(!MenuParamsMarshaller::fromJSON(j,c.menuParams[0])) + return false; + } + if(json.isMember("vrCommands")) + { + const Json::Value& j=json["vrCommands"]; + if(!j.isArray()) return false; + c.vrCommands=new std::vector<std::string>(); + c.vrCommands->resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + if(!j[i].isString()) + return false; + else + c.vrCommands[0][i]=j[i].asString(); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddCommand_requestMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddCommand_requestMarshaller.h new file mode 100644 index 000000000..3807438a5 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddCommand_requestMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_ADDCOMMAND_REQUESTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_ADDCOMMAND_REQUESTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/AddCommand_request.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct AddCommand_requestMarshaller + { + static bool checkIntegrity(AddCommand_request& e); + static bool checkIntegrityConst(const AddCommand_request& e); + + static bool fromString(const std::string& s,AddCommand_request& e); + static const std::string toString(const AddCommand_request& e); + + static bool fromJSON(const Json::Value& s,AddCommand_request& e); + static Json::Value toJSON(const AddCommand_request& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddCommand_response.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddCommand_response.cpp new file mode 100644 index 000000000..da044e6ca --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddCommand_response.cpp @@ -0,0 +1,75 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/AddCommand_response.h" +#include "AddCommand_responseMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +AddCommand_response& AddCommand_response::operator =(const AddCommand_response& c) +{ + success = c.success; + resultCode = c.resultCode; + info = c.info ? new std::string(c.info[0]) : 0; + + return *this; +} + +AddCommand_response::~AddCommand_response(void) +{} + +AddCommand_response::AddCommand_response(const AddCommand_response& c) +{ + *this = c; +} + +bool AddCommand_response::checkIntegrity(void) +{ + return AddCommand_responseMarshaller::checkIntegrity(*this); +} + +AddCommand_response::AddCommand_response(void) : SDLRPCResponse(PROTOCOL_VERSION, Marshaller::METHOD_ADDCOMMAND_RESPONSE) +{} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddCommand_responseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddCommand_responseMarshaller.cpp new file mode 100644 index 000000000..181a34869 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddCommand_responseMarshaller.cpp @@ -0,0 +1,161 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/AddCommand_response.h" +#include "ResultMarshaller.h" + +#include "AddCommand_responseMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool AddCommand_responseMarshaller::checkIntegrity(AddCommand_response& s) +{ + return checkIntegrityConst(s); +} + + +bool AddCommand_responseMarshaller::fromString(const std::string& s,AddCommand_response& 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 AddCommand_responseMarshaller::toString(const AddCommand_response& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool AddCommand_responseMarshaller::checkIntegrityConst(const AddCommand_response& s) +{ + if(!ResultMarshaller::checkIntegrityConst(static_cast<NsSmartDeviceLinkRPCV2::Result>(s.resultCode))) return false; + if(s.info && s.info->length()>1000) return false; + return true; +} + +Json::Value AddCommand_responseMarshaller::toJSON(const AddCommand_response& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["response"]=Json::Value(Json::objectValue); + json["response"]["name"]=Json::Value("AddCommand"); + json["response"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["success"]=Json::Value(e.success); + + j["resultCode"]=ResultMarshaller::toJSON(static_cast<NsSmartDeviceLinkRPCV2::Result>(e.resultCode)); + + if(e.info) + j["info"]=Json::Value(*e.info); + + json["response"]["parameters"]=j; + return json; +} + + +bool AddCommand_responseMarshaller::fromJSON(const Json::Value& js,AddCommand_response& c) +{ + if(c.info) delete c.info; + c.info=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("response")) return false; + + if(!js["response"].isObject()) return false; + const Json::Value& j2=js["response"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("AddCommand")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("success")) return false; + { + const Json::Value& j=json["success"]; + if(!j.isBool()) return false; + c.success=j.asBool(); + } + if(!json.isMember("resultCode")) return false; + { + const Json::Value& j=json["resultCode"]; + NsSmartDeviceLinkRPC::Result result = static_cast<NsSmartDeviceLinkRPC::Result>(c.resultCode); + if(!ResultMarshaller::fromJSON(j, result)) + return false; + c.resultCode = static_cast<NsSmartDeviceLinkRPCV2::Result>(result); + } + if(json.isMember("info")) + { + const Json::Value& j=json["info"]; + if(!j.isString()) return false; + c.info=new std::string(j.asString()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddCommand_responseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddCommand_responseMarshaller.h new file mode 100644 index 000000000..1041b70b5 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddCommand_responseMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_ADDCOMMAND_RESPONSEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_ADDCOMMAND_RESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/AddCommand_response.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct AddCommand_responseMarshaller + { + static bool checkIntegrity(AddCommand_response& e); + static bool checkIntegrityConst(const AddCommand_response& e); + + static bool fromString(const std::string& s,AddCommand_response& e); + static const std::string toString(const AddCommand_response& e); + + static bool fromJSON(const Json::Value& s,AddCommand_response& e); + static Json::Value toJSON(const AddCommand_response& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddSubMenu_request.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddSubMenu_request.cpp new file mode 100644 index 000000000..80f3e2ce5 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddSubMenu_request.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 "../include/JSONHandler/SDLRPCObjects/V1/AddSubMenu_request.h" +#include "AddSubMenu_requestMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +AddSubMenu_request& AddSubMenu_request::operator =(const AddSubMenu_request& c) +{ + menuID= c.menuID; + position= c.position ? new unsigned int(c.position[0]) : 0; + menuName= c.menuName; + + return *this;} + + +AddSubMenu_request::~AddSubMenu_request(void) +{ + if(position) + delete position; +} + + +AddSubMenu_request::AddSubMenu_request(const AddSubMenu_request& c) +{ + *this=c; +} + + +bool AddSubMenu_request::checkIntegrity(void) +{ + return AddSubMenu_requestMarshaller::checkIntegrity(*this); +} + + +AddSubMenu_request::AddSubMenu_request(void) : SDLRPCRequest(PROTOCOL_VERSION,Marshaller::METHOD_ADDSUBMENU_REQUEST), + position(0) +{ +} + + + +bool AddSubMenu_request::set_menuID(unsigned int menuID_) +{ + if(menuID_>2000000000) return false; + menuID=menuID_; + return true; +} + +bool AddSubMenu_request::set_position(unsigned int position_) +{ + if(position_>1000) return false; + delete position; + position=0; + + position=new unsigned int(position_); + return true; +} + +void AddSubMenu_request::reset_position(void) +{ + if(position) + delete position; + position=0; +} + +bool AddSubMenu_request::set_menuName(const std::string& menuName_) +{ + if(menuName_.length()>500) return false; + menuName=menuName_; + return true; +} + + + + +unsigned int AddSubMenu_request::get_menuID(void) const +{ + return menuID; +} + +const unsigned int* AddSubMenu_request::get_position(void) const +{ + return position; +} + +const std::string& AddSubMenu_request::get_menuName(void) const +{ + return menuName; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddSubMenu_requestMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddSubMenu_requestMarshaller.cpp new file mode 100644 index 000000000..d4e7542df --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddSubMenu_requestMarshaller.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 "../include/JSONHandler/SDLRPCObjects/V1/AddSubMenu_request.h" + + +#include "AddSubMenu_requestMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool AddSubMenu_requestMarshaller::checkIntegrity(AddSubMenu_request& s) +{ + return checkIntegrityConst(s); +} + + +bool AddSubMenu_requestMarshaller::fromString(const std::string& s,AddSubMenu_request& 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 AddSubMenu_requestMarshaller::toString(const AddSubMenu_request& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool AddSubMenu_requestMarshaller::checkIntegrityConst(const AddSubMenu_request& s) +{ + if(s.menuID>2000000000) return false; + if(s.position && *s.position>1000) return false; + if(s.menuName.length()>500) return false; + return true; +} + +Json::Value AddSubMenu_requestMarshaller::toJSON(const AddSubMenu_request& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["request"]=Json::Value(Json::objectValue); + json["request"]["name"]=Json::Value("AddSubMenu"); + json["request"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["menuID"]=Json::Value(e.menuID); + + if(e.position) + j["position"]=Json::Value(*e.position); + + j["menuName"]=Json::Value(e.menuName); + + json["request"]["parameters"]=j; + return json; +} + + +bool AddSubMenu_requestMarshaller::fromJSON(const Json::Value& js,AddSubMenu_request& c) +{ + if(c.position) delete c.position; + c.position=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("request")) return false; + + if(!js["request"].isObject()) return false; + const Json::Value& j2=js["request"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("AddSubMenu")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("menuID")) return false; + { + const Json::Value& j=json["menuID"]; + if(!j.isInt()) return false; + c.menuID=j.asInt(); + } + if(json.isMember("position")) + { + const Json::Value& j=json["position"]; + if(!j.isInt()) return false; + c.position=new unsigned int(j.asInt()); + } + if(!json.isMember("menuName")) return false; + { + const Json::Value& j=json["menuName"]; + if(!j.isString()) return false; + c.menuName=j.asString(); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddSubMenu_requestMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddSubMenu_requestMarshaller.h new file mode 100644 index 000000000..91e0a3a08 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddSubMenu_requestMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_ADDSUBMENU_REQUESTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_ADDSUBMENU_REQUESTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/AddSubMenu_request.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct AddSubMenu_requestMarshaller + { + static bool checkIntegrity(AddSubMenu_request& e); + static bool checkIntegrityConst(const AddSubMenu_request& e); + + static bool fromString(const std::string& s,AddSubMenu_request& e); + static const std::string toString(const AddSubMenu_request& e); + + static bool fromJSON(const Json::Value& s,AddSubMenu_request& e); + static Json::Value toJSON(const AddSubMenu_request& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddSubMenu_response.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddSubMenu_response.cpp new file mode 100644 index 000000000..69f00033f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddSubMenu_response.cpp @@ -0,0 +1,75 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/AddSubMenu_response.h" +#include "AddSubMenu_responseMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +AddSubMenu_response& AddSubMenu_response::operator =(const AddSubMenu_response& c) +{ + success = c.success; + resultCode = c.resultCode; + info = c.info ? new std::string(c.info[0]) : 0; + + return *this; +} + +AddSubMenu_response::~AddSubMenu_response(void) +{} + +AddSubMenu_response::AddSubMenu_response(const AddSubMenu_response& c) +{ + *this = c; +} + +bool AddSubMenu_response::checkIntegrity(void) +{ + return AddSubMenu_responseMarshaller::checkIntegrity(*this); +} + +AddSubMenu_response::AddSubMenu_response(void) : SDLRPCResponse(PROTOCOL_VERSION, Marshaller::METHOD_ADDSUBMENU_RESPONSE) +{} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddSubMenu_responseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddSubMenu_responseMarshaller.cpp new file mode 100644 index 000000000..7ea547541 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddSubMenu_responseMarshaller.cpp @@ -0,0 +1,161 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/AddSubMenu_response.h" +#include "ResultMarshaller.h" + +#include "AddSubMenu_responseMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool AddSubMenu_responseMarshaller::checkIntegrity(AddSubMenu_response& s) +{ + return checkIntegrityConst(s); +} + + +bool AddSubMenu_responseMarshaller::fromString(const std::string& s,AddSubMenu_response& 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 AddSubMenu_responseMarshaller::toString(const AddSubMenu_response& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool AddSubMenu_responseMarshaller::checkIntegrityConst(const AddSubMenu_response& s) +{ + if(!ResultMarshaller::checkIntegrityConst(static_cast<NsSmartDeviceLinkRPCV2::Result>(s.resultCode))) return false; + if(s.info && s.info->length()>1000) return false; + return true; +} + +Json::Value AddSubMenu_responseMarshaller::toJSON(const AddSubMenu_response& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["response"]=Json::Value(Json::objectValue); + json["response"]["name"]=Json::Value("AddSubMenu"); + json["response"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["success"]=Json::Value(e.success); + + j["resultCode"]=ResultMarshaller::toJSON(static_cast<NsSmartDeviceLinkRPCV2::Result>(e.resultCode)); + + if(e.info) + j["info"]=Json::Value(*e.info); + + json["response"]["parameters"]=j; + return json; +} + + +bool AddSubMenu_responseMarshaller::fromJSON(const Json::Value& js,AddSubMenu_response& c) +{ + if(c.info) delete c.info; + c.info=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("response")) return false; + + if(!js["response"].isObject()) return false; + const Json::Value& j2=js["response"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("AddSubMenu")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("success")) return false; + { + const Json::Value& j=json["success"]; + if(!j.isBool()) return false; + c.success=j.asBool(); + } + if(!json.isMember("resultCode")) return false; + { + const Json::Value& j=json["resultCode"]; + NsSmartDeviceLinkRPC::Result result = static_cast<NsSmartDeviceLinkRPC::Result>(c.resultCode); + if(!ResultMarshaller::fromJSON(j, result)) + return false; + c.resultCode = static_cast<NsSmartDeviceLinkRPCV2::Result>(result); + } + if(json.isMember("info")) + { + const Json::Value& j=json["info"]; + if(!j.isString()) return false; + c.info=new std::string(j.asString()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddSubMenu_responseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddSubMenu_responseMarshaller.h new file mode 100644 index 000000000..83be341dd --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AddSubMenu_responseMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_ADDSUBMENU_RESPONSEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_ADDSUBMENU_RESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/AddSubMenu_response.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct AddSubMenu_responseMarshaller + { + static bool checkIntegrity(AddSubMenu_response& e); + static bool checkIntegrityConst(const AddSubMenu_response& e); + + static bool fromString(const std::string& s,AddSubMenu_response& e); + static const std::string toString(const AddSubMenu_response& e); + + static bool fromJSON(const Json::Value& s,AddSubMenu_response& e); + static Json::Value toJSON(const AddSubMenu_response& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Alert_request.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Alert_request.cpp new file mode 100644 index 000000000..96917aeea --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Alert_request.cpp @@ -0,0 +1,217 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/Alert_request.h" +#include "Alert_requestMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "TTSChunkMarshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +Alert_request& Alert_request::operator =(const Alert_request& c) +{ + alertText1= c.alertText1 ? new std::string(c.alertText1[0]) : 0; + alertText2= c.alertText2 ? new std::string(c.alertText2[0]) : 0; + ttsChunks= c.ttsChunks ? new std::vector<TTSChunk>(c.ttsChunks[0]) : 0; + duration= c.duration ? new unsigned int(c.duration[0]) : 0; + playTone= c.playTone ? new bool(c.playTone[0]) : 0; + + return *this;} + + +Alert_request::~Alert_request(void) +{ + if(alertText1) + delete alertText1; + if(alertText2) + delete alertText2; + if(ttsChunks) + delete ttsChunks; + if(duration) + delete duration; + if(playTone) + delete playTone; +} + + +Alert_request::Alert_request(const Alert_request& c) +{ + *this=c; +} + + +bool Alert_request::checkIntegrity(void) +{ + return Alert_requestMarshaller::checkIntegrity(*this); +} + + +Alert_request::Alert_request(void) : SDLRPCRequest(PROTOCOL_VERSION,Marshaller::METHOD_ALERT_REQUEST), + alertText1(0), + alertText2(0), + ttsChunks(0), + duration(0), + playTone(0) +{ +} + + + +bool Alert_request::set_alertText1(const std::string& alertText1_) +{ + if(alertText1_.length()>500) return false; + delete alertText1; + alertText1=0; + + alertText1=new std::string(alertText1_); + return true; +} + +void Alert_request::reset_alertText1(void) +{ + if(alertText1) + delete alertText1; + alertText1=0; +} + +bool Alert_request::set_alertText2(const std::string& alertText2_) +{ + if(alertText2_.length()>500) return false; + delete alertText2; + alertText2=0; + + alertText2=new std::string(alertText2_); + return true; +} + +void Alert_request::reset_alertText2(void) +{ + if(alertText2) + delete alertText2; + alertText2=0; +} + +bool Alert_request::set_ttsChunks(const std::vector<TTSChunk>& ttsChunks_) +{ + unsigned int i=ttsChunks_.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!TTSChunkMarshaller::checkIntegrityConst(ttsChunks_[i])) return false; + } + delete ttsChunks; + ttsChunks=0; + + ttsChunks=new std::vector<TTSChunk>(ttsChunks_); + return true; +} + +void Alert_request::reset_ttsChunks(void) +{ + if(ttsChunks) + delete ttsChunks; + ttsChunks=0; +} + +bool Alert_request::set_duration(unsigned int duration_) +{ + if(duration_>10000) return false; + if(duration_<3000) return false; + delete duration; + duration=0; + + duration=new unsigned int(duration_); + return true; +} + +void Alert_request::reset_duration(void) +{ + if(duration) + delete duration; + duration=0; +} + +bool Alert_request::set_playTone(bool playTone_) +{ + delete playTone; + playTone=0; + + playTone=new bool(playTone_); + return true; +} + +void Alert_request::reset_playTone(void) +{ + if(playTone) + delete playTone; + playTone=0; +} + + + + +const std::string* Alert_request::get_alertText1(void) const +{ + return alertText1; +} + +const std::string* Alert_request::get_alertText2(void) const +{ + return alertText2; +} + +const std::vector<TTSChunk>* Alert_request::get_ttsChunks(void) const +{ + return ttsChunks; +} + +const unsigned int* Alert_request::get_duration(void) const +{ + return duration; +} + +const bool* Alert_request::get_playTone(void) const +{ + return playTone; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Alert_requestMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Alert_requestMarshaller.cpp new file mode 100644 index 000000000..96190c021 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Alert_requestMarshaller.cpp @@ -0,0 +1,217 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/Alert_request.h" +#include "TTSChunkMarshaller.h" + +#include "Alert_requestMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool Alert_requestMarshaller::checkIntegrity(Alert_request& s) +{ + return checkIntegrityConst(s); +} + + +bool Alert_requestMarshaller::fromString(const std::string& s,Alert_request& 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 Alert_requestMarshaller::toString(const Alert_request& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool Alert_requestMarshaller::checkIntegrityConst(const Alert_request& s) +{ + if(s.alertText1 && s.alertText1->length()>500) return false; + if(s.alertText2 && s.alertText2->length()>500) return false; + if(s.ttsChunks) + { + unsigned int i=s.ttsChunks[0].size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!TTSChunkMarshaller::checkIntegrityConst(s.ttsChunks[0][i])) return false; + } + } + if(s.duration && *s.duration>10000) return false; + if(s.duration && *s.duration<3000) return false; + return true; +} + +Json::Value Alert_requestMarshaller::toJSON(const Alert_request& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["request"]=Json::Value(Json::objectValue); + json["request"]["name"]=Json::Value("Alert"); + json["request"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + if(e.alertText1) + j["alertText1"]=Json::Value(*e.alertText1); + + if(e.alertText2) + j["alertText2"]=Json::Value(*e.alertText2); + + if(e.ttsChunks) + { + unsigned int sz=e.ttsChunks->size(); + j["ttsChunks"]=Json::Value(Json::arrayValue); + j["ttsChunks"].resize(sz); + for(unsigned int i=0;i<sz;i++) + j["ttsChunks"][i]=TTSChunkMarshaller::toJSON(e.ttsChunks[0][i]); + } + + if(e.duration) + j["duration"]=Json::Value(*e.duration); + + if(e.playTone) + j["playTone"]=Json::Value(*e.playTone); + + json["request"]["parameters"]=j; + return json; +} + + +bool Alert_requestMarshaller::fromJSON(const Json::Value& js,Alert_request& c) +{ + if(c.alertText1) delete c.alertText1; + c.alertText1=0; + + if(c.alertText2) delete c.alertText2; + c.alertText2=0; + + if(c.ttsChunks) delete c.ttsChunks; + c.ttsChunks=0; + + if(c.duration) delete c.duration; + c.duration=0; + + if(c.playTone) delete c.playTone; + c.playTone=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("request")) return false; + + if(!js["request"].isObject()) return false; + const Json::Value& j2=js["request"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("Alert")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(json.isMember("alertText1")) + { + const Json::Value& j=json["alertText1"]; + if(!j.isString()) return false; + c.alertText1=new std::string(j.asString()); + } + if(json.isMember("alertText2")) + { + const Json::Value& j=json["alertText2"]; + if(!j.isString()) return false; + c.alertText2=new std::string(j.asString()); + } + if(json.isMember("ttsChunks")) + { + const Json::Value& j=json["ttsChunks"]; + if(!j.isArray()) return false; + c.ttsChunks=new std::vector<TTSChunk>(); + c.ttsChunks->resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + { + TTSChunk t; + if(!TTSChunkMarshaller::fromJSON(j[i],t)) + return false; + c.ttsChunks[0][i]=t; + } + + } + if(json.isMember("duration")) + { + const Json::Value& j=json["duration"]; + if(!j.isInt()) return false; + c.duration=new unsigned int(j.asInt()); + } + if(json.isMember("playTone")) + { + const Json::Value& j=json["playTone"]; + if(!j.isBool()) return false; + c.playTone=new bool(j.asBool()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Alert_requestMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Alert_requestMarshaller.h new file mode 100644 index 000000000..5479976ea --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Alert_requestMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_ALERT_REQUESTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_ALERT_REQUESTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/Alert_request.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct Alert_requestMarshaller + { + static bool checkIntegrity(Alert_request& e); + static bool checkIntegrityConst(const Alert_request& e); + + static bool fromString(const std::string& s,Alert_request& e); + static const std::string toString(const Alert_request& e); + + static bool fromJSON(const Json::Value& s,Alert_request& e); + static Json::Value toJSON(const Alert_request& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Alert_response.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Alert_response.cpp new file mode 100644 index 000000000..8888fad26 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Alert_response.cpp @@ -0,0 +1,75 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/Alert_response.h" +#include "Alert_responseMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +Alert_response& Alert_response::operator =(const Alert_response& c) +{ + success = c.success; + resultCode = c.resultCode; + info = c.info ? new std::string(c.info[0]) : 0; + + return *this; +} + +Alert_response::~Alert_response(void) +{} + +Alert_response::Alert_response(const Alert_response& c) +{ + *this = c; +} + +bool Alert_response::checkIntegrity(void) +{ + return Alert_responseMarshaller::checkIntegrity(*this); +} + +Alert_response::Alert_response(void) : SDLRPCResponse(PROTOCOL_VERSION, Marshaller::METHOD_ALERT_RESPONSE) +{} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Alert_responseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Alert_responseMarshaller.cpp new file mode 100644 index 000000000..9d6abdf7a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Alert_responseMarshaller.cpp @@ -0,0 +1,161 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/Alert_response.h" +#include "ResultMarshaller.h" + +#include "Alert_responseMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool Alert_responseMarshaller::checkIntegrity(Alert_response& s) +{ + return checkIntegrityConst(s); +} + + +bool Alert_responseMarshaller::fromString(const std::string& s,Alert_response& 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 Alert_responseMarshaller::toString(const Alert_response& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool Alert_responseMarshaller::checkIntegrityConst(const Alert_response& s) +{ + if(!ResultMarshaller::checkIntegrityConst(static_cast<NsSmartDeviceLinkRPCV2::Result>(s.resultCode))) return false; + if(s.info && s.info->length()>1000) return false; + return true; +} + +Json::Value Alert_responseMarshaller::toJSON(const Alert_response& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["response"]=Json::Value(Json::objectValue); + json["response"]["name"]=Json::Value("Alert"); + json["response"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["success"]=Json::Value(e.success); + + j["resultCode"]=ResultMarshaller::toJSON(static_cast<NsSmartDeviceLinkRPCV2::Result>(e.resultCode)); + + if(e.info) + j["info"]=Json::Value(*e.info); + + json["response"]["parameters"]=j; + return json; +} + + +bool Alert_responseMarshaller::fromJSON(const Json::Value& js,Alert_response& c) +{ + if(c.info) delete c.info; + c.info=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("response")) return false; + + if(!js["response"].isObject()) return false; + const Json::Value& j2=js["response"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("Alert")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("success")) return false; + { + const Json::Value& j=json["success"]; + if(!j.isBool()) return false; + c.success=j.asBool(); + } + if(!json.isMember("resultCode")) return false; + { + const Json::Value& j=json["resultCode"]; + NsSmartDeviceLinkRPC::Result result = static_cast<NsSmartDeviceLinkRPC::Result>(c.resultCode); + if(!ResultMarshaller::fromJSON(j, result)) + return false; + c.resultCode = static_cast<NsSmartDeviceLinkRPCV2::Result>(result); + } + if(json.isMember("info")) + { + const Json::Value& j=json["info"]; + if(!j.isString()) return false; + c.info=new std::string(j.asString()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Alert_responseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Alert_responseMarshaller.h new file mode 100644 index 000000000..8be945c23 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Alert_responseMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_ALERT_RESPONSEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_ALERT_RESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/Alert_response.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct Alert_responseMarshaller + { + static bool checkIntegrity(Alert_response& e); + static bool checkIntegrityConst(const Alert_response& e); + + static bool fromString(const std::string& s,Alert_response& e); + static const std::string toString(const Alert_response& e); + + static bool fromJSON(const Json::Value& s,Alert_response& e); + static Json::Value toJSON(const Alert_response& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.cpp new file mode 100644 index 000000000..d72172a1a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.cpp @@ -0,0 +1,116 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/AppInterfaceUnregisteredReason.h" +#include "AppInterfaceUnregisteredReasonMarshaller.h" +#include "AppInterfaceUnregisteredReasonMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const AppInterfaceUnregisteredReason::AppInterfaceUnregisteredReasonInternal AppInterfaceUnregisteredReasonMarshaller::getIndex(const char* s) +{ + if(!s) + return AppInterfaceUnregisteredReason::INVALID_ENUM; + const struct PerfectHashTable* p=AppInterfaceUnregisteredReason_intHash::getPointer(s,strlen(s)); + return p ? static_cast<AppInterfaceUnregisteredReason::AppInterfaceUnregisteredReasonInternal>(p->idx) : AppInterfaceUnregisteredReason::INVALID_ENUM; +} + + +bool AppInterfaceUnregisteredReasonMarshaller::fromJSON(const Json::Value& s,AppInterfaceUnregisteredReason& e) +{ + e.mInternal=AppInterfaceUnregisteredReason::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=AppInterfaceUnregisteredReason::INVALID_ENUM); +} + + +Json::Value AppInterfaceUnregisteredReasonMarshaller::toJSON(const AppInterfaceUnregisteredReason& e) +{ + if(e.mInternal==AppInterfaceUnregisteredReason::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool AppInterfaceUnregisteredReasonMarshaller::fromString(const std::string& s,AppInterfaceUnregisteredReason& e) +{ + e.mInternal=AppInterfaceUnregisteredReason::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string AppInterfaceUnregisteredReasonMarshaller::toString(const AppInterfaceUnregisteredReason& e) +{ + Json::FastWriter writer; + return e.mInternal==AppInterfaceUnregisteredReason::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable AppInterfaceUnregisteredReasonMarshaller::mHashTable[10]= +{ + {"USER_EXIT",0}, + {"IGNITION_OFF",1}, + {"BLUETOOTH_OFF",2}, + {"USB_DISCONNECTED",3}, + {"REQUEST_WHILE_IN_NONE_HMI_LEVEL",4}, + {"TOO_MANY_REQUESTS",5}, + {"DRIVER_DISTRACTION_VIOLATION",6}, + {"LANGUAGE_CHANGE",7}, + {"MASTER_RESET",8}, + {"FACTORY_DEFAULTS",9} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.gp new file mode 100644 index 000000000..2f0c1d160 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.gp @@ -0,0 +1,26 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name AppInterfaceUnregisteredReason_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +USER_EXIT,0 +IGNITION_OFF,1 +BLUETOOTH_OFF,2 +USB_DISCONNECTED,3 +REQUEST_WHILE_IN_NONE_HMI_LEVEL,4 +TOO_MANY_REQUESTS,5 +DRIVER_DISTRACTION_VIOLATION,6 +LANGUAGE_CHANGE,7 +MASTER_RESET,8 +FACTORY_DEFAULTS,9 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.h new file mode 100644 index 000000000..ada5bbb86 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_APPINTERFACEUNREGISTEREDREASONMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_APPINTERFACEUNREGISTEREDREASONMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/AppInterfaceUnregisteredReason.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for AppInterfaceUnregisteredReason + + class AppInterfaceUnregisteredReasonMarshaller + { + public: + + static std::string toName(const AppInterfaceUnregisteredReason& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(AppInterfaceUnregisteredReason& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=AppInterfaceUnregisteredReason::INVALID_ENUM; + } + + static bool checkIntegrity(AppInterfaceUnregisteredReason& e) { return e.mInternal!=AppInterfaceUnregisteredReason::INVALID_ENUM; } + static bool checkIntegrityConst(const AppInterfaceUnregisteredReason& e) { return e.mInternal!=AppInterfaceUnregisteredReason::INVALID_ENUM; } + + static bool fromString(const std::string& s,AppInterfaceUnregisteredReason& e); + static const std::string toString(const AppInterfaceUnregisteredReason& e); + + static bool fromJSON(const Json::Value& s,AppInterfaceUnregisteredReason& e); + static Json::Value toJSON(const AppInterfaceUnregisteredReason& e); + + static const char* getName(AppInterfaceUnregisteredReason::AppInterfaceUnregisteredReasonInternal e) + { + return (e>=0 && e<10) ? mHashTable[e].name : NULL; + } + + static const AppInterfaceUnregisteredReason::AppInterfaceUnregisteredReasonInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[10]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.inc new file mode 100644 index 000000000..555530c25 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.inc @@ -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. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.gp */ +/* Computed positions: -k'1' */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." +#endif + + +#define TOTAL_KEYWORDS 10 +#define MIN_WORD_LENGTH 9 +#define MAX_WORD_LENGTH 31 +#define MIN_HASH_VALUE 9 +#define MAX_HASH_VALUE 31 +/* maximum key range = 23, duplicates = 0 */ + +namespace NsSmartDeviceLinkRPC { + +class AppInterfaceUnregisteredReason_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline unsigned int +AppInterfaceUnregisteredReason_intHash::hash (register const char *str, register unsigned int len) +{ + static const unsigned char asso_values[] = + { + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 0, 32, 0, 32, + 5, 32, 32, 10, 32, 32, 0, 0, 32, 32, + 32, 32, 0, 32, 0, 0, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32 + }; + return len + asso_values[(unsigned char)str[0]]; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +AppInterfaceUnregisteredReason_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 12, 13, + 0, 15, 16, 17, 0, 0, 0, 16, 12, 0, 0, 0, 0, 0, + 28, 0, 0, 31 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.gp" + {"USER_EXIT",0}, + {""}, {""}, +#line 25 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.gp" + {"MASTER_RESET",8}, +#line 19 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.gp" + {"BLUETOOTH_OFF",2}, + {""}, +#line 24 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.gp" + {"LANGUAGE_CHANGE",7}, +#line 20 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.gp" + {"USB_DISCONNECTED",3}, +#line 22 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.gp" + {"TOO_MANY_REQUESTS",5}, + {""}, {""}, {""}, +#line 26 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.gp" + {"FACTORY_DEFAULTS",9}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.gp" + {"IGNITION_OFF",1}, + {""}, {""}, {""}, {""}, {""}, +#line 23 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.gp" + {"DRIVER_DISTRACTION_VIOLATION",6}, + {""}, {""}, +#line 21 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AppInterfaceUnregisteredReasonMarshaller.gp" + {"REQUEST_WHILE_IN_NONE_HMI_LEVEL",4} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioCaptureQualityMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioCaptureQualityMarshaller.cpp new file mode 100644 index 000000000..f7fa2f7fb --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioCaptureQualityMarshaller.cpp @@ -0,0 +1,108 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/AudioCaptureQuality.h" +#include "AudioCaptureQualityMarshaller.h" +#include "AudioCaptureQualityMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const AudioCaptureQuality::AudioCaptureQualityInternal AudioCaptureQualityMarshaller::getIndex(const char* s) +{ + if(!s) + return AudioCaptureQuality::INVALID_ENUM; + const struct PerfectHashTable* p=AudioCaptureQuality_intHash::getPointer(s,strlen(s)); + return p ? static_cast<AudioCaptureQuality::AudioCaptureQualityInternal>(p->idx) : AudioCaptureQuality::INVALID_ENUM; +} + + +bool AudioCaptureQualityMarshaller::fromJSON(const Json::Value& s,AudioCaptureQuality& e) +{ + e.mInternal=AudioCaptureQuality::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=AudioCaptureQuality::INVALID_ENUM); +} + + +Json::Value AudioCaptureQualityMarshaller::toJSON(const AudioCaptureQuality& e) +{ + if(e.mInternal==AudioCaptureQuality::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool AudioCaptureQualityMarshaller::fromString(const std::string& s,AudioCaptureQuality& e) +{ + e.mInternal=AudioCaptureQuality::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string AudioCaptureQualityMarshaller::toString(const AudioCaptureQuality& e) +{ + Json::FastWriter writer; + return e.mInternal==AudioCaptureQuality::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable AudioCaptureQualityMarshaller::mHashTable[2]= +{ + {"8KHZ",0}, + {"16KHZ",1} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioCaptureQualityMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioCaptureQualityMarshaller.gp new file mode 100644 index 000000000..d0d094502 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioCaptureQualityMarshaller.gp @@ -0,0 +1,18 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name AudioCaptureQuality_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +8KHZ,0 +16KHZ,1 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioCaptureQualityMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioCaptureQualityMarshaller.h new file mode 100644 index 000000000..c5f12dacb --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioCaptureQualityMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_AUDIOCAPTUREQUALITYMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_AUDIOCAPTUREQUALITYMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/AudioCaptureQuality.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for AudioCaptureQuality + + class AudioCaptureQualityMarshaller + { + public: + + static std::string toName(const AudioCaptureQuality& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(AudioCaptureQuality& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=AudioCaptureQuality::INVALID_ENUM; + } + + static bool checkIntegrity(AudioCaptureQuality& e) { return e.mInternal!=AudioCaptureQuality::INVALID_ENUM; } + static bool checkIntegrityConst(const AudioCaptureQuality& e) { return e.mInternal!=AudioCaptureQuality::INVALID_ENUM; } + + static bool fromString(const std::string& s,AudioCaptureQuality& e); + static const std::string toString(const AudioCaptureQuality& e); + + static bool fromJSON(const Json::Value& s,AudioCaptureQuality& e); + static Json::Value toJSON(const AudioCaptureQuality& e); + + static const char* getName(AudioCaptureQuality::AudioCaptureQualityInternal e) + { + return (e>=0 && e<2) ? mHashTable[e].name : NULL; + } + + static const AudioCaptureQuality::AudioCaptureQualityInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[2]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioCaptureQualityMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioCaptureQualityMarshaller.inc new file mode 100644 index 000000000..c3d8a7c33 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioCaptureQualityMarshaller.inc @@ -0,0 +1,90 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioCaptureQualityMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioCaptureQualityMarshaller.gp */ +/* Computed positions: -k'' */ + + +#define TOTAL_KEYWORDS 2 +#define MIN_WORD_LENGTH 4 +#define MAX_WORD_LENGTH 5 +#define MIN_HASH_VALUE 4 +#define MAX_HASH_VALUE 5 +/* maximum key range = 2, duplicates = 0 */ + +class AudioCaptureQuality_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline /*ARGSUSED*/ +unsigned int +AudioCaptureQuality_intHash::hash (register const char *str, register unsigned int len) +{ + return len; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +AudioCaptureQuality_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 4, 5 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioCaptureQualityMarshaller.gp" + {"8KHZ",0}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioCaptureQualityMarshaller.gp" + {"16KHZ",1} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioStreamingStateMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioStreamingStateMarshaller.cpp new file mode 100644 index 000000000..8c9b4f09c --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioStreamingStateMarshaller.cpp @@ -0,0 +1,108 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/AudioStreamingState.h" +#include "AudioStreamingStateMarshaller.h" +#include "AudioStreamingStateMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const AudioStreamingState::AudioStreamingStateInternal AudioStreamingStateMarshaller::getIndex(const char* s) +{ + if(!s) + return AudioStreamingState::INVALID_ENUM; + const struct PerfectHashTable* p=AudioStreamingState_intHash::getPointer(s,strlen(s)); + return p ? static_cast<AudioStreamingState::AudioStreamingStateInternal>(p->idx) : AudioStreamingState::INVALID_ENUM; +} + + +bool AudioStreamingStateMarshaller::fromJSON(const Json::Value& s,AudioStreamingState& e) +{ + e.mInternal=AudioStreamingState::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=AudioStreamingState::INVALID_ENUM); +} + + +Json::Value AudioStreamingStateMarshaller::toJSON(const AudioStreamingState& e) +{ + if(e.mInternal==AudioStreamingState::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool AudioStreamingStateMarshaller::fromString(const std::string& s,AudioStreamingState& e) +{ + e.mInternal=AudioStreamingState::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string AudioStreamingStateMarshaller::toString(const AudioStreamingState& e) +{ + Json::FastWriter writer; + return e.mInternal==AudioStreamingState::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable AudioStreamingStateMarshaller::mHashTable[2]= +{ + {"AUDIBLE",0}, + {"NOT_AUDIBLE",1} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioStreamingStateMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioStreamingStateMarshaller.gp new file mode 100644 index 000000000..233ca9401 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioStreamingStateMarshaller.gp @@ -0,0 +1,18 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name AudioStreamingState_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +AUDIBLE,0 +NOT_AUDIBLE,1 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioStreamingStateMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioStreamingStateMarshaller.h new file mode 100644 index 000000000..62c7e6b31 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioStreamingStateMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_AUDIOSTREAMINGSTATEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_AUDIOSTREAMINGSTATEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/AudioStreamingState.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for AudioStreamingState + + class AudioStreamingStateMarshaller + { + public: + + static std::string toName(const AudioStreamingState& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(AudioStreamingState& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=AudioStreamingState::INVALID_ENUM; + } + + static bool checkIntegrity(AudioStreamingState& e) { return e.mInternal!=AudioStreamingState::INVALID_ENUM; } + static bool checkIntegrityConst(const AudioStreamingState& e) { return e.mInternal!=AudioStreamingState::INVALID_ENUM; } + + static bool fromString(const std::string& s,AudioStreamingState& e); + static const std::string toString(const AudioStreamingState& e); + + static bool fromJSON(const Json::Value& s,AudioStreamingState& e); + static Json::Value toJSON(const AudioStreamingState& e); + + static const char* getName(AudioStreamingState::AudioStreamingStateInternal e) + { + return (e>=0 && e<2) ? mHashTable[e].name : NULL; + } + + static const AudioStreamingState::AudioStreamingStateInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[2]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioStreamingStateMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioStreamingStateMarshaller.inc new file mode 100644 index 000000000..232669a7f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioStreamingStateMarshaller.inc @@ -0,0 +1,91 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioStreamingStateMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioStreamingStateMarshaller.gp */ +/* Computed positions: -k'' */ + + +#define TOTAL_KEYWORDS 2 +#define MIN_WORD_LENGTH 7 +#define MAX_WORD_LENGTH 11 +#define MIN_HASH_VALUE 7 +#define MAX_HASH_VALUE 11 +/* maximum key range = 5, duplicates = 0 */ + +class AudioStreamingState_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline /*ARGSUSED*/ +unsigned int +AudioStreamingState_intHash::hash (register const char *str, register unsigned int len) +{ + return len; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +AudioStreamingState_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 11 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioStreamingStateMarshaller.gp" + {"AUDIBLE",0}, + {""}, {""}, {""}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/AudioStreamingStateMarshaller.gp" + {"NOT_AUDIBLE",1} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonCapabilities.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonCapabilities.cpp new file mode 100644 index 000000000..a31417866 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonCapabilities.cpp @@ -0,0 +1,118 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/ButtonCapabilities.h" +#include "ButtonCapabilitiesMarshaller.h" +#include "ButtonNameMarshaller.h" +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + + + +using namespace NsSmartDeviceLinkRPC; + +ButtonCapabilities::ButtonCapabilities(const ButtonCapabilities& c) +{ + *this=c; +} + + +bool ButtonCapabilities::checkIntegrity(void) +{ + return ButtonCapabilitiesMarshaller::checkIntegrity(*this); +} + + +ButtonCapabilities::ButtonCapabilities(void) +{ +} + + + +bool ButtonCapabilities::set_longPressAvailable(bool longPressAvailable_) +{ + longPressAvailable=longPressAvailable_; + return true; +} + +bool ButtonCapabilities::set_name(const ButtonName& name_) +{ + if(!ButtonNameMarshaller::checkIntegrityConst(name_)) return false; + name=name_; + return true; +} + +bool ButtonCapabilities::set_shortPressAvailable(bool shortPressAvailable_) +{ + shortPressAvailable=shortPressAvailable_; + return true; +} + +bool ButtonCapabilities::set_upDownAvailable(bool upDownAvailable_) +{ + upDownAvailable=upDownAvailable_; + return true; +} + + + + +bool ButtonCapabilities::get_longPressAvailable(void) const +{ + return longPressAvailable; +} + + +const ButtonName& ButtonCapabilities::get_name(void) const +{ + return name; +} + + +bool ButtonCapabilities::get_shortPressAvailable(void) const +{ + return shortPressAvailable; +} + + +bool ButtonCapabilities::get_upDownAvailable(void) const +{ + return upDownAvailable; +} + + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonCapabilitiesMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonCapabilitiesMarshaller.cpp new file mode 100644 index 000000000..1c72e6b25 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonCapabilitiesMarshaller.cpp @@ -0,0 +1,144 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/ButtonCapabilities.h" +#include "ButtonNameMarshaller.h" + +#include "ButtonCapabilitiesMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool ButtonCapabilitiesMarshaller::checkIntegrity(ButtonCapabilities& s) +{ + return checkIntegrityConst(s); +} + + +bool ButtonCapabilitiesMarshaller::fromString(const std::string& s,ButtonCapabilities& 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 ButtonCapabilitiesMarshaller::toString(const ButtonCapabilities& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool ButtonCapabilitiesMarshaller::checkIntegrityConst(const ButtonCapabilities& s) +{ + if(!ButtonNameMarshaller::checkIntegrityConst(s.name)) return false; + return true; +} + +Json::Value ButtonCapabilitiesMarshaller::toJSON(const ButtonCapabilities& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["longPressAvailable"]=Json::Value(e.longPressAvailable); + + json["name"]=ButtonNameMarshaller::toJSON(e.name); + + json["shortPressAvailable"]=Json::Value(e.shortPressAvailable); + + json["upDownAvailable"]=Json::Value(e.upDownAvailable); + + + return json; +} + + +bool ButtonCapabilitiesMarshaller::fromJSON(const Json::Value& json,ButtonCapabilities& c) +{ + try + { + if(!json.isObject()) return false; + + if(!json.isMember("longPressAvailable")) return false; + { + const Json::Value& j=json["longPressAvailable"]; + if(!j.isBool()) return false; + c.longPressAvailable=j.asBool(); + } + if(!json.isMember("name")) return false; + { + const Json::Value& j=json["name"]; + if(!ButtonNameMarshaller::fromJSON(j,c.name)) + return false; + } + if(!json.isMember("shortPressAvailable")) return false; + { + const Json::Value& j=json["shortPressAvailable"]; + if(!j.isBool()) return false; + c.shortPressAvailable=j.asBool(); + } + if(!json.isMember("upDownAvailable")) return false; + { + const Json::Value& j=json["upDownAvailable"]; + if(!j.isBool()) return false; + c.upDownAvailable=j.asBool(); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonCapabilitiesMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonCapabilitiesMarshaller.h new file mode 100644 index 000000000..9a01a8177 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonCapabilitiesMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_BUTTONCAPABILITIESMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_BUTTONCAPABILITIESMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/ButtonCapabilities.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct ButtonCapabilitiesMarshaller + { + static bool checkIntegrity(ButtonCapabilities& e); + static bool checkIntegrityConst(const ButtonCapabilities& e); + + static bool fromString(const std::string& s,ButtonCapabilities& e); + static const std::string toString(const ButtonCapabilities& e); + + static bool fromJSON(const Json::Value& s,ButtonCapabilities& e); + static Json::Value toJSON(const ButtonCapabilities& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonEventModeMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonEventModeMarshaller.cpp new file mode 100644 index 000000000..2074e960b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonEventModeMarshaller.cpp @@ -0,0 +1,108 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/ButtonEventMode.h" +#include "ButtonEventModeMarshaller.h" +#include "ButtonEventModeMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const ButtonEventMode::ButtonEventModeInternal ButtonEventModeMarshaller::getIndex(const char* s) +{ + if(!s) + return ButtonEventMode::INVALID_ENUM; + const struct PerfectHashTable* p=ButtonEventMode_intHash::getPointer(s,strlen(s)); + return p ? static_cast<ButtonEventMode::ButtonEventModeInternal>(p->idx) : ButtonEventMode::INVALID_ENUM; +} + + +bool ButtonEventModeMarshaller::fromJSON(const Json::Value& s,ButtonEventMode& e) +{ + e.mInternal=ButtonEventMode::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=ButtonEventMode::INVALID_ENUM); +} + + +Json::Value ButtonEventModeMarshaller::toJSON(const ButtonEventMode& e) +{ + if(e.mInternal==ButtonEventMode::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool ButtonEventModeMarshaller::fromString(const std::string& s,ButtonEventMode& e) +{ + e.mInternal=ButtonEventMode::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string ButtonEventModeMarshaller::toString(const ButtonEventMode& e) +{ + Json::FastWriter writer; + return e.mInternal==ButtonEventMode::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable ButtonEventModeMarshaller::mHashTable[2]= +{ + {"BUTTONUP",0}, + {"BUTTONDOWN",1} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonEventModeMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonEventModeMarshaller.gp new file mode 100644 index 000000000..b9f1d7d57 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonEventModeMarshaller.gp @@ -0,0 +1,18 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name ButtonEventMode_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +BUTTONUP,0 +BUTTONDOWN,1 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonEventModeMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonEventModeMarshaller.h new file mode 100644 index 000000000..011c59fa3 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonEventModeMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_BUTTONEVENTMODEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_BUTTONEVENTMODEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/ButtonEventMode.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for ButtonEventMode + + class ButtonEventModeMarshaller + { + public: + + static std::string toName(const ButtonEventMode& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(ButtonEventMode& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=ButtonEventMode::INVALID_ENUM; + } + + static bool checkIntegrity(ButtonEventMode& e) { return e.mInternal!=ButtonEventMode::INVALID_ENUM; } + static bool checkIntegrityConst(const ButtonEventMode& e) { return e.mInternal!=ButtonEventMode::INVALID_ENUM; } + + static bool fromString(const std::string& s,ButtonEventMode& e); + static const std::string toString(const ButtonEventMode& e); + + static bool fromJSON(const Json::Value& s,ButtonEventMode& e); + static Json::Value toJSON(const ButtonEventMode& e); + + static const char* getName(ButtonEventMode::ButtonEventModeInternal e) + { + return (e>=0 && e<2) ? mHashTable[e].name : NULL; + } + + static const ButtonEventMode::ButtonEventModeInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[2]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonEventModeMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonEventModeMarshaller.inc new file mode 100644 index 000000000..8b9045d59 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonEventModeMarshaller.inc @@ -0,0 +1,91 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonEventModeMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonEventModeMarshaller.gp */ +/* Computed positions: -k'' */ + + +#define TOTAL_KEYWORDS 2 +#define MIN_WORD_LENGTH 8 +#define MAX_WORD_LENGTH 10 +#define MIN_HASH_VALUE 8 +#define MAX_HASH_VALUE 10 +/* maximum key range = 3, duplicates = 0 */ + +class ButtonEventMode_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline /*ARGSUSED*/ +unsigned int +ButtonEventMode_intHash::hash (register const char *str, register unsigned int len) +{ + return len; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +ButtonEventMode_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 10 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonEventModeMarshaller.gp" + {"BUTTONUP",0}, + {""}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonEventModeMarshaller.gp" + {"BUTTONDOWN",1} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.cpp new file mode 100644 index 000000000..4fc06ce7e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.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 <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/ButtonName.h" +#include "ButtonNameMarshaller.h" +#include "ButtonNameMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const ButtonName::ButtonNameInternal ButtonNameMarshaller::getIndex(const char* s) +{ + if(!s) + return ButtonName::INVALID_ENUM; + const struct PerfectHashTable* p=ButtonName_intHash::getPointer(s,strlen(s)); + return p ? static_cast<ButtonName::ButtonNameInternal>(p->idx) : ButtonName::INVALID_ENUM; +} + + +bool ButtonNameMarshaller::fromJSON(const Json::Value& s,ButtonName& e) +{ + e.mInternal=ButtonName::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=ButtonName::INVALID_ENUM); +} + + +Json::Value ButtonNameMarshaller::toJSON(const ButtonName& e) +{ + if(e.mInternal==ButtonName::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool ButtonNameMarshaller::fromString(const std::string& s,ButtonName& e) +{ + e.mInternal=ButtonName::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string ButtonNameMarshaller::toString(const ButtonName& e) +{ + Json::FastWriter writer; + return e.mInternal==ButtonName::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable ButtonNameMarshaller::mHashTable[15]= +{ + {"OK",0}, + {"SEEKLEFT",1}, + {"SEEKRIGHT",2}, + {"TUNEUP",3}, + {"TUNEDOWN",4}, + {"PRESET_0",5}, + {"PRESET_1",6}, + {"PRESET_2",7}, + {"PRESET_3",8}, + {"PRESET_4",9}, + {"PRESET_5",10}, + {"PRESET_6",11}, + {"PRESET_7",12}, + {"PRESET_8",13}, + {"PRESET_9",14} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.gp new file mode 100644 index 000000000..a7c5a08b0 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.gp @@ -0,0 +1,31 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name ButtonName_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +OK,0 +SEEKLEFT,1 +SEEKRIGHT,2 +TUNEUP,3 +TUNEDOWN,4 +PRESET_0,5 +PRESET_1,6 +PRESET_2,7 +PRESET_3,8 +PRESET_4,9 +PRESET_5,10 +PRESET_6,11 +PRESET_7,12 +PRESET_8,13 +PRESET_9,14 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.h new file mode 100644 index 000000000..25cdcfc96 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_BUTTONNAMEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_BUTTONNAMEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/ButtonName.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for ButtonName + + class ButtonNameMarshaller + { + public: + + static std::string toName(const ButtonName& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(ButtonName& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=ButtonName::INVALID_ENUM; + } + + static bool checkIntegrity(ButtonName& e) { return e.mInternal!=ButtonName::INVALID_ENUM; } + static bool checkIntegrityConst(const ButtonName& e) { return e.mInternal!=ButtonName::INVALID_ENUM; } + + static bool fromString(const std::string& s,ButtonName& e); + static const std::string toString(const ButtonName& e); + + static bool fromJSON(const Json::Value& s,ButtonName& e); + static Json::Value toJSON(const ButtonName& e); + + static const char* getName(ButtonName::ButtonNameInternal e) + { + return (e>=0 && e<15) ? mHashTable[e].name : NULL; + } + + static const ButtonName::ButtonNameInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[15]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.inc new file mode 100644 index 000000000..307db7040 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.inc @@ -0,0 +1,191 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.gp */ +/* Computed positions: -k'8' */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." +#endif + + +#define TOTAL_KEYWORDS 15 +#define MIN_WORD_LENGTH 2 +#define MAX_WORD_LENGTH 9 +#define MIN_HASH_VALUE 2 +#define MAX_HASH_VALUE 23 +/* maximum key range = 22, duplicates = 0 */ + +class ButtonName_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline unsigned int +ButtonName_intHash::hash (register const char *str, register unsigned int len) +{ + static const unsigned char asso_values[] = + { + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 7, 2, + 13, 8, 3, 14, 9, 4, 15, 10, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 0, 24, 24, 24, 24, 24, 5, 24, + 24, 24, 24, 24, 0, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24 + }; + register int hval = len; + + switch (hval) + { + default: + hval += asso_values[(unsigned char)str[7]]; + /*FALLTHROUGH*/ + case 7: + case 6: + case 5: + case 4: + case 3: + case 2: + break; + } + return hval; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +ButtonName_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 2, 0, 0, 0, 6, 0, 8, 9, 8, 8, 8, 8, + 0, 8, 8, 8, 8, 0, 0, 8, 8, 8 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.gp" + {"OK",0}, + {""}, {""}, {""}, +#line 20 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.gp" + {"TUNEUP",3}, + {""}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.gp" + {"SEEKLEFT",1}, +#line 19 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.gp" + {"SEEKRIGHT",2}, +#line 23 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.gp" + {"PRESET_1",6}, +#line 26 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.gp" + {"PRESET_4",9}, +#line 29 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.gp" + {"PRESET_7",12}, +#line 21 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.gp" + {"TUNEDOWN",4}, + {""}, +#line 22 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.gp" + {"PRESET_0",5}, +#line 25 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.gp" + {"PRESET_3",8}, +#line 28 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.gp" + {"PRESET_6",11}, +#line 31 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.gp" + {"PRESET_9",14}, + {""}, {""}, +#line 24 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.gp" + {"PRESET_2",7}, +#line 27 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.gp" + {"PRESET_5",10}, +#line 30 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonNameMarshaller.gp" + {"PRESET_8",13} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonPressModeMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonPressModeMarshaller.cpp new file mode 100644 index 000000000..d4a55c0a1 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonPressModeMarshaller.cpp @@ -0,0 +1,108 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/ButtonPressMode.h" +#include "ButtonPressModeMarshaller.h" +#include "ButtonPressModeMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const ButtonPressMode::ButtonPressModeInternal ButtonPressModeMarshaller::getIndex(const char* s) +{ + if(!s) + return ButtonPressMode::INVALID_ENUM; + const struct PerfectHashTable* p=ButtonPressMode_intHash::getPointer(s,strlen(s)); + return p ? static_cast<ButtonPressMode::ButtonPressModeInternal>(p->idx) : ButtonPressMode::INVALID_ENUM; +} + + +bool ButtonPressModeMarshaller::fromJSON(const Json::Value& s,ButtonPressMode& e) +{ + e.mInternal=ButtonPressMode::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=ButtonPressMode::INVALID_ENUM); +} + + +Json::Value ButtonPressModeMarshaller::toJSON(const ButtonPressMode& e) +{ + if(e.mInternal==ButtonPressMode::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool ButtonPressModeMarshaller::fromString(const std::string& s,ButtonPressMode& e) +{ + e.mInternal=ButtonPressMode::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string ButtonPressModeMarshaller::toString(const ButtonPressMode& e) +{ + Json::FastWriter writer; + return e.mInternal==ButtonPressMode::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable ButtonPressModeMarshaller::mHashTable[2]= +{ + {"LONG",0}, + {"SHORT",1} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonPressModeMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonPressModeMarshaller.gp new file mode 100644 index 000000000..e6482dc86 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonPressModeMarshaller.gp @@ -0,0 +1,18 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name ButtonPressMode_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +LONG,0 +SHORT,1 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonPressModeMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonPressModeMarshaller.h new file mode 100644 index 000000000..ce359e9e0 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonPressModeMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_BUTTONPRESSMODEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_BUTTONPRESSMODEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/ButtonPressMode.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for ButtonPressMode + + class ButtonPressModeMarshaller + { + public: + + static std::string toName(const ButtonPressMode& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(ButtonPressMode& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=ButtonPressMode::INVALID_ENUM; + } + + static bool checkIntegrity(ButtonPressMode& e) { return e.mInternal!=ButtonPressMode::INVALID_ENUM; } + static bool checkIntegrityConst(const ButtonPressMode& e) { return e.mInternal!=ButtonPressMode::INVALID_ENUM; } + + static bool fromString(const std::string& s,ButtonPressMode& e); + static const std::string toString(const ButtonPressMode& e); + + static bool fromJSON(const Json::Value& s,ButtonPressMode& e); + static Json::Value toJSON(const ButtonPressMode& e); + + static const char* getName(ButtonPressMode::ButtonPressModeInternal e) + { + return (e>=0 && e<2) ? mHashTable[e].name : NULL; + } + + static const ButtonPressMode::ButtonPressModeInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[2]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonPressModeMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonPressModeMarshaller.inc new file mode 100644 index 000000000..ff3313482 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonPressModeMarshaller.inc @@ -0,0 +1,90 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonPressModeMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonPressModeMarshaller.gp */ +/* Computed positions: -k'' */ + + +#define TOTAL_KEYWORDS 2 +#define MIN_WORD_LENGTH 4 +#define MAX_WORD_LENGTH 5 +#define MIN_HASH_VALUE 4 +#define MAX_HASH_VALUE 5 +/* maximum key range = 2, duplicates = 0 */ + +class ButtonPressMode_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline /*ARGSUSED*/ +unsigned int +ButtonPressMode_intHash::hash (register const char *str, register unsigned int len) +{ + return len; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +ButtonPressMode_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 4, 5 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonPressModeMarshaller.gp" + {"LONG",0}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ButtonPressModeMarshaller.gp" + {"SHORT",1} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CharacterSetMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CharacterSetMarshaller.cpp new file mode 100644 index 000000000..186640026 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CharacterSetMarshaller.cpp @@ -0,0 +1,110 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/CharacterSet.h" +#include "CharacterSetMarshaller.h" +#include "CharacterSetMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const CharacterSet::CharacterSetInternal CharacterSetMarshaller::getIndex(const char* s) +{ + if(!s) + return CharacterSet::INVALID_ENUM; + const struct PerfectHashTable* p=CharacterSet_intHash::getPointer(s,strlen(s)); + return p ? static_cast<CharacterSet::CharacterSetInternal>(p->idx) : CharacterSet::INVALID_ENUM; +} + + +bool CharacterSetMarshaller::fromJSON(const Json::Value& s,CharacterSet& e) +{ + e.mInternal=CharacterSet::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=CharacterSet::INVALID_ENUM); +} + + +Json::Value CharacterSetMarshaller::toJSON(const CharacterSet& e) +{ + if(e.mInternal==CharacterSet::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool CharacterSetMarshaller::fromString(const std::string& s,CharacterSet& e) +{ + e.mInternal=CharacterSet::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string CharacterSetMarshaller::toString(const CharacterSet& e) +{ + Json::FastWriter writer; + return e.mInternal==CharacterSet::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable CharacterSetMarshaller::mHashTable[4]= +{ + {"TYPE2SET",0}, + {"TYPE5SET",1}, + {"CID1SET",2}, + {"CID2SET",3} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CharacterSetMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CharacterSetMarshaller.gp new file mode 100644 index 000000000..f39607ce7 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CharacterSetMarshaller.gp @@ -0,0 +1,20 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name CharacterSet_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +TYPE2SET,0 +TYPE5SET,1 +CID1SET,2 +CID2SET,3 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CharacterSetMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CharacterSetMarshaller.h new file mode 100644 index 000000000..61d453051 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CharacterSetMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_CHARACTERSETMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_CHARACTERSETMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/CharacterSet.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for CharacterSet + + class CharacterSetMarshaller + { + public: + + static std::string toName(const CharacterSet& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(CharacterSet& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=CharacterSet::INVALID_ENUM; + } + + static bool checkIntegrity(CharacterSet& e) { return e.mInternal!=CharacterSet::INVALID_ENUM; } + static bool checkIntegrityConst(const CharacterSet& e) { return e.mInternal!=CharacterSet::INVALID_ENUM; } + + static bool fromString(const std::string& s,CharacterSet& e); + static const std::string toString(const CharacterSet& e); + + static bool fromJSON(const Json::Value& s,CharacterSet& e); + static Json::Value toJSON(const CharacterSet& e); + + static const char* getName(CharacterSet::CharacterSetInternal e) + { + return (e>=0 && e<4) ? mHashTable[e].name : NULL; + } + + static const CharacterSet::CharacterSetInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[4]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CharacterSetMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CharacterSetMarshaller.inc new file mode 100644 index 000000000..09970013a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CharacterSetMarshaller.inc @@ -0,0 +1,150 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CharacterSetMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CharacterSetMarshaller.gp */ +/* Computed positions: -k'4-5' */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." +#endif + + +#define TOTAL_KEYWORDS 4 +#define MIN_WORD_LENGTH 7 +#define MAX_WORD_LENGTH 8 +#define MIN_HASH_VALUE 7 +#define MAX_HASH_VALUE 13 +/* maximum key range = 7, duplicates = 0 */ + +class CharacterSet_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline unsigned int +CharacterSet_intHash::hash (register const char *str, register unsigned int len) +{ + static const unsigned char asso_values[] = + { + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, + 5, 14, 14, 0, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14 + }; + return len + asso_values[(unsigned char)str[4]] + asso_values[(unsigned char)str[3]]; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +CharacterSet_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 0, 7, 8 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 19 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CharacterSetMarshaller.gp" + {"CID1SET",2}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CharacterSetMarshaller.gp" + {"TYPE5SET",1}, + {""}, {""}, {""}, +#line 20 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CharacterSetMarshaller.gp" + {"CID2SET",3}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CharacterSetMarshaller.gp" + {"TYPE2SET",0} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Choice.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Choice.cpp new file mode 100644 index 000000000..6063c44f8 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Choice.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/SDLRPCObjects/V1/Choice.h" +#include "ChoiceMarshaller.h" + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + + + +using namespace NsSmartDeviceLinkRPC; + +Choice::Choice(const Choice& c) +{ + *this=c; +} + + +bool Choice::checkIntegrity(void) +{ + return ChoiceMarshaller::checkIntegrity(*this); +} + + +Choice::Choice(void) +{ +} + + + +bool Choice::set_choiceID(unsigned int choiceID_) +{ + if(choiceID_>65535) return false; + choiceID=choiceID_; + return true; +} + +bool Choice::set_menuName(const std::string& menuName_) +{ + if(menuName_.length()>500) return false; + menuName=menuName_; + return true; +} + +bool Choice::set_vrCommands(const std::vector<std::string>& vrCommands_) +{ + unsigned int i=vrCommands_.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(vrCommands_[i].length()>99) return false; + } + vrCommands=vrCommands_; + return true; +} + + + + +unsigned int Choice::get_choiceID(void) const +{ + return choiceID; +} + + +const std::string& Choice::get_menuName(void) const +{ + return menuName; +} + + +const std::vector<std::string>& Choice::get_vrCommands(void) const +{ + return vrCommands; +} + + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ChoiceMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ChoiceMarshaller.cpp new file mode 100644 index 000000000..1970e06b8 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ChoiceMarshaller.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 "../include/JSONHandler/SDLRPCObjects/V1/Choice.h" + + +#include "ChoiceMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool ChoiceMarshaller::checkIntegrity(Choice& s) +{ + return checkIntegrityConst(s); +} + + +bool ChoiceMarshaller::fromString(const std::string& s,Choice& 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 ChoiceMarshaller::toString(const Choice& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool ChoiceMarshaller::checkIntegrityConst(const Choice& s) +{ + if(s.choiceID>65535) return false; + if(s.menuName.length()>500) return false; + { + unsigned int i=s.vrCommands.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(s.vrCommands[i].length()>99) return false; + } + } + return true; +} + +Json::Value ChoiceMarshaller::toJSON(const Choice& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["choiceID"]=Json::Value(e.choiceID); + + json["menuName"]=Json::Value(e.menuName); + + json["vrCommands"]=Json::Value(Json::arrayValue); + json["vrCommands"].resize(e.vrCommands.size()); + for(unsigned int i=0;i<e.vrCommands.size();i++) + json["vrCommands"][i]=Json::Value(e.vrCommands[i]); + + + return json; +} + + +bool ChoiceMarshaller::fromJSON(const Json::Value& json,Choice& c) +{ + try + { + if(!json.isObject()) return false; + + if(!json.isMember("choiceID")) return false; + { + const Json::Value& j=json["choiceID"]; + if(!j.isInt()) return false; + c.choiceID=j.asInt(); + } + if(!json.isMember("menuName")) return false; + { + const Json::Value& j=json["menuName"]; + if(!j.isString()) return false; + c.menuName=j.asString(); + } + if(!json.isMember("vrCommands")) return false; + { + const Json::Value& j=json["vrCommands"]; + if(!j.isArray()) return false; + c.vrCommands.resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + if(!j[i].isString()) + return false; + else + c.vrCommands[i]=j[i].asString(); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ChoiceMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ChoiceMarshaller.h new file mode 100644 index 000000000..89332849e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ChoiceMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_CHOICEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_CHOICEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/Choice.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct ChoiceMarshaller + { + static bool checkIntegrity(Choice& e); + static bool checkIntegrityConst(const Choice& e); + + static bool fromString(const std::string& s,Choice& e); + static const std::string toString(const Choice& e); + + static bool fromJSON(const Json::Value& s,Choice& e); + static Json::Value toJSON(const Choice& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CreateInteractionChoiceSet_request.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CreateInteractionChoiceSet_request.cpp new file mode 100644 index 000000000..2dbffb617 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CreateInteractionChoiceSet_request.cpp @@ -0,0 +1,106 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/CreateInteractionChoiceSet_request.h" +#include "CreateInteractionChoiceSet_requestMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "ChoiceMarshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + +CreateInteractionChoiceSet_request::~CreateInteractionChoiceSet_request(void) +{ +} + + +CreateInteractionChoiceSet_request::CreateInteractionChoiceSet_request(const CreateInteractionChoiceSet_request& c) +{ + *this=c; +} + + +bool CreateInteractionChoiceSet_request::checkIntegrity(void) +{ + return CreateInteractionChoiceSet_requestMarshaller::checkIntegrity(*this); +} + + +CreateInteractionChoiceSet_request::CreateInteractionChoiceSet_request(void) : SDLRPCRequest(PROTOCOL_VERSION,Marshaller::METHOD_CREATEINTERACTIONCHOICESET_REQUEST) +{ +} + + + +bool CreateInteractionChoiceSet_request::set_interactionChoiceSetID(unsigned int interactionChoiceSetID_) +{ + if(interactionChoiceSetID_>2000000000) return false; + interactionChoiceSetID=interactionChoiceSetID_; + return true; +} + +bool CreateInteractionChoiceSet_request::set_choiceSet(const std::vector<Choice>& choiceSet_) +{ + unsigned int i=choiceSet_.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!ChoiceMarshaller::checkIntegrityConst(choiceSet_[i])) return false; + } + choiceSet=choiceSet_; + return true; +} + + + + +unsigned int CreateInteractionChoiceSet_request::get_interactionChoiceSetID(void) const +{ + return interactionChoiceSetID; +} + +const std::vector<Choice>& CreateInteractionChoiceSet_request::get_choiceSet(void) const +{ + return choiceSet; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CreateInteractionChoiceSet_requestMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CreateInteractionChoiceSet_requestMarshaller.cpp new file mode 100644 index 000000000..85f551daf --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CreateInteractionChoiceSet_requestMarshaller.cpp @@ -0,0 +1,165 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/CreateInteractionChoiceSet_request.h" +#include "ChoiceMarshaller.h" + +#include "CreateInteractionChoiceSet_requestMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool CreateInteractionChoiceSet_requestMarshaller::checkIntegrity(CreateInteractionChoiceSet_request& s) +{ + return checkIntegrityConst(s); +} + + +bool CreateInteractionChoiceSet_requestMarshaller::fromString(const std::string& s,CreateInteractionChoiceSet_request& 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 CreateInteractionChoiceSet_requestMarshaller::toString(const CreateInteractionChoiceSet_request& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool CreateInteractionChoiceSet_requestMarshaller::checkIntegrityConst(const CreateInteractionChoiceSet_request& s) +{ + if(s.interactionChoiceSetID>2000000000) return false; + { + unsigned int i=s.choiceSet.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!ChoiceMarshaller::checkIntegrityConst(s.choiceSet[i])) return false; + } + } + return true; +} + +Json::Value CreateInteractionChoiceSet_requestMarshaller::toJSON(const CreateInteractionChoiceSet_request& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["request"]=Json::Value(Json::objectValue); + json["request"]["name"]=Json::Value("CreateInteractionChoiceSet"); + json["request"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["interactionChoiceSetID"]=Json::Value(e.interactionChoiceSetID); + + j["choiceSet"]=Json::Value(Json::arrayValue); + j["choiceSet"].resize(e.choiceSet.size()); + for(unsigned int i=0;i<e.choiceSet.size();i++) + j["choiceSet"][i]=ChoiceMarshaller::toJSON(e.choiceSet[i]); + + json["request"]["parameters"]=j; + return json; +} + + +bool CreateInteractionChoiceSet_requestMarshaller::fromJSON(const Json::Value& js,CreateInteractionChoiceSet_request& c) +{ + try + { + if(!js.isObject()) return false; + + if(!js.isMember("request")) return false; + + if(!js["request"].isObject()) return false; + const Json::Value& j2=js["request"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("CreateInteractionChoiceSet")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("interactionChoiceSetID")) return false; + { + const Json::Value& j=json["interactionChoiceSetID"]; + if(!j.isInt()) return false; + c.interactionChoiceSetID=j.asInt(); + } + if(!json.isMember("choiceSet")) return false; + { + const Json::Value& j=json["choiceSet"]; + if(!j.isArray()) return false; + c.choiceSet.resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + { + Choice t; + if(!ChoiceMarshaller::fromJSON(j[i],t)) + return false; + c.choiceSet[i]=t; + } + + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CreateInteractionChoiceSet_requestMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CreateInteractionChoiceSet_requestMarshaller.h new file mode 100644 index 000000000..54cfe9700 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CreateInteractionChoiceSet_requestMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_CREATEINTERACTIONCHOICESET_REQUESTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_CREATEINTERACTIONCHOICESET_REQUESTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/CreateInteractionChoiceSet_request.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct CreateInteractionChoiceSet_requestMarshaller + { + static bool checkIntegrity(CreateInteractionChoiceSet_request& e); + static bool checkIntegrityConst(const CreateInteractionChoiceSet_request& e); + + static bool fromString(const std::string& s,CreateInteractionChoiceSet_request& e); + static const std::string toString(const CreateInteractionChoiceSet_request& e); + + static bool fromJSON(const Json::Value& s,CreateInteractionChoiceSet_request& e); + static Json::Value toJSON(const CreateInteractionChoiceSet_request& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CreateInteractionChoiceSet_response.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CreateInteractionChoiceSet_response.cpp new file mode 100644 index 000000000..b10cf8871 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CreateInteractionChoiceSet_response.cpp @@ -0,0 +1,78 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/CreateInteractionChoiceSet_response.h" +#include "CreateInteractionChoiceSet_responseMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +CreateInteractionChoiceSet_response& CreateInteractionChoiceSet_response::operator =( + const CreateInteractionChoiceSet_response& c) +{ + success = c.success; + resultCode = c.resultCode; + info = c.info ? new std::string(c.info[0]) : 0; + + return *this; +} + +CreateInteractionChoiceSet_response::~CreateInteractionChoiceSet_response(void) +{} + +CreateInteractionChoiceSet_response::CreateInteractionChoiceSet_response(const CreateInteractionChoiceSet_response& c) +{ + *this = c; +} + +bool CreateInteractionChoiceSet_response::checkIntegrity(void) +{ + return CreateInteractionChoiceSet_responseMarshaller::checkIntegrity(*this); +} + + +CreateInteractionChoiceSet_response::CreateInteractionChoiceSet_response(void) + : SDLRPCResponse(PROTOCOL_VERSION, Marshaller::METHOD_CREATEINTERACTIONCHOICESET_RESPONSE) +{} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CreateInteractionChoiceSet_responseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CreateInteractionChoiceSet_responseMarshaller.cpp new file mode 100644 index 000000000..24516347a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CreateInteractionChoiceSet_responseMarshaller.cpp @@ -0,0 +1,161 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/CreateInteractionChoiceSet_response.h" +#include "ResultMarshaller.h" + +#include "CreateInteractionChoiceSet_responseMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool CreateInteractionChoiceSet_responseMarshaller::checkIntegrity(CreateInteractionChoiceSet_response& s) +{ + return checkIntegrityConst(s); +} + + +bool CreateInteractionChoiceSet_responseMarshaller::fromString(const std::string& s,CreateInteractionChoiceSet_response& 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 CreateInteractionChoiceSet_responseMarshaller::toString(const CreateInteractionChoiceSet_response& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool CreateInteractionChoiceSet_responseMarshaller::checkIntegrityConst(const CreateInteractionChoiceSet_response& s) +{ + if(!ResultMarshaller::checkIntegrityConst(static_cast<NsSmartDeviceLinkRPCV2::Result>(s.resultCode))) return false; + if(s.info && s.info->length()>1000) return false; + return true; +} + +Json::Value CreateInteractionChoiceSet_responseMarshaller::toJSON(const CreateInteractionChoiceSet_response& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["response"]=Json::Value(Json::objectValue); + json["response"]["name"]=Json::Value("CreateInteractionChoiceSet"); + json["response"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["success"]=Json::Value(e.success); + + j["resultCode"]=ResultMarshaller::toJSON(static_cast<NsSmartDeviceLinkRPCV2::Result>(e.resultCode)); + + if(e.info) + j["info"]=Json::Value(*e.info); + + json["response"]["parameters"]=j; + return json; +} + + +bool CreateInteractionChoiceSet_responseMarshaller::fromJSON(const Json::Value& js,CreateInteractionChoiceSet_response& c) +{ + if(c.info) delete c.info; + c.info=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("response")) return false; + + if(!js["response"].isObject()) return false; + const Json::Value& j2=js["response"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("CreateInteractionChoiceSet")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("success")) return false; + { + const Json::Value& j=json["success"]; + if(!j.isBool()) return false; + c.success=j.asBool(); + } + if(!json.isMember("resultCode")) return false; + { + const Json::Value& j=json["resultCode"]; + NsSmartDeviceLinkRPC::Result result = static_cast<NsSmartDeviceLinkRPC::Result>(c.resultCode); + if(!ResultMarshaller::fromJSON(j, result)) + return false; + c.resultCode = static_cast<NsSmartDeviceLinkRPCV2::Result>(result); + } + if(json.isMember("info")) + { + const Json::Value& j=json["info"]; + if(!j.isString()) return false; + c.info=new std::string(j.asString()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CreateInteractionChoiceSet_responseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CreateInteractionChoiceSet_responseMarshaller.h new file mode 100644 index 000000000..48f660cfc --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/CreateInteractionChoiceSet_responseMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_CREATEINTERACTIONCHOICESET_RESPONSEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_CREATEINTERACTIONCHOICESET_RESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/CreateInteractionChoiceSet_response.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct CreateInteractionChoiceSet_responseMarshaller + { + static bool checkIntegrity(CreateInteractionChoiceSet_response& e); + static bool checkIntegrityConst(const CreateInteractionChoiceSet_response& e); + + static bool fromString(const std::string& s,CreateInteractionChoiceSet_response& e); + static const std::string toString(const CreateInteractionChoiceSet_response& e); + + static bool fromJSON(const Json::Value& s,CreateInteractionChoiceSet_response& e); + static Json::Value toJSON(const CreateInteractionChoiceSet_response& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteCommand_request.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteCommand_request.cpp new file mode 100644 index 000000000..68515991d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteCommand_request.cpp @@ -0,0 +1,88 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/DeleteCommand_request.h" +#include "DeleteCommand_requestMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + +DeleteCommand_request::~DeleteCommand_request(void) +{ +} + + +DeleteCommand_request::DeleteCommand_request(const DeleteCommand_request& c) +{ + *this=c; +} + + +bool DeleteCommand_request::checkIntegrity(void) +{ + return DeleteCommand_requestMarshaller::checkIntegrity(*this); +} + + +DeleteCommand_request::DeleteCommand_request(void) : SDLRPCRequest(PROTOCOL_VERSION,Marshaller::METHOD_DELETECOMMAND_REQUEST) +{ +} + + + +bool DeleteCommand_request::set_cmdID(unsigned int cmdID_) +{ + if(cmdID_>2000000000) return false; + cmdID=cmdID_; + return true; +} + + + + +unsigned int DeleteCommand_request::get_cmdID(void) const +{ + return cmdID; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteCommand_requestMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteCommand_requestMarshaller.cpp new file mode 100644 index 000000000..81544db69 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteCommand_requestMarshaller.cpp @@ -0,0 +1,138 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/DeleteCommand_request.h" + + +#include "DeleteCommand_requestMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool DeleteCommand_requestMarshaller::checkIntegrity(DeleteCommand_request& s) +{ + return checkIntegrityConst(s); +} + + +bool DeleteCommand_requestMarshaller::fromString(const std::string& s,DeleteCommand_request& 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 DeleteCommand_requestMarshaller::toString(const DeleteCommand_request& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool DeleteCommand_requestMarshaller::checkIntegrityConst(const DeleteCommand_request& s) +{ + if(s.cmdID>2000000000) return false; + return true; +} + +Json::Value DeleteCommand_requestMarshaller::toJSON(const DeleteCommand_request& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["request"]=Json::Value(Json::objectValue); + json["request"]["name"]=Json::Value("DeleteCommand"); + json["request"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["cmdID"]=Json::Value(e.cmdID); + + json["request"]["parameters"]=j; + return json; +} + + +bool DeleteCommand_requestMarshaller::fromJSON(const Json::Value& js,DeleteCommand_request& c) +{ + try + { + if(!js.isObject()) return false; + + if(!js.isMember("request")) return false; + + if(!js["request"].isObject()) return false; + const Json::Value& j2=js["request"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("DeleteCommand")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("cmdID")) return false; + { + const Json::Value& j=json["cmdID"]; + if(!j.isInt()) return false; + c.cmdID=j.asInt(); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteCommand_requestMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteCommand_requestMarshaller.h new file mode 100644 index 000000000..9ae921f1b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteCommand_requestMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_DELETECOMMAND_REQUESTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_DELETECOMMAND_REQUESTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/DeleteCommand_request.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct DeleteCommand_requestMarshaller + { + static bool checkIntegrity(DeleteCommand_request& e); + static bool checkIntegrityConst(const DeleteCommand_request& e); + + static bool fromString(const std::string& s,DeleteCommand_request& e); + static const std::string toString(const DeleteCommand_request& e); + + static bool fromJSON(const Json::Value& s,DeleteCommand_request& e); + static Json::Value toJSON(const DeleteCommand_request& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteCommand_response.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteCommand_response.cpp new file mode 100644 index 000000000..e16f993aa --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteCommand_response.cpp @@ -0,0 +1,76 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/DeleteCommand_response.h" +#include "DeleteCommand_responseMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +DeleteCommand_response& DeleteCommand_response::operator =(const DeleteCommand_response& c) +{ + success = c.success; + resultCode = c.resultCode; + info = c.info ? new std::string(c.info[0]) : 0; + + return *this; +} + +DeleteCommand_response::~DeleteCommand_response(void) +{} + +DeleteCommand_response::DeleteCommand_response(const DeleteCommand_response& c) +{ + *this = c; +} + +bool DeleteCommand_response::checkIntegrity(void) +{ + return DeleteCommand_responseMarshaller::checkIntegrity(*this); +} + +DeleteCommand_response::DeleteCommand_response(void) + : SDLRPCResponse(PROTOCOL_VERSION, Marshaller::METHOD_DELETECOMMAND_RESPONSE) +{} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteCommand_responseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteCommand_responseMarshaller.cpp new file mode 100644 index 000000000..00fc9d26e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteCommand_responseMarshaller.cpp @@ -0,0 +1,161 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/DeleteCommand_response.h" +#include "ResultMarshaller.h" + +#include "DeleteCommand_responseMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool DeleteCommand_responseMarshaller::checkIntegrity(DeleteCommand_response& s) +{ + return checkIntegrityConst(s); +} + + +bool DeleteCommand_responseMarshaller::fromString(const std::string& s,DeleteCommand_response& 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 DeleteCommand_responseMarshaller::toString(const DeleteCommand_response& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool DeleteCommand_responseMarshaller::checkIntegrityConst(const DeleteCommand_response& s) +{ + if(!ResultMarshaller::checkIntegrityConst(static_cast<NsSmartDeviceLinkRPCV2::Result>(s.resultCode))) return false; + if(s.info && s.info->length()>1000) return false; + return true; +} + +Json::Value DeleteCommand_responseMarshaller::toJSON(const DeleteCommand_response& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["response"]=Json::Value(Json::objectValue); + json["response"]["name"]=Json::Value("DeleteCommand"); + json["response"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["success"]=Json::Value(e.success); + + j["resultCode"]=ResultMarshaller::toJSON(static_cast<NsSmartDeviceLinkRPCV2::Result>(e.resultCode)); + + if(e.info) + j["info"]=Json::Value(*e.info); + + json["response"]["parameters"]=j; + return json; +} + + +bool DeleteCommand_responseMarshaller::fromJSON(const Json::Value& js,DeleteCommand_response& c) +{ + if(c.info) delete c.info; + c.info=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("response")) return false; + + if(!js["response"].isObject()) return false; + const Json::Value& j2=js["response"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("DeleteCommand")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("success")) return false; + { + const Json::Value& j=json["success"]; + if(!j.isBool()) return false; + c.success=j.asBool(); + } + if(!json.isMember("resultCode")) return false; + { + const Json::Value& j=json["resultCode"]; + NsSmartDeviceLinkRPC::Result result = static_cast<NsSmartDeviceLinkRPC::Result>(c.resultCode); + if(!ResultMarshaller::fromJSON(j, result)) + return false; + c.resultCode = static_cast<NsSmartDeviceLinkRPCV2::Result>(result); + } + if(json.isMember("info")) + { + const Json::Value& j=json["info"]; + if(!j.isString()) return false; + c.info=new std::string(j.asString()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteCommand_responseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteCommand_responseMarshaller.h new file mode 100644 index 000000000..58285f6a0 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteCommand_responseMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_DELETECOMMAND_RESPONSEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_DELETECOMMAND_RESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/DeleteCommand_response.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct DeleteCommand_responseMarshaller + { + static bool checkIntegrity(DeleteCommand_response& e); + static bool checkIntegrityConst(const DeleteCommand_response& e); + + static bool fromString(const std::string& s,DeleteCommand_response& e); + static const std::string toString(const DeleteCommand_response& e); + + static bool fromJSON(const Json::Value& s,DeleteCommand_response& e); + static Json::Value toJSON(const DeleteCommand_response& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteInteractionChoiceSet_request.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteInteractionChoiceSet_request.cpp new file mode 100644 index 000000000..520dbd928 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteInteractionChoiceSet_request.cpp @@ -0,0 +1,88 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/DeleteInteractionChoiceSet_request.h" +#include "DeleteInteractionChoiceSet_requestMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + +DeleteInteractionChoiceSet_request::~DeleteInteractionChoiceSet_request(void) +{ +} + + +DeleteInteractionChoiceSet_request::DeleteInteractionChoiceSet_request(const DeleteInteractionChoiceSet_request& c) +{ + *this=c; +} + + +bool DeleteInteractionChoiceSet_request::checkIntegrity(void) +{ + return DeleteInteractionChoiceSet_requestMarshaller::checkIntegrity(*this); +} + + +DeleteInteractionChoiceSet_request::DeleteInteractionChoiceSet_request(void) : SDLRPCRequest(PROTOCOL_VERSION,Marshaller::METHOD_DELETEINTERACTIONCHOICESET_REQUEST) +{ +} + + + +bool DeleteInteractionChoiceSet_request::set_interactionChoiceSetID(unsigned int interactionChoiceSetID_) +{ + if(interactionChoiceSetID_>2000000000) return false; + interactionChoiceSetID=interactionChoiceSetID_; + return true; +} + + + + +unsigned int DeleteInteractionChoiceSet_request::get_interactionChoiceSetID(void) const +{ + return interactionChoiceSetID; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteInteractionChoiceSet_requestMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteInteractionChoiceSet_requestMarshaller.cpp new file mode 100644 index 000000000..2adb1109e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteInteractionChoiceSet_requestMarshaller.cpp @@ -0,0 +1,138 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/DeleteInteractionChoiceSet_request.h" + + +#include "DeleteInteractionChoiceSet_requestMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool DeleteInteractionChoiceSet_requestMarshaller::checkIntegrity(DeleteInteractionChoiceSet_request& s) +{ + return checkIntegrityConst(s); +} + + +bool DeleteInteractionChoiceSet_requestMarshaller::fromString(const std::string& s,DeleteInteractionChoiceSet_request& 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 DeleteInteractionChoiceSet_requestMarshaller::toString(const DeleteInteractionChoiceSet_request& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool DeleteInteractionChoiceSet_requestMarshaller::checkIntegrityConst(const DeleteInteractionChoiceSet_request& s) +{ + if(s.interactionChoiceSetID>2000000000) return false; + return true; +} + +Json::Value DeleteInteractionChoiceSet_requestMarshaller::toJSON(const DeleteInteractionChoiceSet_request& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["request"]=Json::Value(Json::objectValue); + json["request"]["name"]=Json::Value("DeleteInteractionChoiceSet"); + json["request"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["interactionChoiceSetID"]=Json::Value(e.interactionChoiceSetID); + + json["request"]["parameters"]=j; + return json; +} + + +bool DeleteInteractionChoiceSet_requestMarshaller::fromJSON(const Json::Value& js,DeleteInteractionChoiceSet_request& c) +{ + try + { + if(!js.isObject()) return false; + + if(!js.isMember("request")) return false; + + if(!js["request"].isObject()) return false; + const Json::Value& j2=js["request"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("DeleteInteractionChoiceSet")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("interactionChoiceSetID")) return false; + { + const Json::Value& j=json["interactionChoiceSetID"]; + if(!j.isInt()) return false; + c.interactionChoiceSetID=j.asInt(); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteInteractionChoiceSet_requestMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteInteractionChoiceSet_requestMarshaller.h new file mode 100644 index 000000000..0a97a00e6 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteInteractionChoiceSet_requestMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_DELETEINTERACTIONCHOICESET_REQUESTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_DELETEINTERACTIONCHOICESET_REQUESTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/DeleteInteractionChoiceSet_request.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct DeleteInteractionChoiceSet_requestMarshaller + { + static bool checkIntegrity(DeleteInteractionChoiceSet_request& e); + static bool checkIntegrityConst(const DeleteInteractionChoiceSet_request& e); + + static bool fromString(const std::string& s,DeleteInteractionChoiceSet_request& e); + static const std::string toString(const DeleteInteractionChoiceSet_request& e); + + static bool fromJSON(const Json::Value& s,DeleteInteractionChoiceSet_request& e); + static Json::Value toJSON(const DeleteInteractionChoiceSet_request& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteInteractionChoiceSet_response.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteInteractionChoiceSet_response.cpp new file mode 100644 index 000000000..dc5f09cf7 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteInteractionChoiceSet_response.cpp @@ -0,0 +1,86 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/DeleteInteractionChoiceSet_response.h" +#include "DeleteInteractionChoiceSet_responseMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +DeleteInteractionChoiceSet_response& DeleteInteractionChoiceSet_response::operator =( + const DeleteInteractionChoiceSet_response& c) +{ + success = c.success; + resultCode = c.resultCode; + info = c.info ? new std::string(c.info[0]) : 0; + + return *this; +} + + +DeleteInteractionChoiceSet_response::~DeleteInteractionChoiceSet_response(void) +{ + if (info) + { + delete info; + } +} + + +DeleteInteractionChoiceSet_response::DeleteInteractionChoiceSet_response(const DeleteInteractionChoiceSet_response& c) +{ + *this = c; +} + + +bool DeleteInteractionChoiceSet_response::checkIntegrity(void) +{ + return DeleteInteractionChoiceSet_responseMarshaller::checkIntegrity(*this); +} + + +DeleteInteractionChoiceSet_response::DeleteInteractionChoiceSet_response(void) + : SDLRPCResponse(PROTOCOL_VERSION, Marshaller::METHOD_DELETEINTERACTIONCHOICESET_RESPONSE) +{} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteInteractionChoiceSet_responseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteInteractionChoiceSet_responseMarshaller.cpp new file mode 100644 index 000000000..43e370181 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteInteractionChoiceSet_responseMarshaller.cpp @@ -0,0 +1,161 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/DeleteInteractionChoiceSet_response.h" +#include "ResultMarshaller.h" + +#include "DeleteInteractionChoiceSet_responseMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool DeleteInteractionChoiceSet_responseMarshaller::checkIntegrity(DeleteInteractionChoiceSet_response& s) +{ + return checkIntegrityConst(s); +} + + +bool DeleteInteractionChoiceSet_responseMarshaller::fromString(const std::string& s,DeleteInteractionChoiceSet_response& 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 DeleteInteractionChoiceSet_responseMarshaller::toString(const DeleteInteractionChoiceSet_response& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool DeleteInteractionChoiceSet_responseMarshaller::checkIntegrityConst(const DeleteInteractionChoiceSet_response& s) +{ + if(!ResultMarshaller::checkIntegrityConst(static_cast<NsSmartDeviceLinkRPCV2::Result>(s.resultCode))) return false; + if(s.info && s.info->length()>1000) return false; + return true; +} + +Json::Value DeleteInteractionChoiceSet_responseMarshaller::toJSON(const DeleteInteractionChoiceSet_response& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["response"]=Json::Value(Json::objectValue); + json["response"]["name"]=Json::Value("DeleteInteractionChoiceSet"); + json["response"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["success"]=Json::Value(e.success); + + j["resultCode"]=ResultMarshaller::toJSON(static_cast<NsSmartDeviceLinkRPCV2::Result>(e.resultCode)); + + if(e.info) + j["info"]=Json::Value(*e.info); + + json["response"]["parameters"]=j; + return json; +} + + +bool DeleteInteractionChoiceSet_responseMarshaller::fromJSON(const Json::Value& js,DeleteInteractionChoiceSet_response& c) +{ + if(c.info) delete c.info; + c.info=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("response")) return false; + + if(!js["response"].isObject()) return false; + const Json::Value& j2=js["response"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("DeleteInteractionChoiceSet")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("success")) return false; + { + const Json::Value& j=json["success"]; + if(!j.isBool()) return false; + c.success=j.asBool(); + } + if(!json.isMember("resultCode")) return false; + { + const Json::Value& j=json["resultCode"]; + NsSmartDeviceLinkRPC::Result result = static_cast<NsSmartDeviceLinkRPC::Result>(c.resultCode); + if(!ResultMarshaller::fromJSON(j, result)) + return false; + c.resultCode = static_cast<NsSmartDeviceLinkRPCV2::Result>(result); + } + if(json.isMember("info")) + { + const Json::Value& j=json["info"]; + if(!j.isString()) return false; + c.info=new std::string(j.asString()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteInteractionChoiceSet_responseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteInteractionChoiceSet_responseMarshaller.h new file mode 100644 index 000000000..62e8f5c6c --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteInteractionChoiceSet_responseMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_DELETEINTERACTIONCHOICESET_RESPONSEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_DELETEINTERACTIONCHOICESET_RESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/DeleteInteractionChoiceSet_response.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct DeleteInteractionChoiceSet_responseMarshaller + { + static bool checkIntegrity(DeleteInteractionChoiceSet_response& e); + static bool checkIntegrityConst(const DeleteInteractionChoiceSet_response& e); + + static bool fromString(const std::string& s,DeleteInteractionChoiceSet_response& e); + static const std::string toString(const DeleteInteractionChoiceSet_response& e); + + static bool fromJSON(const Json::Value& s,DeleteInteractionChoiceSet_response& e); + static Json::Value toJSON(const DeleteInteractionChoiceSet_response& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteSubMenu_request.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteSubMenu_request.cpp new file mode 100644 index 000000000..74004227f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteSubMenu_request.cpp @@ -0,0 +1,88 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/DeleteSubMenu_request.h" +#include "DeleteSubMenu_requestMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + +DeleteSubMenu_request::~DeleteSubMenu_request(void) +{ +} + + +DeleteSubMenu_request::DeleteSubMenu_request(const DeleteSubMenu_request& c) +{ + *this=c; +} + + +bool DeleteSubMenu_request::checkIntegrity(void) +{ + return DeleteSubMenu_requestMarshaller::checkIntegrity(*this); +} + + +DeleteSubMenu_request::DeleteSubMenu_request(void) : SDLRPCRequest(PROTOCOL_VERSION,Marshaller::METHOD_DELETESUBMENU_REQUEST) +{ +} + + + +bool DeleteSubMenu_request::set_menuID(unsigned int menuID_) +{ + if(menuID_>2000000000) return false; + menuID=menuID_; + return true; +} + + + + +unsigned int DeleteSubMenu_request::get_menuID(void) const +{ + return menuID; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteSubMenu_requestMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteSubMenu_requestMarshaller.cpp new file mode 100644 index 000000000..83756354d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteSubMenu_requestMarshaller.cpp @@ -0,0 +1,138 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/DeleteSubMenu_request.h" + + +#include "DeleteSubMenu_requestMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool DeleteSubMenu_requestMarshaller::checkIntegrity(DeleteSubMenu_request& s) +{ + return checkIntegrityConst(s); +} + + +bool DeleteSubMenu_requestMarshaller::fromString(const std::string& s,DeleteSubMenu_request& 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 DeleteSubMenu_requestMarshaller::toString(const DeleteSubMenu_request& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool DeleteSubMenu_requestMarshaller::checkIntegrityConst(const DeleteSubMenu_request& s) +{ + if(s.menuID>2000000000) return false; + return true; +} + +Json::Value DeleteSubMenu_requestMarshaller::toJSON(const DeleteSubMenu_request& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["request"]=Json::Value(Json::objectValue); + json["request"]["name"]=Json::Value("DeleteSubMenu"); + json["request"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["menuID"]=Json::Value(e.menuID); + + json["request"]["parameters"]=j; + return json; +} + + +bool DeleteSubMenu_requestMarshaller::fromJSON(const Json::Value& js,DeleteSubMenu_request& c) +{ + try + { + if(!js.isObject()) return false; + + if(!js.isMember("request")) return false; + + if(!js["request"].isObject()) return false; + const Json::Value& j2=js["request"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("DeleteSubMenu")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("menuID")) return false; + { + const Json::Value& j=json["menuID"]; + if(!j.isInt()) return false; + c.menuID=j.asInt(); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteSubMenu_requestMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteSubMenu_requestMarshaller.h new file mode 100644 index 000000000..6e0bcd216 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteSubMenu_requestMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_DELETESUBMENU_REQUESTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_DELETESUBMENU_REQUESTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/DeleteSubMenu_request.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct DeleteSubMenu_requestMarshaller + { + static bool checkIntegrity(DeleteSubMenu_request& e); + static bool checkIntegrityConst(const DeleteSubMenu_request& e); + + static bool fromString(const std::string& s,DeleteSubMenu_request& e); + static const std::string toString(const DeleteSubMenu_request& e); + + static bool fromJSON(const Json::Value& s,DeleteSubMenu_request& e); + static Json::Value toJSON(const DeleteSubMenu_request& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteSubMenu_response.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteSubMenu_response.cpp new file mode 100644 index 000000000..ef99e4031 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteSubMenu_response.cpp @@ -0,0 +1,76 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/DeleteSubMenu_response.h" +#include "DeleteSubMenu_responseMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +DeleteSubMenu_response& DeleteSubMenu_response::operator =(const DeleteSubMenu_response& c) +{ + success = c.success; + resultCode = c.resultCode; + info = c.info ? new std::string(c.info[0]) : 0; + + return *this; +} + +DeleteSubMenu_response::~DeleteSubMenu_response(void) +{} + +DeleteSubMenu_response::DeleteSubMenu_response(const DeleteSubMenu_response& c) +{ + *this = c; +} + +bool DeleteSubMenu_response::checkIntegrity(void) +{ + return DeleteSubMenu_responseMarshaller::checkIntegrity(*this); +} + +DeleteSubMenu_response::DeleteSubMenu_response(void) + : SDLRPCResponse(PROTOCOL_VERSION, Marshaller::METHOD_DELETESUBMENU_RESPONSE) +{} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteSubMenu_responseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteSubMenu_responseMarshaller.cpp new file mode 100644 index 000000000..430e995f0 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteSubMenu_responseMarshaller.cpp @@ -0,0 +1,161 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/DeleteSubMenu_response.h" +#include "ResultMarshaller.h" + +#include "DeleteSubMenu_responseMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool DeleteSubMenu_responseMarshaller::checkIntegrity(DeleteSubMenu_response& s) +{ + return checkIntegrityConst(s); +} + + +bool DeleteSubMenu_responseMarshaller::fromString(const std::string& s,DeleteSubMenu_response& 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 DeleteSubMenu_responseMarshaller::toString(const DeleteSubMenu_response& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool DeleteSubMenu_responseMarshaller::checkIntegrityConst(const DeleteSubMenu_response& s) +{ + if(!ResultMarshaller::checkIntegrityConst(static_cast<NsSmartDeviceLinkRPCV2::Result>(s.resultCode))) return false; + if(s.info && s.info->length()>1000) return false; + return true; +} + +Json::Value DeleteSubMenu_responseMarshaller::toJSON(const DeleteSubMenu_response& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["response"]=Json::Value(Json::objectValue); + json["response"]["name"]=Json::Value("DeleteSubMenu"); + json["response"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["success"]=Json::Value(e.success); + + j["resultCode"]=ResultMarshaller::toJSON(static_cast<NsSmartDeviceLinkRPCV2::Result>(e.resultCode)); + + if(e.info) + j["info"]=Json::Value(*e.info); + + json["response"]["parameters"]=j; + return json; +} + + +bool DeleteSubMenu_responseMarshaller::fromJSON(const Json::Value& js,DeleteSubMenu_response& c) +{ + if(c.info) delete c.info; + c.info=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("response")) return false; + + if(!js["response"].isObject()) return false; + const Json::Value& j2=js["response"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("DeleteSubMenu")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("success")) return false; + { + const Json::Value& j=json["success"]; + if(!j.isBool()) return false; + c.success=j.asBool(); + } + if(!json.isMember("resultCode")) return false; + { + const Json::Value& j=json["resultCode"]; + NsSmartDeviceLinkRPC::Result result = static_cast<NsSmartDeviceLinkRPC::Result>(c.resultCode); + if(!ResultMarshaller::fromJSON(j, result)) + return false; + c.resultCode = static_cast<NsSmartDeviceLinkRPCV2::Result>(result); + } + if(json.isMember("info")) + { + const Json::Value& j=json["info"]; + if(!j.isString()) return false; + c.info=new std::string(j.asString()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteSubMenu_responseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteSubMenu_responseMarshaller.h new file mode 100644 index 000000000..211c8c8ed --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DeleteSubMenu_responseMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_DELETESUBMENU_RESPONSEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_DELETESUBMENU_RESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/DeleteSubMenu_response.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct DeleteSubMenu_responseMarshaller + { + static bool checkIntegrity(DeleteSubMenu_response& e); + static bool checkIntegrityConst(const DeleteSubMenu_response& e); + + static bool fromString(const std::string& s,DeleteSubMenu_response& e); + static const std::string toString(const DeleteSubMenu_response& e); + + static bool fromJSON(const Json::Value& s,DeleteSubMenu_response& e); + static Json::Value toJSON(const DeleteSubMenu_response& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayCapabilities.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayCapabilities.cpp new file mode 100644 index 000000000..e8c5a7835 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayCapabilities.cpp @@ -0,0 +1,120 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/DisplayCapabilities.h" +#include "DisplayCapabilitiesMarshaller.h" +#include "DisplayTypeMarshaller.h" +#include "MediaClockFormatMarshaller.h" +#include "TextFieldMarshaller.h" +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + + + +using namespace NsSmartDeviceLinkRPC; + +DisplayCapabilities::DisplayCapabilities(const DisplayCapabilities& c) +{ + *this=c; +} + + +bool DisplayCapabilities::checkIntegrity(void) +{ + return DisplayCapabilitiesMarshaller::checkIntegrity(*this); +} + + +DisplayCapabilities::DisplayCapabilities(void) +{ +} + + + +bool DisplayCapabilities::set_displayType(const DisplayType& displayType_) +{ + if(!DisplayTypeMarshaller::checkIntegrityConst(displayType_)) return false; + displayType=displayType_; + return true; +} + +bool DisplayCapabilities::set_mediaClockFormats(const std::vector<MediaClockFormat>& mediaClockFormats_) +{ + unsigned int i=mediaClockFormats_.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!MediaClockFormatMarshaller::checkIntegrityConst(mediaClockFormats_[i])) return false; + } + mediaClockFormats=mediaClockFormats_; + return true; +} + +bool DisplayCapabilities::set_textFields(const std::vector<TextField>& textFields_) +{ + unsigned int i=textFields_.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!TextFieldMarshaller::checkIntegrityConst(textFields_[i])) return false; + } + textFields=textFields_; + return true; +} + + + + +const DisplayType& DisplayCapabilities::get_displayType(void) const +{ + return displayType; +} + + +const std::vector<MediaClockFormat>& DisplayCapabilities::get_mediaClockFormats(void) const +{ + return mediaClockFormats; +} + + +const std::vector<TextField>& DisplayCapabilities::get_textFields(void) const +{ + return textFields; +} + + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayCapabilitiesMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayCapabilitiesMarshaller.cpp new file mode 100644 index 000000000..897ecbb5d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayCapabilitiesMarshaller.cpp @@ -0,0 +1,176 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/DisplayCapabilities.h" +#include "DisplayTypeMarshaller.h" +#include "MediaClockFormatMarshaller.h" +#include "TextFieldMarshaller.h" + +#include "DisplayCapabilitiesMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool DisplayCapabilitiesMarshaller::checkIntegrity(DisplayCapabilities& s) +{ + return checkIntegrityConst(s); +} + + +bool DisplayCapabilitiesMarshaller::fromString(const std::string& s,DisplayCapabilities& 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 DisplayCapabilitiesMarshaller::toString(const DisplayCapabilities& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool DisplayCapabilitiesMarshaller::checkIntegrityConst(const DisplayCapabilities& s) +{ + if(!DisplayTypeMarshaller::checkIntegrityConst(s.displayType)) return false; + { + unsigned int i=s.mediaClockFormats.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!MediaClockFormatMarshaller::checkIntegrityConst(s.mediaClockFormats[i])) return false; + } + } + { + unsigned int i=s.textFields.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!TextFieldMarshaller::checkIntegrityConst(s.textFields[i])) return false; + } + } + return true; +} + +Json::Value DisplayCapabilitiesMarshaller::toJSON(const DisplayCapabilities& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["displayType"]=DisplayTypeMarshaller::toJSON(e.displayType); + + json["mediaClockFormats"]=Json::Value(Json::arrayValue); + json["mediaClockFormats"].resize(e.mediaClockFormats.size()); + for(unsigned int i=0;i<e.mediaClockFormats.size();i++) + json["mediaClockFormats"][i]=MediaClockFormatMarshaller::toJSON(e.mediaClockFormats[i]); + + json["textFields"]=Json::Value(Json::arrayValue); + json["textFields"].resize(e.textFields.size()); + for(unsigned int i=0;i<e.textFields.size();i++) + json["textFields"][i]=TextFieldMarshaller::toJSON(e.textFields[i]); + + + return json; +} + + +bool DisplayCapabilitiesMarshaller::fromJSON(const Json::Value& json,DisplayCapabilities& c) +{ + try + { + if(!json.isObject()) return false; + + if(!json.isMember("displayType")) return false; + { + const Json::Value& j=json["displayType"]; + if(!DisplayTypeMarshaller::fromJSON(j,c.displayType)) + return false; + } + if(!json.isMember("mediaClockFormats")) return false; + { + const Json::Value& j=json["mediaClockFormats"]; + if(!j.isArray()) return false; + c.mediaClockFormats.resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + { + MediaClockFormat t; + if(!MediaClockFormatMarshaller::fromJSON(j[i],t)) + return false; + c.mediaClockFormats[i]=t; + } + + } + if(!json.isMember("textFields")) return false; + { + const Json::Value& j=json["textFields"]; + if(!j.isArray()) return false; + c.textFields.resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + { + TextField t; + if(!TextFieldMarshaller::fromJSON(j[i],t)) + return false; + c.textFields[i]=t; + } + + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayCapabilitiesMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayCapabilitiesMarshaller.h new file mode 100644 index 000000000..387918234 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayCapabilitiesMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_DISPLAYCAPABILITIESMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_DISPLAYCAPABILITIESMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/DisplayCapabilities.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct DisplayCapabilitiesMarshaller + { + static bool checkIntegrity(DisplayCapabilities& e); + static bool checkIntegrityConst(const DisplayCapabilities& e); + + static bool fromString(const std::string& s,DisplayCapabilities& e); + static const std::string toString(const DisplayCapabilities& e); + + static bool fromJSON(const Json::Value& s,DisplayCapabilities& e); + static Json::Value toJSON(const DisplayCapabilities& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.cpp new file mode 100644 index 000000000..b75161e7a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.cpp @@ -0,0 +1,115 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/DisplayType.h" +#include "DisplayTypeMarshaller.h" +#include "DisplayTypeMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const DisplayType::DisplayTypeInternal DisplayTypeMarshaller::getIndex(const char* s) +{ + if(!s) + return DisplayType::INVALID_ENUM; + const struct PerfectHashTable* p=DisplayType_intHash::getPointer(s,strlen(s)); + return p ? static_cast<DisplayType::DisplayTypeInternal>(p->idx) : DisplayType::INVALID_ENUM; +} + + +bool DisplayTypeMarshaller::fromJSON(const Json::Value& s,DisplayType& e) +{ + e.mInternal=DisplayType::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=DisplayType::INVALID_ENUM); +} + + +Json::Value DisplayTypeMarshaller::toJSON(const DisplayType& e) +{ + if(e.mInternal==DisplayType::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool DisplayTypeMarshaller::fromString(const std::string& s,DisplayType& e) +{ + e.mInternal=DisplayType::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string DisplayTypeMarshaller::toString(const DisplayType& e) +{ + Json::FastWriter writer; + return e.mInternal==DisplayType::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable DisplayTypeMarshaller::mHashTable[9]= +{ + {"CID",0}, + {"TYPE2",1}, + {"TYPE5",2}, + {"NGN",3}, + {"GEN2_8_DMA",4}, + {"GEN2_6_DMA",5}, + {"MFD3",6}, + {"MFD4",7}, + {"MFD5",8} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.gp new file mode 100644 index 000000000..ea34d6f9d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.gp @@ -0,0 +1,25 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name DisplayType_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +CID,0 +TYPE2,1 +TYPE5,2 +NGN,3 +GEN2_8_DMA,4 +GEN2_6_DMA,5 +MFD3,6 +MFD4,7 +MFD5,8 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.h new file mode 100644 index 000000000..8eb9ecacb --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_DISPLAYTYPEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_DISPLAYTYPEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/DisplayType.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for DisplayType + + class DisplayTypeMarshaller + { + public: + + static std::string toName(const DisplayType& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(DisplayType& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=DisplayType::INVALID_ENUM; + } + + static bool checkIntegrity(DisplayType& e) { return e.mInternal!=DisplayType::INVALID_ENUM; } + static bool checkIntegrityConst(const DisplayType& e) { return e.mInternal!=DisplayType::INVALID_ENUM; } + + static bool fromString(const std::string& s,DisplayType& e); + static const std::string toString(const DisplayType& e); + + static bool fromJSON(const Json::Value& s,DisplayType& e); + static Json::Value toJSON(const DisplayType& e); + + static const char* getName(DisplayType::DisplayTypeInternal e) + { + return (e>=0 && e<9) ? mHashTable[e].name : NULL; + } + + static const DisplayType::DisplayTypeInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[9]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.inc new file mode 100644 index 000000000..62d29cff1 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.inc @@ -0,0 +1,175 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.gp */ +/* Computed positions: -k'6,$' */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." +#endif + + +#define TOTAL_KEYWORDS 9 +#define MIN_WORD_LENGTH 3 +#define MAX_WORD_LENGTH 10 +#define MIN_HASH_VALUE 3 +#define MAX_HASH_VALUE 20 +/* maximum key range = 18, duplicates = 0 */ + +class DisplayType_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline unsigned int +DisplayType_intHash::hash (register const char *str, register unsigned int len) +{ + static const unsigned char asso_values[] = + { + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 15, 10, 5, 0, 5, 21, 0, 21, 21, 21, + 21, 21, 21, 21, 21, 0, 21, 21, 5, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 0, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21 + }; + register int hval = len; + + switch (hval) + { + default: + hval += asso_values[(unsigned char)str[5]]; + /*FALLTHROUGH*/ + case 5: + case 4: + case 3: + break; + } + return hval + asso_values[(unsigned char)str[len - 1]]; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +DisplayType_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 3, 4, 5, 0, 0, 3, 4, 10, 0, 0, 0, + 4, 10, 0, 0, 0, 0, 5 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, +#line 20 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.gp" + {"NGN",3}, +#line 25 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.gp" + {"MFD5",8}, +#line 19 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.gp" + {"TYPE5",2}, + {""}, {""}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.gp" + {"CID",0}, +#line 24 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.gp" + {"MFD4",7}, +#line 21 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.gp" + {"GEN2_8_DMA",4}, + {""}, {""}, {""}, +#line 23 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.gp" + {"MFD3",6}, +#line 22 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.gp" + {"GEN2_6_DMA",5}, + {""}, {""}, {""}, {""}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DisplayTypeMarshaller.gp" + {"TYPE2",1} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DriverDistractionStateMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DriverDistractionStateMarshaller.cpp new file mode 100644 index 000000000..904196923 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DriverDistractionStateMarshaller.cpp @@ -0,0 +1,108 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/DriverDistractionState.h" +#include "DriverDistractionStateMarshaller.h" +#include "DriverDistractionStateMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const DriverDistractionState::DriverDistractionStateInternal DriverDistractionStateMarshaller::getIndex(const char* s) +{ + if(!s) + return DriverDistractionState::INVALID_ENUM; + const struct PerfectHashTable* p=DriverDistractionState_intHash::getPointer(s,strlen(s)); + return p ? static_cast<DriverDistractionState::DriverDistractionStateInternal>(p->idx) : DriverDistractionState::INVALID_ENUM; +} + + +bool DriverDistractionStateMarshaller::fromJSON(const Json::Value& s,DriverDistractionState& e) +{ + e.mInternal=DriverDistractionState::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=DriverDistractionState::INVALID_ENUM); +} + + +Json::Value DriverDistractionStateMarshaller::toJSON(const DriverDistractionState& e) +{ + if(e.mInternal==DriverDistractionState::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool DriverDistractionStateMarshaller::fromString(const std::string& s,DriverDistractionState& e) +{ + e.mInternal=DriverDistractionState::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string DriverDistractionStateMarshaller::toString(const DriverDistractionState& e) +{ + Json::FastWriter writer; + return e.mInternal==DriverDistractionState::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable DriverDistractionStateMarshaller::mHashTable[2]= +{ + {"DD_ON",0}, + {"DD_OFF",1} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DriverDistractionStateMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DriverDistractionStateMarshaller.gp new file mode 100644 index 000000000..7e98b5c15 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DriverDistractionStateMarshaller.gp @@ -0,0 +1,18 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name DriverDistractionState_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +DD_ON,0 +DD_OFF,1 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DriverDistractionStateMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DriverDistractionStateMarshaller.h new file mode 100644 index 000000000..b9cbfd9b3 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DriverDistractionStateMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_DRIVERDISTRACTIONSTATEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_DRIVERDISTRACTIONSTATEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/DriverDistractionState.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for DriverDistractionState + + class DriverDistractionStateMarshaller + { + public: + + static std::string toName(const DriverDistractionState& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(DriverDistractionState& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=DriverDistractionState::INVALID_ENUM; + } + + static bool checkIntegrity(DriverDistractionState& e) { return e.mInternal!=DriverDistractionState::INVALID_ENUM; } + static bool checkIntegrityConst(const DriverDistractionState& e) { return e.mInternal!=DriverDistractionState::INVALID_ENUM; } + + static bool fromString(const std::string& s,DriverDistractionState& e); + static const std::string toString(const DriverDistractionState& e); + + static bool fromJSON(const Json::Value& s,DriverDistractionState& e); + static Json::Value toJSON(const DriverDistractionState& e); + + static const char* getName(DriverDistractionState::DriverDistractionStateInternal e) + { + return (e>=0 && e<2) ? mHashTable[e].name : NULL; + } + + static const DriverDistractionState::DriverDistractionStateInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[2]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DriverDistractionStateMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DriverDistractionStateMarshaller.inc new file mode 100644 index 000000000..a82b29bac --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DriverDistractionStateMarshaller.inc @@ -0,0 +1,90 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DriverDistractionStateMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DriverDistractionStateMarshaller.gp */ +/* Computed positions: -k'' */ + + +#define TOTAL_KEYWORDS 2 +#define MIN_WORD_LENGTH 5 +#define MAX_WORD_LENGTH 6 +#define MIN_HASH_VALUE 5 +#define MAX_HASH_VALUE 6 +/* maximum key range = 2, duplicates = 0 */ + +class DriverDistractionState_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline /*ARGSUSED*/ +unsigned int +DriverDistractionState_intHash::hash (register const char *str, register unsigned int len) +{ + return len; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +DriverDistractionState_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 0, 5, 6 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, {""}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DriverDistractionStateMarshaller.gp" + {"DD_ON",0}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/DriverDistractionStateMarshaller.gp" + {"DD_OFF",1} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/EncodedSyncPData_request.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/EncodedSyncPData_request.cpp new file mode 100644 index 000000000..476267107 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/EncodedSyncPData_request.cpp @@ -0,0 +1,112 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/EncodedSyncPData_request.h" +#include "EncodedSyncPData_requestMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +EncodedSyncPData_request& EncodedSyncPData_request::operator =(const EncodedSyncPData_request& c) +{ + data= c.data ? new std::vector<std::string>(c.data[0]) : 0; + + return *this;} + + +EncodedSyncPData_request::~EncodedSyncPData_request(void) +{ + if(data) + delete data; +} + + +EncodedSyncPData_request::EncodedSyncPData_request(const EncodedSyncPData_request& c) +{ + *this=c; +} + + +bool EncodedSyncPData_request::checkIntegrity(void) +{ + return EncodedSyncPData_requestMarshaller::checkIntegrity(*this); +} + + +EncodedSyncPData_request::EncodedSyncPData_request(void) : SDLRPCRequest(PROTOCOL_VERSION,Marshaller::METHOD_ENCODEDSYNCPDATA_REQUEST), + data(0) +{ +} + + + +bool EncodedSyncPData_request::set_data(const std::vector<std::string>& data_) +{ + unsigned int i=data_.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(data_[i].length()>10000) return false; + } + delete data; + data=0; + + data=new std::vector<std::string>(data_); + return true; +} + +void EncodedSyncPData_request::reset_data(void) +{ + if(data) + delete data; + data=0; +} + + + + +const std::vector<std::string>* EncodedSyncPData_request::get_data(void) const +{ + return data; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/EncodedSyncPData_requestMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/EncodedSyncPData_requestMarshaller.cpp new file mode 100644 index 000000000..bdb5006ac --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/EncodedSyncPData_requestMarshaller.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 "../include/JSONHandler/SDLRPCObjects/V1/EncodedSyncPData_request.h" + + +#include "EncodedSyncPData_requestMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool EncodedSyncPData_requestMarshaller::checkIntegrity(EncodedSyncPData_request& s) +{ + return checkIntegrityConst(s); +} + + +bool EncodedSyncPData_requestMarshaller::fromString(const std::string& s,EncodedSyncPData_request& 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 EncodedSyncPData_requestMarshaller::toString(const EncodedSyncPData_request& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool EncodedSyncPData_requestMarshaller::checkIntegrityConst(const EncodedSyncPData_request& s) +{ + if(s.data) + { + unsigned int i=s.data[0].size(); + if(i>100 || i<1) return false; + while(i--) + { + if(s.data[0][i].length()>10000) return false; + } + } + return true; +} + +Json::Value EncodedSyncPData_requestMarshaller::toJSON(const EncodedSyncPData_request& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["request"]=Json::Value(Json::objectValue); + json["request"]["name"]=Json::Value("EncodedSyncPData"); + json["request"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + if(e.data) + { + unsigned int sz=e.data->size(); + j["data"]=Json::Value(Json::arrayValue); + j["data"].resize(sz); + for(unsigned int i=0;i<sz;i++) + j["data"][i]=Json::Value(e.data[0][i]); + } + + json["request"]["parameters"]=j; + return json; +} + + +bool EncodedSyncPData_requestMarshaller::fromJSON(const Json::Value& js,EncodedSyncPData_request& c) +{ + if(c.data) delete c.data; + c.data=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("request")) return false; + + if(!js["request"].isObject()) return false; + const Json::Value& j2=js["request"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("EncodedSyncPData")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(json.isMember("data")) + { + const Json::Value& j=json["data"]; + if(!j.isArray()) return false; + c.data=new std::vector<std::string>(); + c.data->resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + if(!j[i].isString()) + return false; + else + c.data[0][i]=j[i].asString(); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/EncodedSyncPData_requestMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/EncodedSyncPData_requestMarshaller.h new file mode 100644 index 000000000..dddf12b16 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/EncodedSyncPData_requestMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_ENCODEDSYNCPDATA_REQUESTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_ENCODEDSYNCPDATA_REQUESTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/EncodedSyncPData_request.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct EncodedSyncPData_requestMarshaller + { + static bool checkIntegrity(EncodedSyncPData_request& e); + static bool checkIntegrityConst(const EncodedSyncPData_request& e); + + static bool fromString(const std::string& s,EncodedSyncPData_request& e); + static const std::string toString(const EncodedSyncPData_request& e); + + static bool fromJSON(const Json::Value& s,EncodedSyncPData_request& e); + static Json::Value toJSON(const EncodedSyncPData_request& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/EncodedSyncPData_response.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/EncodedSyncPData_response.cpp new file mode 100644 index 000000000..f28df3670 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/EncodedSyncPData_response.cpp @@ -0,0 +1,76 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/EncodedSyncPData_response.h" +#include "EncodedSyncPData_responseMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +EncodedSyncPData_response& EncodedSyncPData_response::operator =(const EncodedSyncPData_response& c) +{ + success = c.success; + resultCode = c.resultCode; + info = c.info ? new std::string(c.info[0]) : 0; + + return *this; +} + +EncodedSyncPData_response::~EncodedSyncPData_response(void) +{} + +EncodedSyncPData_response::EncodedSyncPData_response(const EncodedSyncPData_response& c) +{ + *this = c; +} + +bool EncodedSyncPData_response::checkIntegrity(void) +{ + return EncodedSyncPData_responseMarshaller::checkIntegrity(*this); +} + +EncodedSyncPData_response::EncodedSyncPData_response(void) + : SDLRPCResponse(PROTOCOL_VERSION, Marshaller::METHOD_ENCODEDSYNCPDATA_RESPONSE) +{} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/EncodedSyncPData_responseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/EncodedSyncPData_responseMarshaller.cpp new file mode 100644 index 000000000..e3c9b8e9b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/EncodedSyncPData_responseMarshaller.cpp @@ -0,0 +1,161 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/EncodedSyncPData_response.h" +#include "ResultMarshaller.h" + +#include "EncodedSyncPData_responseMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool EncodedSyncPData_responseMarshaller::checkIntegrity(EncodedSyncPData_response& s) +{ + return checkIntegrityConst(s); +} + + +bool EncodedSyncPData_responseMarshaller::fromString(const std::string& s,EncodedSyncPData_response& 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 EncodedSyncPData_responseMarshaller::toString(const EncodedSyncPData_response& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool EncodedSyncPData_responseMarshaller::checkIntegrityConst(const EncodedSyncPData_response& s) +{ + if(!ResultMarshaller::checkIntegrityConst(static_cast<NsSmartDeviceLinkRPCV2::Result>(s.resultCode))) return false; + if(s.info && s.info->length()>1000) return false; + return true; +} + +Json::Value EncodedSyncPData_responseMarshaller::toJSON(const EncodedSyncPData_response& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["response"]=Json::Value(Json::objectValue); + json["response"]["name"]=Json::Value("EncodedSyncPData"); + json["response"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["success"]=Json::Value(e.success); + + j["resultCode"]=ResultMarshaller::toJSON(static_cast<NsSmartDeviceLinkRPCV2::Result>(e.resultCode)); + + if(e.info) + j["info"]=Json::Value(*e.info); + + json["response"]["parameters"]=j; + return json; +} + + +bool EncodedSyncPData_responseMarshaller::fromJSON(const Json::Value& js,EncodedSyncPData_response& c) +{ + if(c.info) delete c.info; + c.info=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("response")) return false; + + if(!js["response"].isObject()) return false; + const Json::Value& j2=js["response"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("EncodedSyncPData")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("success")) return false; + { + const Json::Value& j=json["success"]; + if(!j.isBool()) return false; + c.success=j.asBool(); + } + if(!json.isMember("resultCode")) return false; + { + const Json::Value& j=json["resultCode"]; + NsSmartDeviceLinkRPC::Result result = static_cast<NsSmartDeviceLinkRPC::Result>(c.resultCode); + if(!ResultMarshaller::fromJSON(j, result)) + return false; + c.resultCode = static_cast<NsSmartDeviceLinkRPCV2::Result>(result); + } + if(json.isMember("info")) + { + const Json::Value& j=json["info"]; + if(!j.isString()) return false; + c.info=new std::string(j.asString()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/EncodedSyncPData_responseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/EncodedSyncPData_responseMarshaller.h new file mode 100644 index 000000000..903d9ff35 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/EncodedSyncPData_responseMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_ENCODEDSYNCPDATA_RESPONSEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_ENCODEDSYNCPDATA_RESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/EncodedSyncPData_response.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct EncodedSyncPData_responseMarshaller + { + static bool checkIntegrity(EncodedSyncPData_response& e); + static bool checkIntegrityConst(const EncodedSyncPData_response& e); + + static bool fromString(const std::string& s,EncodedSyncPData_response& e); + static const std::string toString(const EncodedSyncPData_response& e); + + static bool fromJSON(const Json::Value& s,EncodedSyncPData_response& e); + static Json::Value toJSON(const EncodedSyncPData_response& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GenericResponse_response.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GenericResponse_response.cpp new file mode 100644 index 000000000..f17773497 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GenericResponse_response.cpp @@ -0,0 +1,76 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/GenericResponse_response.h" +#include "GenericResponse_responseMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +GenericResponse_response& GenericResponse_response::operator =(const GenericResponse_response& c) +{ + success = c.success; + resultCode = c.resultCode; + info = c.info ? new std::string(c.info[0]) : 0; + + return *this; +} + +GenericResponse_response::~GenericResponse_response(void) +{} + +GenericResponse_response::GenericResponse_response(const GenericResponse_response& c) +{ + *this = c; +} + +bool GenericResponse_response::checkIntegrity(void) +{ + return GenericResponse_responseMarshaller::checkIntegrity(*this); +} + +GenericResponse_response::GenericResponse_response(void) + : SDLRPCResponse(PROTOCOL_VERSION, Marshaller::METHOD_GENERICRESPONSE_RESPONSE) +{} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GenericResponse_responseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GenericResponse_responseMarshaller.cpp new file mode 100644 index 000000000..7f30f6c3f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GenericResponse_responseMarshaller.cpp @@ -0,0 +1,161 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/GenericResponse_response.h" +#include "ResultMarshaller.h" + +#include "GenericResponse_responseMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool GenericResponse_responseMarshaller::checkIntegrity(GenericResponse_response& s) +{ + return checkIntegrityConst(s); +} + + +bool GenericResponse_responseMarshaller::fromString(const std::string& s,GenericResponse_response& 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 GenericResponse_responseMarshaller::toString(const GenericResponse_response& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool GenericResponse_responseMarshaller::checkIntegrityConst(const GenericResponse_response& s) +{ + if(!ResultMarshaller::checkIntegrityConst(static_cast<NsSmartDeviceLinkRPCV2::Result>(s.resultCode))) return false; + if(s.info && s.info->length()>1000) return false; + return true; +} + +Json::Value GenericResponse_responseMarshaller::toJSON(const GenericResponse_response& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["response"]=Json::Value(Json::objectValue); + json["response"]["name"]=Json::Value("GenericResponse"); + json["response"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["success"]=Json::Value(e.success); + + j["resultCode"]=ResultMarshaller::toJSON(static_cast<NsSmartDeviceLinkRPCV2::Result>(e.resultCode)); + + if(e.info) + j["info"]=Json::Value(*e.info); + + json["response"]["parameters"]=j; + return json; +} + + +bool GenericResponse_responseMarshaller::fromJSON(const Json::Value& js,GenericResponse_response& c) +{ + if(c.info) delete c.info; + c.info=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("response")) return false; + + if(!js["response"].isObject()) return false; + const Json::Value& j2=js["response"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("GenericResponse")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("success")) return false; + { + const Json::Value& j=json["success"]; + if(!j.isBool()) return false; + c.success=j.asBool(); + } + if(!json.isMember("resultCode")) return false; + { + const Json::Value& j=json["resultCode"]; + NsSmartDeviceLinkRPC::Result result = static_cast<NsSmartDeviceLinkRPC::Result>(c.resultCode); + if(!ResultMarshaller::fromJSON(j, result)) + return false; + c.resultCode = static_cast<NsSmartDeviceLinkRPCV2::Result>(result); + } + if(json.isMember("info")) + { + const Json::Value& j=json["info"]; + if(!j.isString()) return false; + c.info=new std::string(j.asString()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GenericResponse_responseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GenericResponse_responseMarshaller.h new file mode 100644 index 000000000..555bc7b3f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GenericResponse_responseMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_GENERICRESPONSE_RESPONSEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_GENERICRESPONSE_RESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/GenericResponse_response.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct GenericResponse_responseMarshaller + { + static bool checkIntegrity(GenericResponse_response& e); + static bool checkIntegrityConst(const GenericResponse_response& e); + + static bool fromString(const std::string& s,GenericResponse_response& e); + static const std::string toString(const GenericResponse_response& e); + + static bool fromJSON(const Json::Value& s,GenericResponse_response& e); + static Json::Value toJSON(const GenericResponse_response& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GlobalPropertyMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GlobalPropertyMarshaller.cpp new file mode 100644 index 000000000..04c31edc3 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GlobalPropertyMarshaller.cpp @@ -0,0 +1,108 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/GlobalProperty.h" +#include "GlobalPropertyMarshaller.h" +#include "GlobalPropertyMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const GlobalProperty::GlobalPropertyInternal GlobalPropertyMarshaller::getIndex(const char* s) +{ + if(!s) + return GlobalProperty::INVALID_ENUM; + const struct PerfectHashTable* p=GlobalProperty_intHash::getPointer(s,strlen(s)); + return p ? static_cast<GlobalProperty::GlobalPropertyInternal>(p->idx) : GlobalProperty::INVALID_ENUM; +} + + +bool GlobalPropertyMarshaller::fromJSON(const Json::Value& s,GlobalProperty& e) +{ + e.mInternal=GlobalProperty::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=GlobalProperty::INVALID_ENUM); +} + + +Json::Value GlobalPropertyMarshaller::toJSON(const GlobalProperty& e) +{ + if(e.mInternal==GlobalProperty::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool GlobalPropertyMarshaller::fromString(const std::string& s,GlobalProperty& e) +{ + e.mInternal=GlobalProperty::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string GlobalPropertyMarshaller::toString(const GlobalProperty& e) +{ + Json::FastWriter writer; + return e.mInternal==GlobalProperty::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable GlobalPropertyMarshaller::mHashTable[2]= +{ + {"HELPPROMPT",0}, + {"TIMEOUTPROMPT",1} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GlobalPropertyMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GlobalPropertyMarshaller.gp new file mode 100644 index 000000000..99a3d1076 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GlobalPropertyMarshaller.gp @@ -0,0 +1,18 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name GlobalProperty_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +HELPPROMPT,0 +TIMEOUTPROMPT,1 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GlobalPropertyMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GlobalPropertyMarshaller.h new file mode 100644 index 000000000..f9b555446 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GlobalPropertyMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_GLOBALPROPERTYMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_GLOBALPROPERTYMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/GlobalProperty.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for GlobalProperty + + class GlobalPropertyMarshaller + { + public: + + static std::string toName(const GlobalProperty& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(GlobalProperty& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=GlobalProperty::INVALID_ENUM; + } + + static bool checkIntegrity(GlobalProperty& e) { return e.mInternal!=GlobalProperty::INVALID_ENUM; } + static bool checkIntegrityConst(const GlobalProperty& e) { return e.mInternal!=GlobalProperty::INVALID_ENUM; } + + static bool fromString(const std::string& s,GlobalProperty& e); + static const std::string toString(const GlobalProperty& e); + + static bool fromJSON(const Json::Value& s,GlobalProperty& e); + static Json::Value toJSON(const GlobalProperty& e); + + static const char* getName(GlobalProperty::GlobalPropertyInternal e) + { + return (e>=0 && e<2) ? mHashTable[e].name : NULL; + } + + static const GlobalProperty::GlobalPropertyInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[2]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GlobalPropertyMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GlobalPropertyMarshaller.inc new file mode 100644 index 000000000..c4cb253af --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GlobalPropertyMarshaller.inc @@ -0,0 +1,92 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GlobalPropertyMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GlobalPropertyMarshaller.gp */ +/* Computed positions: -k'' */ + + +#define TOTAL_KEYWORDS 2 +#define MIN_WORD_LENGTH 10 +#define MAX_WORD_LENGTH 13 +#define MIN_HASH_VALUE 10 +#define MAX_HASH_VALUE 13 +/* maximum key range = 4, duplicates = 0 */ + +class GlobalProperty_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline /*ARGSUSED*/ +unsigned int +GlobalProperty_intHash::hash (register const char *str, register unsigned int len) +{ + return len; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +GlobalProperty_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 13 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GlobalPropertyMarshaller.gp" + {"HELPPROMPT",0}, + {""}, {""}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/GlobalPropertyMarshaller.gp" + {"TIMEOUTPROMPT",1} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HMILevelMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HMILevelMarshaller.cpp new file mode 100644 index 000000000..a887ba550 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HMILevelMarshaller.cpp @@ -0,0 +1,110 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/HMILevel.h" +#include "HMILevelMarshaller.h" +#include "HMILevelMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const HMILevel::HMILevelInternal HMILevelMarshaller::getIndex(const char* s) +{ + if(!s) + return HMILevel::INVALID_ENUM; + const struct PerfectHashTable* p=HMILevel_intHash::getPointer(s,strlen(s)); + return p ? static_cast<HMILevel::HMILevelInternal>(p->idx) : HMILevel::INVALID_ENUM; +} + + +bool HMILevelMarshaller::fromJSON(const Json::Value& s,HMILevel& e) +{ + e.mInternal=HMILevel::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=HMILevel::INVALID_ENUM); +} + + +Json::Value HMILevelMarshaller::toJSON(const HMILevel& e) +{ + if(e.mInternal==HMILevel::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool HMILevelMarshaller::fromString(const std::string& s,HMILevel& e) +{ + e.mInternal=HMILevel::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string HMILevelMarshaller::toString(const HMILevel& e) +{ + Json::FastWriter writer; + return e.mInternal==HMILevel::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable HMILevelMarshaller::mHashTable[4]= +{ + {"FULL",0}, + {"LIMITED",1}, + {"BACKGROUND",2}, + {"NONE",3} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HMILevelMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HMILevelMarshaller.gp new file mode 100644 index 000000000..640060844 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HMILevelMarshaller.gp @@ -0,0 +1,20 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name HMILevel_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +FULL,0 +LIMITED,1 +BACKGROUND,2 +NONE,3 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HMILevelMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HMILevelMarshaller.h new file mode 100644 index 000000000..372e394b5 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HMILevelMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_HMILEVELMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_HMILEVELMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/HMILevel.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for HMILevel + + class HMILevelMarshaller + { + public: + + static std::string toName(const HMILevel& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(HMILevel& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=HMILevel::INVALID_ENUM; + } + + static bool checkIntegrity(HMILevel& e) { return e.mInternal!=HMILevel::INVALID_ENUM; } + static bool checkIntegrityConst(const HMILevel& e) { return e.mInternal!=HMILevel::INVALID_ENUM; } + + static bool fromString(const std::string& s,HMILevel& e); + static const std::string toString(const HMILevel& e); + + static bool fromJSON(const Json::Value& s,HMILevel& e); + static Json::Value toJSON(const HMILevel& e); + + static const char* getName(HMILevel::HMILevelInternal e) + { + return (e>=0 && e<4) ? mHashTable[e].name : NULL; + } + + static const HMILevel::HMILevelInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[4]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HMILevelMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HMILevelMarshaller.inc new file mode 100644 index 000000000..8d9728feb --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HMILevelMarshaller.inc @@ -0,0 +1,124 @@ +/* Copyright (c) 2013 Ford Motor Company */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HMILevelMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HMILevelMarshaller.gp */ +/* Computed positions: -k'1' */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." +#endif + + +#define TOTAL_KEYWORDS 4 +#define MIN_WORD_LENGTH 4 +#define MAX_WORD_LENGTH 10 +#define MIN_HASH_VALUE 4 +#define MAX_HASH_VALUE 10 +/* maximum key range = 7, duplicates = 0 */ + +namespace NsSmartDeviceLinkRPC { + +class HMILevel_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline unsigned int +HMILevel_intHash::hash (register const char *str, register unsigned int len) +{ + static const unsigned char asso_values[] = + { + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 0, 11, 11, 11, + 5, 11, 11, 11, 11, 11, 0, 11, 0, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11 + }; + return len + asso_values[(unsigned char)str[0]]; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +HMILevel_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 4, 0, 0, 7, 0, 4, 10 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, +#line 20 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HMILevelMarshaller.gp" + {"NONE",3}, + {""}, {""}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HMILevelMarshaller.gp" + {"LIMITED",1}, + {""}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HMILevelMarshaller.gp" + {"FULL",0}, +#line 19 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HMILevelMarshaller.gp" + {"BACKGROUND",2} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} +}
\ No newline at end of file diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HmiZoneCapabilitiesMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HmiZoneCapabilitiesMarshaller.cpp new file mode 100644 index 000000000..1c940d491 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HmiZoneCapabilitiesMarshaller.cpp @@ -0,0 +1,108 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/HmiZoneCapabilities.h" +#include "HmiZoneCapabilitiesMarshaller.h" +#include "HmiZoneCapabilitiesMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const HmiZoneCapabilities::HmiZoneCapabilitiesInternal HmiZoneCapabilitiesMarshaller::getIndex(const char* s) +{ + if(!s) + return HmiZoneCapabilities::INVALID_ENUM; + const struct PerfectHashTable* p=HmiZoneCapabilities_intHash::getPointer(s,strlen(s)); + return p ? static_cast<HmiZoneCapabilities::HmiZoneCapabilitiesInternal>(p->idx) : HmiZoneCapabilities::INVALID_ENUM; +} + + +bool HmiZoneCapabilitiesMarshaller::fromJSON(const Json::Value& s,HmiZoneCapabilities& e) +{ + e.mInternal=HmiZoneCapabilities::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=HmiZoneCapabilities::INVALID_ENUM); +} + + +Json::Value HmiZoneCapabilitiesMarshaller::toJSON(const HmiZoneCapabilities& e) +{ + if(e.mInternal==HmiZoneCapabilities::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool HmiZoneCapabilitiesMarshaller::fromString(const std::string& s,HmiZoneCapabilities& e) +{ + e.mInternal=HmiZoneCapabilities::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string HmiZoneCapabilitiesMarshaller::toString(const HmiZoneCapabilities& e) +{ + Json::FastWriter writer; + return e.mInternal==HmiZoneCapabilities::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable HmiZoneCapabilitiesMarshaller::mHashTable[2]= +{ + {"FRONT",0}, + {"BACK",1} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HmiZoneCapabilitiesMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HmiZoneCapabilitiesMarshaller.gp new file mode 100644 index 000000000..40d272c87 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HmiZoneCapabilitiesMarshaller.gp @@ -0,0 +1,18 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name HmiZoneCapabilities_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +FRONT,0 +BACK,1 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HmiZoneCapabilitiesMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HmiZoneCapabilitiesMarshaller.h new file mode 100644 index 000000000..d05988a59 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HmiZoneCapabilitiesMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_HMIZONECAPABILITIESMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_HMIZONECAPABILITIESMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/HmiZoneCapabilities.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for HmiZoneCapabilities + + class HmiZoneCapabilitiesMarshaller + { + public: + + static std::string toName(const HmiZoneCapabilities& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(HmiZoneCapabilities& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=HmiZoneCapabilities::INVALID_ENUM; + } + + static bool checkIntegrity(HmiZoneCapabilities& e) { return e.mInternal!=HmiZoneCapabilities::INVALID_ENUM; } + static bool checkIntegrityConst(const HmiZoneCapabilities& e) { return e.mInternal!=HmiZoneCapabilities::INVALID_ENUM; } + + static bool fromString(const std::string& s,HmiZoneCapabilities& e); + static const std::string toString(const HmiZoneCapabilities& e); + + static bool fromJSON(const Json::Value& s,HmiZoneCapabilities& e); + static Json::Value toJSON(const HmiZoneCapabilities& e); + + static const char* getName(HmiZoneCapabilities::HmiZoneCapabilitiesInternal e) + { + return (e>=0 && e<2) ? mHashTable[e].name : NULL; + } + + static const HmiZoneCapabilities::HmiZoneCapabilitiesInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[2]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HmiZoneCapabilitiesMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HmiZoneCapabilitiesMarshaller.inc new file mode 100644 index 000000000..1d8e37870 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HmiZoneCapabilitiesMarshaller.inc @@ -0,0 +1,90 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HmiZoneCapabilitiesMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HmiZoneCapabilitiesMarshaller.gp */ +/* Computed positions: -k'' */ + + +#define TOTAL_KEYWORDS 2 +#define MIN_WORD_LENGTH 4 +#define MAX_WORD_LENGTH 5 +#define MIN_HASH_VALUE 4 +#define MAX_HASH_VALUE 5 +/* maximum key range = 2, duplicates = 0 */ + +class HmiZoneCapabilities_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline /*ARGSUSED*/ +unsigned int +HmiZoneCapabilities_intHash::hash (register const char *str, register unsigned int len) +{ + return len; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +HmiZoneCapabilities_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 4, 5 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HmiZoneCapabilitiesMarshaller.gp" + {"BACK",1}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/HmiZoneCapabilitiesMarshaller.gp" + {"FRONT",0} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/InteractionModeMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/InteractionModeMarshaller.cpp new file mode 100644 index 000000000..98ba5a0da --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/InteractionModeMarshaller.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 <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/InteractionMode.h" +#include "InteractionModeMarshaller.h" +#include "InteractionModeMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const InteractionMode::InteractionModeInternal InteractionModeMarshaller::getIndex(const char* s) +{ + if(!s) + return InteractionMode::INVALID_ENUM; + const struct PerfectHashTable* p=InteractionMode_intHash::getPointer(s,strlen(s)); + return p ? static_cast<InteractionMode::InteractionModeInternal>(p->idx) : InteractionMode::INVALID_ENUM; +} + + +bool InteractionModeMarshaller::fromJSON(const Json::Value& s,InteractionMode& e) +{ + e.mInternal=InteractionMode::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=InteractionMode::INVALID_ENUM); +} + + +Json::Value InteractionModeMarshaller::toJSON(const InteractionMode& e) +{ + if(e.mInternal==InteractionMode::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool InteractionModeMarshaller::fromString(const std::string& s,InteractionMode& e) +{ + e.mInternal=InteractionMode::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string InteractionModeMarshaller::toString(const InteractionMode& e) +{ + Json::FastWriter writer; + return e.mInternal==InteractionMode::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable InteractionModeMarshaller::mHashTable[3]= +{ + {"MANUAL_ONLY",0}, + {"VR_ONLY",1}, + {"BOTH",2} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/InteractionModeMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/InteractionModeMarshaller.gp new file mode 100644 index 000000000..256bee809 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/InteractionModeMarshaller.gp @@ -0,0 +1,19 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name InteractionMode_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +MANUAL_ONLY,0 +VR_ONLY,1 +BOTH,2 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/InteractionModeMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/InteractionModeMarshaller.h new file mode 100644 index 000000000..ef1229d91 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/InteractionModeMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_INTERACTIONMODEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_INTERACTIONMODEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/InteractionMode.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for InteractionMode + + class InteractionModeMarshaller + { + public: + + static std::string toName(const InteractionMode& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(InteractionMode& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=InteractionMode::INVALID_ENUM; + } + + static bool checkIntegrity(InteractionMode& e) { return e.mInternal!=InteractionMode::INVALID_ENUM; } + static bool checkIntegrityConst(const InteractionMode& e) { return e.mInternal!=InteractionMode::INVALID_ENUM; } + + static bool fromString(const std::string& s,InteractionMode& e); + static const std::string toString(const InteractionMode& e); + + static bool fromJSON(const Json::Value& s,InteractionMode& e); + static Json::Value toJSON(const InteractionMode& e); + + static const char* getName(InteractionMode::InteractionModeInternal e) + { + return (e>=0 && e<3) ? mHashTable[e].name : NULL; + } + + static const InteractionMode::InteractionModeInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[3]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/InteractionModeMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/InteractionModeMarshaller.inc new file mode 100644 index 000000000..f01669d29 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/InteractionModeMarshaller.inc @@ -0,0 +1,94 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/InteractionModeMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/InteractionModeMarshaller.gp */ +/* Computed positions: -k'' */ + + +#define TOTAL_KEYWORDS 3 +#define MIN_WORD_LENGTH 4 +#define MAX_WORD_LENGTH 11 +#define MIN_HASH_VALUE 4 +#define MAX_HASH_VALUE 11 +/* maximum key range = 8, duplicates = 0 */ + +class InteractionMode_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline /*ARGSUSED*/ +unsigned int +InteractionMode_intHash::hash (register const char *str, register unsigned int len) +{ + return len; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +InteractionMode_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 4, 0, 0, 7, 0, 0, 0, 11 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, +#line 19 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/InteractionModeMarshaller.gp" + {"BOTH",2}, + {""}, {""}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/InteractionModeMarshaller.gp" + {"VR_ONLY",1}, + {""}, {""}, {""}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/InteractionModeMarshaller.gp" + {"MANUAL_ONLY",0} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/LanguageMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/LanguageMarshaller.cpp new file mode 100644 index 000000000..6e916f276 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/LanguageMarshaller.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 <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/Language.h" +#include "LanguageMarshaller.h" +#include "LanguageMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const Language::LanguageInternal LanguageMarshaller::getIndex(const char* s) +{ + if(!s) + return Language::INVALID_ENUM; + const struct PerfectHashTable* p=Language_intHash::getPointer(s,strlen(s)); + return p ? static_cast<Language::LanguageInternal>(p->idx) : Language::INVALID_ENUM; +} + + +bool LanguageMarshaller::fromJSON(const Json::Value& s,Language& e) +{ + e.mInternal=Language::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=Language::INVALID_ENUM); +} + + +Json::Value LanguageMarshaller::toJSON(const Language& e) +{ + if(e.mInternal==Language::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool LanguageMarshaller::fromString(const std::string& s,Language& e) +{ + e.mInternal=Language::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string LanguageMarshaller::toString(const Language& e) +{ + Json::FastWriter writer; + return e.mInternal==Language::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable LanguageMarshaller::mHashTable[3]= +{ + {"EN-US",0}, + {"ES-MX",1}, + {"FR-CA",2} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/LanguageMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/LanguageMarshaller.gp new file mode 100644 index 000000000..34331fc4d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/LanguageMarshaller.gp @@ -0,0 +1,19 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name Language_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +EN-US,0 +ES-MX,1 +FR-CA,2 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/LanguageMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/LanguageMarshaller.h new file mode 100644 index 000000000..d77fe6db6 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/LanguageMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_LANGUAGEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_LANGUAGEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/Language.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for Language + + class LanguageMarshaller + { + public: + + static std::string toName(const Language& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(Language& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=Language::INVALID_ENUM; + } + + static bool checkIntegrity(Language& e) { return e.mInternal!=Language::INVALID_ENUM; } + static bool checkIntegrityConst(const Language& e) { return e.mInternal!=Language::INVALID_ENUM; } + + static bool fromString(const std::string& s,Language& e); + static const std::string toString(const Language& e); + + static bool fromJSON(const Json::Value& s,Language& e); + static Json::Value toJSON(const Language& e); + + static const char* getName(Language::LanguageInternal e) + { + return (e>=0 && e<3) ? mHashTable[e].name : NULL; + } + + static const Language::LanguageInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[3]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/LanguageMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/LanguageMarshaller.inc new file mode 100644 index 000000000..4c947e038 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/LanguageMarshaller.inc @@ -0,0 +1,147 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/LanguageMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/LanguageMarshaller.gp */ +/* Computed positions: -k'2' */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." +#endif + + +#define TOTAL_KEYWORDS 3 +#define MIN_WORD_LENGTH 5 +#define MAX_WORD_LENGTH 5 +#define MIN_HASH_VALUE 5 +#define MAX_HASH_VALUE 7 +/* maximum key range = 3, duplicates = 0 */ + +class Language_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline unsigned int +Language_intHash::hash (register const char *str, register unsigned int len) +{ + static const unsigned char asso_values[] = + { + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 2, 8, + 8, 8, 1, 0, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8 + }; + return len + asso_values[(unsigned char)str[1]]; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +Language_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 0, 5, 5, 5 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, {""}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/LanguageMarshaller.gp" + {"ES-MX",1}, +#line 19 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/LanguageMarshaller.gp" + {"FR-CA",2}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/LanguageMarshaller.gp" + {"EN-US",0} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.cpp new file mode 100644 index 000000000..79a508129 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.cpp @@ -0,0 +1,816 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include <cstring> + +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/RegisterAppInterface_request.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/RegisterAppInterface_response.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/UnregisterAppInterface_request.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/UnregisterAppInterface_response.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/SetGlobalProperties_request.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/SetGlobalProperties_response.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/ResetGlobalProperties_request.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/ResetGlobalProperties_response.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/AddCommand_request.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/AddCommand_response.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/DeleteCommand_request.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/DeleteCommand_response.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/AddSubMenu_request.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/AddSubMenu_response.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/DeleteSubMenu_request.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/DeleteSubMenu_response.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/CreateInteractionChoiceSet_request.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/CreateInteractionChoiceSet_response.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/PerformInteraction_request.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/PerformInteraction_response.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/DeleteInteractionChoiceSet_request.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/DeleteInteractionChoiceSet_response.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Alert_request.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Alert_response.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Show_request.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Show_response.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Speak_request.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Speak_response.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/SetMediaClockTimer_request.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/SetMediaClockTimer_response.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/EncodedSyncPData_request.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/EncodedSyncPData_response.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/SubscribeButton_request.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/SubscribeButton_response.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/UnsubscribeButton_request.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/UnsubscribeButton_response.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/GenericResponse_response.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/OnHMIStatus.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/OnAppInterfaceUnregistered.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/OnButtonEvent.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/OnButtonPress.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/OnCommand.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/OnEncodedSyncPData.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/OnTBTClientState.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/OnDriverDistraction.h" +namespace NsSmartDeviceLinkRPC +{ +#include "Marshaller.inc" +} + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const Marshaller::Methods Marshaller::getIndex(const char* s) +{ + if(!s) + return METHOD_INVALID; + const struct localHash* p=Marshaller_intHash::getPointer(s,strlen(s)); + return p ? static_cast<Methods>(p->idx) : METHOD_INVALID; +} + + +SDLRPCMessage* Marshaller::fromString(const std::string& s) +{ + SDLRPCMessage* rv=0; + try + { + Json::Reader reader; + Json::Value json; + + if(!reader.parse(s,json,false)) return 0; + if(!(rv=fromJSON(json))) return 0; + } + catch(...) + { + return 0; + } + return rv; +} + +std::string Marshaller::toString(const SDLRPCMessage* msg) +{ + if(!msg) return ""; + + Json::Value json=toJSON(msg); + + if(json.isNull()) return ""; + + Json::FastWriter writer; + std::string rv; + return writer.write(json); +} + + +SDLRPCMessage* Marshaller::fromJSON(const Json::Value& json) +{ + if(!json.isObject()) return NULL; + Json::Value j=Json::Value(Json::nullValue); + + std::string tp; + if(json.isMember("notification")) j=json[tp="notification"]; + + if(json.isMember("request")) j=json[tp="request"]; + if(json.isMember("response")) j=json[tp="response"]; + + if(!j.isObject()) return NULL; + if(!j.isMember("name") || !j["name"].isString()) return NULL; + + std::string ts=j["name"].asString()+"_"+tp; + + Methods m=getIndex(ts.c_str()); + switch(m) // let's rock, china style + { + case METHOD_INVALID: + return NULL; + + case METHOD_REGISTERAPPINTERFACE_REQUEST: + { + RegisterAppInterface_request* rv=new RegisterAppInterface_request; + if(RegisterAppInterface_requestMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_REGISTERAPPINTERFACE_RESPONSE: + { + RegisterAppInterface_response* rv=new RegisterAppInterface_response; + if(RegisterAppInterface_responseMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_UNREGISTERAPPINTERFACE_REQUEST: + { + UnregisterAppInterface_request* rv=new UnregisterAppInterface_request; + if(UnregisterAppInterface_requestMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_UNREGISTERAPPINTERFACE_RESPONSE: + { + UnregisterAppInterface_response* rv=new UnregisterAppInterface_response; + if(UnregisterAppInterface_responseMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_SETGLOBALPROPERTIES_REQUEST: + { + SetGlobalProperties_request* rv=new SetGlobalProperties_request; + if(SetGlobalProperties_requestMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_SETGLOBALPROPERTIES_RESPONSE: + { + SetGlobalProperties_response* rv=new SetGlobalProperties_response; + if(SetGlobalProperties_responseMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_RESETGLOBALPROPERTIES_REQUEST: + { + ResetGlobalProperties_request* rv=new ResetGlobalProperties_request; + if(ResetGlobalProperties_requestMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_RESETGLOBALPROPERTIES_RESPONSE: + { + ResetGlobalProperties_response* rv=new ResetGlobalProperties_response; + if(ResetGlobalProperties_responseMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_ADDCOMMAND_REQUEST: + { + AddCommand_request* rv=new AddCommand_request; + if(AddCommand_requestMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_ADDCOMMAND_RESPONSE: + { + AddCommand_response* rv=new AddCommand_response; + if(AddCommand_responseMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_DELETECOMMAND_REQUEST: + { + DeleteCommand_request* rv=new DeleteCommand_request; + if(DeleteCommand_requestMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_DELETECOMMAND_RESPONSE: + { + DeleteCommand_response* rv=new DeleteCommand_response; + if(DeleteCommand_responseMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_ADDSUBMENU_REQUEST: + { + AddSubMenu_request* rv=new AddSubMenu_request; + if(AddSubMenu_requestMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_ADDSUBMENU_RESPONSE: + { + AddSubMenu_response* rv=new AddSubMenu_response; + if(AddSubMenu_responseMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_DELETESUBMENU_REQUEST: + { + DeleteSubMenu_request* rv=new DeleteSubMenu_request; + if(DeleteSubMenu_requestMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_DELETESUBMENU_RESPONSE: + { + DeleteSubMenu_response* rv=new DeleteSubMenu_response; + if(DeleteSubMenu_responseMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_CREATEINTERACTIONCHOICESET_REQUEST: + { + CreateInteractionChoiceSet_request* rv=new CreateInteractionChoiceSet_request; + if(CreateInteractionChoiceSet_requestMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_CREATEINTERACTIONCHOICESET_RESPONSE: + { + CreateInteractionChoiceSet_response* rv=new CreateInteractionChoiceSet_response; + if(CreateInteractionChoiceSet_responseMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_PERFORMINTERACTION_REQUEST: + { + PerformInteraction_request* rv=new PerformInteraction_request; + if(PerformInteraction_requestMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_PERFORMINTERACTION_RESPONSE: + { + PerformInteraction_response* rv=new PerformInteraction_response; + if(PerformInteraction_responseMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_DELETEINTERACTIONCHOICESET_REQUEST: + { + DeleteInteractionChoiceSet_request* rv=new DeleteInteractionChoiceSet_request; + if(DeleteInteractionChoiceSet_requestMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_DELETEINTERACTIONCHOICESET_RESPONSE: + { + DeleteInteractionChoiceSet_response* rv=new DeleteInteractionChoiceSet_response; + if(DeleteInteractionChoiceSet_responseMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_ALERT_REQUEST: + { + Alert_request* rv=new Alert_request; + if(Alert_requestMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_ALERT_RESPONSE: + { + Alert_response* rv=new Alert_response; + if(Alert_responseMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_SHOW_REQUEST: + { + Show_request* rv=new Show_request; + if(Show_requestMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_SHOW_RESPONSE: + { + Show_response* rv=new Show_response; + if(Show_responseMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_SPEAK_REQUEST: + { + Speak_request* rv=new Speak_request; + if(Speak_requestMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_SPEAK_RESPONSE: + { + Speak_response* rv=new Speak_response; + if(Speak_responseMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_SETMEDIACLOCKTIMER_REQUEST: + { + SetMediaClockTimer_request* rv=new SetMediaClockTimer_request; + if(SetMediaClockTimer_requestMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_SETMEDIACLOCKTIMER_RESPONSE: + { + SetMediaClockTimer_response* rv=new SetMediaClockTimer_response; + if(SetMediaClockTimer_responseMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_ENCODEDSYNCPDATA_REQUEST: + { + EncodedSyncPData_request* rv=new EncodedSyncPData_request; + if(EncodedSyncPData_requestMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_ENCODEDSYNCPDATA_RESPONSE: + { + EncodedSyncPData_response* rv=new EncodedSyncPData_response; + if(EncodedSyncPData_responseMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_SUBSCRIBEBUTTON_REQUEST: + { + SubscribeButton_request* rv=new SubscribeButton_request; + if(SubscribeButton_requestMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_SUBSCRIBEBUTTON_RESPONSE: + { + SubscribeButton_response* rv=new SubscribeButton_response; + if(SubscribeButton_responseMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_UNSUBSCRIBEBUTTON_REQUEST: + { + UnsubscribeButton_request* rv=new UnsubscribeButton_request; + if(UnsubscribeButton_requestMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_UNSUBSCRIBEBUTTON_RESPONSE: + { + UnsubscribeButton_response* rv=new UnsubscribeButton_response; + if(UnsubscribeButton_responseMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_GENERICRESPONSE_RESPONSE: + { + GenericResponse_response* rv=new GenericResponse_response; + if(GenericResponse_responseMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_ONHMISTATUS: + { + OnHMIStatus* rv=new OnHMIStatus; + if(OnHMIStatusMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_ONAPPINTERFACEUNREGISTERED: + { + OnAppInterfaceUnregistered* rv=new OnAppInterfaceUnregistered; + if(OnAppInterfaceUnregisteredMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_ONBUTTONEVENT: + { + OnButtonEvent* rv=new OnButtonEvent; + if(OnButtonEventMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_ONBUTTONPRESS: + { + OnButtonPress* rv=new OnButtonPress; + if(OnButtonPressMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_ONCOMMAND: + { + OnCommand* rv=new OnCommand; + if(OnCommandMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_ONENCODEDSYNCPDATA: + { + OnEncodedSyncPData* rv=new OnEncodedSyncPData; + if(OnEncodedSyncPDataMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_ONTBTCLIENTSTATE: + { + OnTBTClientState* rv=new OnTBTClientState; + if(OnTBTClientStateMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + + case METHOD_ONDRIVERDISTRACTION: + { + OnDriverDistraction* rv=new OnDriverDistraction; + if(OnDriverDistractionMarshaller::fromJSON(json,*rv)) + return rv; + delete rv; + return NULL; + } + } + + return NULL; +} + +Json::Value Marshaller::toJSON(const SDLRPCMessage* msg) +{ + Json::Value j=Json::Value(Json::nullValue); + + if(!msg) return j; + Methods m=static_cast<Methods>(msg->getMethodId()); + + switch(m) + { + case METHOD_REGISTERAPPINTERFACE_REQUEST: + return RegisterAppInterface_requestMarshaller::toJSON(* static_cast<const RegisterAppInterface_request*>(msg)); + + case METHOD_REGISTERAPPINTERFACE_RESPONSE: + return RegisterAppInterface_responseMarshaller::toJSON(* static_cast<const RegisterAppInterface_response*>(msg)); + + case METHOD_UNREGISTERAPPINTERFACE_REQUEST: + return UnregisterAppInterface_requestMarshaller::toJSON(* static_cast<const UnregisterAppInterface_request*>(msg)); + + case METHOD_UNREGISTERAPPINTERFACE_RESPONSE: + return UnregisterAppInterface_responseMarshaller::toJSON(* static_cast<const UnregisterAppInterface_response*>(msg)); + + case METHOD_SETGLOBALPROPERTIES_REQUEST: + return SetGlobalProperties_requestMarshaller::toJSON(* static_cast<const SetGlobalProperties_request*>(msg)); + + case METHOD_SETGLOBALPROPERTIES_RESPONSE: + return SetGlobalProperties_responseMarshaller::toJSON(* static_cast<const SetGlobalProperties_response*>(msg)); + + case METHOD_RESETGLOBALPROPERTIES_REQUEST: + return ResetGlobalProperties_requestMarshaller::toJSON(* static_cast<const ResetGlobalProperties_request*>(msg)); + + case METHOD_RESETGLOBALPROPERTIES_RESPONSE: + return ResetGlobalProperties_responseMarshaller::toJSON(* static_cast<const ResetGlobalProperties_response*>(msg)); + + case METHOD_ADDCOMMAND_REQUEST: + return AddCommand_requestMarshaller::toJSON(* static_cast<const AddCommand_request*>(msg)); + + case METHOD_ADDCOMMAND_RESPONSE: + return AddCommand_responseMarshaller::toJSON(* static_cast<const AddCommand_response*>(msg)); + + case METHOD_DELETECOMMAND_REQUEST: + return DeleteCommand_requestMarshaller::toJSON(* static_cast<const DeleteCommand_request*>(msg)); + + case METHOD_DELETECOMMAND_RESPONSE: + return DeleteCommand_responseMarshaller::toJSON(* static_cast<const DeleteCommand_response*>(msg)); + + case METHOD_ADDSUBMENU_REQUEST: + return AddSubMenu_requestMarshaller::toJSON(* static_cast<const AddSubMenu_request*>(msg)); + + case METHOD_ADDSUBMENU_RESPONSE: + return AddSubMenu_responseMarshaller::toJSON(* static_cast<const AddSubMenu_response*>(msg)); + + case METHOD_DELETESUBMENU_REQUEST: + return DeleteSubMenu_requestMarshaller::toJSON(* static_cast<const DeleteSubMenu_request*>(msg)); + + case METHOD_DELETESUBMENU_RESPONSE: + return DeleteSubMenu_responseMarshaller::toJSON(* static_cast<const DeleteSubMenu_response*>(msg)); + + case METHOD_CREATEINTERACTIONCHOICESET_REQUEST: + return CreateInteractionChoiceSet_requestMarshaller::toJSON(* static_cast<const CreateInteractionChoiceSet_request*>(msg)); + + case METHOD_CREATEINTERACTIONCHOICESET_RESPONSE: + return CreateInteractionChoiceSet_responseMarshaller::toJSON(* static_cast<const CreateInteractionChoiceSet_response*>(msg)); + + case METHOD_PERFORMINTERACTION_REQUEST: + return PerformInteraction_requestMarshaller::toJSON(* static_cast<const PerformInteraction_request*>(msg)); + + case METHOD_PERFORMINTERACTION_RESPONSE: + return PerformInteraction_responseMarshaller::toJSON(* static_cast<const PerformInteraction_response*>(msg)); + + case METHOD_DELETEINTERACTIONCHOICESET_REQUEST: + return DeleteInteractionChoiceSet_requestMarshaller::toJSON(* static_cast<const DeleteInteractionChoiceSet_request*>(msg)); + + case METHOD_DELETEINTERACTIONCHOICESET_RESPONSE: + return DeleteInteractionChoiceSet_responseMarshaller::toJSON(* static_cast<const DeleteInteractionChoiceSet_response*>(msg)); + + case METHOD_ALERT_REQUEST: + return Alert_requestMarshaller::toJSON(* static_cast<const Alert_request*>(msg)); + + case METHOD_ALERT_RESPONSE: + return Alert_responseMarshaller::toJSON(* static_cast<const Alert_response*>(msg)); + + case METHOD_SHOW_REQUEST: + return Show_requestMarshaller::toJSON(* static_cast<const Show_request*>(msg)); + + case METHOD_SHOW_RESPONSE: + return Show_responseMarshaller::toJSON(* static_cast<const Show_response*>(msg)); + + case METHOD_SPEAK_REQUEST: + return Speak_requestMarshaller::toJSON(* static_cast<const Speak_request*>(msg)); + + case METHOD_SPEAK_RESPONSE: + return Speak_responseMarshaller::toJSON(* static_cast<const Speak_response*>(msg)); + + case METHOD_SETMEDIACLOCKTIMER_REQUEST: + return SetMediaClockTimer_requestMarshaller::toJSON(* static_cast<const SetMediaClockTimer_request*>(msg)); + + case METHOD_SETMEDIACLOCKTIMER_RESPONSE: + return SetMediaClockTimer_responseMarshaller::toJSON(* static_cast<const SetMediaClockTimer_response*>(msg)); + + case METHOD_ENCODEDSYNCPDATA_REQUEST: + return EncodedSyncPData_requestMarshaller::toJSON(* static_cast<const EncodedSyncPData_request*>(msg)); + + case METHOD_ENCODEDSYNCPDATA_RESPONSE: + return EncodedSyncPData_responseMarshaller::toJSON(* static_cast<const EncodedSyncPData_response*>(msg)); + + case METHOD_SUBSCRIBEBUTTON_REQUEST: + return SubscribeButton_requestMarshaller::toJSON(* static_cast<const SubscribeButton_request*>(msg)); + + case METHOD_SUBSCRIBEBUTTON_RESPONSE: + return SubscribeButton_responseMarshaller::toJSON(* static_cast<const SubscribeButton_response*>(msg)); + + case METHOD_UNSUBSCRIBEBUTTON_REQUEST: + return UnsubscribeButton_requestMarshaller::toJSON(* static_cast<const UnsubscribeButton_request*>(msg)); + + case METHOD_UNSUBSCRIBEBUTTON_RESPONSE: + return UnsubscribeButton_responseMarshaller::toJSON(* static_cast<const UnsubscribeButton_response*>(msg)); + + case METHOD_GENERICRESPONSE_RESPONSE: + return GenericResponse_responseMarshaller::toJSON(* static_cast<const GenericResponse_response*>(msg)); + + case METHOD_ONHMISTATUS: + return OnHMIStatusMarshaller::toJSON(* static_cast<const OnHMIStatus*>(msg)); + + case METHOD_ONAPPINTERFACEUNREGISTERED: + return OnAppInterfaceUnregisteredMarshaller::toJSON(* static_cast<const OnAppInterfaceUnregistered*>(msg)); + + case METHOD_ONBUTTONEVENT: + return OnButtonEventMarshaller::toJSON(* static_cast<const OnButtonEvent*>(msg)); + + case METHOD_ONBUTTONPRESS: + return OnButtonPressMarshaller::toJSON(* static_cast<const OnButtonPress*>(msg)); + + case METHOD_ONCOMMAND: + return OnCommandMarshaller::toJSON(* static_cast<const OnCommand*>(msg)); + + case METHOD_ONENCODEDSYNCPDATA: + return OnEncodedSyncPDataMarshaller::toJSON(* static_cast<const OnEncodedSyncPData*>(msg)); + + case METHOD_ONTBTCLIENTSTATE: + return OnTBTClientStateMarshaller::toJSON(* static_cast<const OnTBTClientState*>(msg)); + + case METHOD_ONDRIVERDISTRACTION: + return OnDriverDistractionMarshaller::toJSON(* static_cast<const OnDriverDistraction*>(msg)); + + case METHOD_INVALID: + default: + return j; + } + + return j; +} + +RegisterAppInterface_requestMarshaller Marshaller::mRegisterAppInterface_request; +RegisterAppInterface_responseMarshaller Marshaller::mRegisterAppInterface_response; +UnregisterAppInterface_requestMarshaller Marshaller::mUnregisterAppInterface_request; +UnregisterAppInterface_responseMarshaller Marshaller::mUnregisterAppInterface_response; +SetGlobalProperties_requestMarshaller Marshaller::mSetGlobalProperties_request; +SetGlobalProperties_responseMarshaller Marshaller::mSetGlobalProperties_response; +ResetGlobalProperties_requestMarshaller Marshaller::mResetGlobalProperties_request; +ResetGlobalProperties_responseMarshaller Marshaller::mResetGlobalProperties_response; +AddCommand_requestMarshaller Marshaller::mAddCommand_request; +AddCommand_responseMarshaller Marshaller::mAddCommand_response; +DeleteCommand_requestMarshaller Marshaller::mDeleteCommand_request; +DeleteCommand_responseMarshaller Marshaller::mDeleteCommand_response; +AddSubMenu_requestMarshaller Marshaller::mAddSubMenu_request; +AddSubMenu_responseMarshaller Marshaller::mAddSubMenu_response; +DeleteSubMenu_requestMarshaller Marshaller::mDeleteSubMenu_request; +DeleteSubMenu_responseMarshaller Marshaller::mDeleteSubMenu_response; +CreateInteractionChoiceSet_requestMarshaller Marshaller::mCreateInteractionChoiceSet_request; +CreateInteractionChoiceSet_responseMarshaller Marshaller::mCreateInteractionChoiceSet_response; +PerformInteraction_requestMarshaller Marshaller::mPerformInteraction_request; +PerformInteraction_responseMarshaller Marshaller::mPerformInteraction_response; +DeleteInteractionChoiceSet_requestMarshaller Marshaller::mDeleteInteractionChoiceSet_request; +DeleteInteractionChoiceSet_responseMarshaller Marshaller::mDeleteInteractionChoiceSet_response; +Alert_requestMarshaller Marshaller::mAlert_request; +Alert_responseMarshaller Marshaller::mAlert_response; +Show_requestMarshaller Marshaller::mShow_request; +Show_responseMarshaller Marshaller::mShow_response; +Speak_requestMarshaller Marshaller::mSpeak_request; +Speak_responseMarshaller Marshaller::mSpeak_response; +SetMediaClockTimer_requestMarshaller Marshaller::mSetMediaClockTimer_request; +SetMediaClockTimer_responseMarshaller Marshaller::mSetMediaClockTimer_response; +EncodedSyncPData_requestMarshaller Marshaller::mEncodedSyncPData_request; +EncodedSyncPData_responseMarshaller Marshaller::mEncodedSyncPData_response; +SubscribeButton_requestMarshaller Marshaller::mSubscribeButton_request; +SubscribeButton_responseMarshaller Marshaller::mSubscribeButton_response; +UnsubscribeButton_requestMarshaller Marshaller::mUnsubscribeButton_request; +UnsubscribeButton_responseMarshaller Marshaller::mUnsubscribeButton_response; +GenericResponse_responseMarshaller Marshaller::mGenericResponse_response; +OnHMIStatusMarshaller Marshaller::mOnHMIStatus; +OnAppInterfaceUnregisteredMarshaller Marshaller::mOnAppInterfaceUnregistered; +OnButtonEventMarshaller Marshaller::mOnButtonEvent; +OnButtonPressMarshaller Marshaller::mOnButtonPress; +OnCommandMarshaller Marshaller::mOnCommand; +OnEncodedSyncPDataMarshaller Marshaller::mOnEncodedSyncPData; +OnTBTClientStateMarshaller Marshaller::mOnTBTClientState; +OnDriverDistractionMarshaller Marshaller::mOnDriverDistraction; + +const Marshaller::localHash Marshaller::mHashTable[45]= +{ + {"RegisterAppInterface_request",METHOD_REGISTERAPPINTERFACE_REQUEST,&Marshaller::mRegisterAppInterface_request}, + {"RegisterAppInterface_response",METHOD_REGISTERAPPINTERFACE_RESPONSE,&Marshaller::mRegisterAppInterface_response}, + {"UnregisterAppInterface_request",METHOD_UNREGISTERAPPINTERFACE_REQUEST,&Marshaller::mUnregisterAppInterface_request}, + {"UnregisterAppInterface_response",METHOD_UNREGISTERAPPINTERFACE_RESPONSE,&Marshaller::mUnregisterAppInterface_response}, + {"SetGlobalProperties_request",METHOD_SETGLOBALPROPERTIES_REQUEST,&Marshaller::mSetGlobalProperties_request}, + {"SetGlobalProperties_response",METHOD_SETGLOBALPROPERTIES_RESPONSE,&Marshaller::mSetGlobalProperties_response}, + {"ResetGlobalProperties_request",METHOD_RESETGLOBALPROPERTIES_REQUEST,&Marshaller::mResetGlobalProperties_request}, + {"ResetGlobalProperties_response",METHOD_RESETGLOBALPROPERTIES_RESPONSE,&Marshaller::mResetGlobalProperties_response}, + {"AddCommand_request",METHOD_ADDCOMMAND_REQUEST,&Marshaller::mAddCommand_request}, + {"AddCommand_response",METHOD_ADDCOMMAND_RESPONSE,&Marshaller::mAddCommand_response}, + {"DeleteCommand_request",METHOD_DELETECOMMAND_REQUEST,&Marshaller::mDeleteCommand_request}, + {"DeleteCommand_response",METHOD_DELETECOMMAND_RESPONSE,&Marshaller::mDeleteCommand_response}, + {"AddSubMenu_request",METHOD_ADDSUBMENU_REQUEST,&Marshaller::mAddSubMenu_request}, + {"AddSubMenu_response",METHOD_ADDSUBMENU_RESPONSE,&Marshaller::mAddSubMenu_response}, + {"DeleteSubMenu_request",METHOD_DELETESUBMENU_REQUEST,&Marshaller::mDeleteSubMenu_request}, + {"DeleteSubMenu_response",METHOD_DELETESUBMENU_RESPONSE,&Marshaller::mDeleteSubMenu_response}, + {"CreateInteractionChoiceSet_request",METHOD_CREATEINTERACTIONCHOICESET_REQUEST,&Marshaller::mCreateInteractionChoiceSet_request}, + {"CreateInteractionChoiceSet_response",METHOD_CREATEINTERACTIONCHOICESET_RESPONSE,&Marshaller::mCreateInteractionChoiceSet_response}, + {"PerformInteraction_request",METHOD_PERFORMINTERACTION_REQUEST,&Marshaller::mPerformInteraction_request}, + {"PerformInteraction_response",METHOD_PERFORMINTERACTION_RESPONSE,&Marshaller::mPerformInteraction_response}, + {"DeleteInteractionChoiceSet_request",METHOD_DELETEINTERACTIONCHOICESET_REQUEST,&Marshaller::mDeleteInteractionChoiceSet_request}, + {"DeleteInteractionChoiceSet_response",METHOD_DELETEINTERACTIONCHOICESET_RESPONSE,&Marshaller::mDeleteInteractionChoiceSet_response}, + {"Alert_request",METHOD_ALERT_REQUEST,&Marshaller::mAlert_request}, + {"Alert_response",METHOD_ALERT_RESPONSE,&Marshaller::mAlert_response}, + {"Show_request",METHOD_SHOW_REQUEST,&Marshaller::mShow_request}, + {"Show_response",METHOD_SHOW_RESPONSE,&Marshaller::mShow_response}, + {"Speak_request",METHOD_SPEAK_REQUEST,&Marshaller::mSpeak_request}, + {"Speak_response",METHOD_SPEAK_RESPONSE,&Marshaller::mSpeak_response}, + {"SetMediaClockTimer_request",METHOD_SETMEDIACLOCKTIMER_REQUEST,&Marshaller::mSetMediaClockTimer_request}, + {"SetMediaClockTimer_response",METHOD_SETMEDIACLOCKTIMER_RESPONSE,&Marshaller::mSetMediaClockTimer_response}, + {"EncodedSyncPData_request",METHOD_ENCODEDSYNCPDATA_REQUEST,&Marshaller::mEncodedSyncPData_request}, + {"EncodedSyncPData_response",METHOD_ENCODEDSYNCPDATA_RESPONSE,&Marshaller::mEncodedSyncPData_response}, + {"SubscribeButton_request",METHOD_SUBSCRIBEBUTTON_REQUEST,&Marshaller::mSubscribeButton_request}, + {"SubscribeButton_response",METHOD_SUBSCRIBEBUTTON_RESPONSE,&Marshaller::mSubscribeButton_response}, + {"UnsubscribeButton_request",METHOD_UNSUBSCRIBEBUTTON_REQUEST,&Marshaller::mUnsubscribeButton_request}, + {"UnsubscribeButton_response",METHOD_UNSUBSCRIBEBUTTON_RESPONSE,&Marshaller::mUnsubscribeButton_response}, + {"GenericResponse_response",METHOD_GENERICRESPONSE_RESPONSE,&Marshaller::mGenericResponse_response}, + {"OnHMIStatus_notification",METHOD_ONHMISTATUS,&Marshaller::mOnHMIStatus}, + {"OnAppInterfaceUnregistered_notification",METHOD_ONAPPINTERFACEUNREGISTERED,&Marshaller::mOnAppInterfaceUnregistered}, + {"OnButtonEvent_notification",METHOD_ONBUTTONEVENT,&Marshaller::mOnButtonEvent}, + {"OnButtonPress_notification",METHOD_ONBUTTONPRESS,&Marshaller::mOnButtonPress}, + {"OnCommand_notification",METHOD_ONCOMMAND,&Marshaller::mOnCommand}, + {"OnEncodedSyncPData_notification",METHOD_ONENCODEDSYNCPDATA,&Marshaller::mOnEncodedSyncPData}, + {"OnTBTClientState_notification",METHOD_ONTBTCLIENTSTATE,&Marshaller::mOnTBTClientState}, + {"OnDriverDistraction_notification",METHOD_ONDRIVERDISTRACTION,&Marshaller::mOnDriverDistraction} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp new file mode 100644 index 000000000..7ea826391 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp @@ -0,0 +1,62 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name Marshaller_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::Marshaller::localHash +{ + const char *name; + unsigned int idx; + void* method; +}; + +%% +RegisterAppInterface_request,0,&NsSmartDeviceLinkRPC::Marshaller::mRegisterAppInterface_request +RegisterAppInterface_response,1,&NsSmartDeviceLinkRPC::Marshaller::mRegisterAppInterface_response +UnregisterAppInterface_request,2,&NsSmartDeviceLinkRPC::Marshaller::mUnregisterAppInterface_request +UnregisterAppInterface_response,3,&NsSmartDeviceLinkRPC::Marshaller::mUnregisterAppInterface_response +SetGlobalProperties_request,4,&NsSmartDeviceLinkRPC::Marshaller::mSetGlobalProperties_request +SetGlobalProperties_response,5,&NsSmartDeviceLinkRPC::Marshaller::mSetGlobalProperties_response +ResetGlobalProperties_request,6,&NsSmartDeviceLinkRPC::Marshaller::mResetGlobalProperties_request +ResetGlobalProperties_response,7,&NsSmartDeviceLinkRPC::Marshaller::mResetGlobalProperties_response +AddCommand_request,8,&NsSmartDeviceLinkRPC::Marshaller::mAddCommand_request +AddCommand_response,9,&NsSmartDeviceLinkRPC::Marshaller::mAddCommand_response +DeleteCommand_request,10,&NsSmartDeviceLinkRPC::Marshaller::mDeleteCommand_request +DeleteCommand_response,11,&NsSmartDeviceLinkRPC::Marshaller::mDeleteCommand_response +AddSubMenu_request,12,&NsSmartDeviceLinkRPC::Marshaller::mAddSubMenu_request +AddSubMenu_response,13,&NsSmartDeviceLinkRPC::Marshaller::mAddSubMenu_response +DeleteSubMenu_request,14,&NsSmartDeviceLinkRPC::Marshaller::mDeleteSubMenu_request +DeleteSubMenu_response,15,&NsSmartDeviceLinkRPC::Marshaller::mDeleteSubMenu_response +CreateInteractionChoiceSet_request,16,&NsSmartDeviceLinkRPC::Marshaller::mCreateInteractionChoiceSet_request +CreateInteractionChoiceSet_response,17,&NsSmartDeviceLinkRPC::Marshaller::mCreateInteractionChoiceSet_response +PerformInteraction_request,18,&NsSmartDeviceLinkRPC::Marshaller::mPerformInteraction_request +PerformInteraction_response,19,&NsSmartDeviceLinkRPC::Marshaller::mPerformInteraction_response +DeleteInteractionChoiceSet_request,20,&NsSmartDeviceLinkRPC::Marshaller::mDeleteInteractionChoiceSet_request +DeleteInteractionChoiceSet_response,21,&NsSmartDeviceLinkRPC::Marshaller::mDeleteInteractionChoiceSet_response +Alert_request,22,&NsSmartDeviceLinkRPC::Marshaller::mAlert_request +Alert_response,23,&NsSmartDeviceLinkRPC::Marshaller::mAlert_response +Show_request,24,&NsSmartDeviceLinkRPC::Marshaller::mShow_request +Show_response,25,&NsSmartDeviceLinkRPC::Marshaller::mShow_response +Speak_request,26,&NsSmartDeviceLinkRPC::Marshaller::mSpeak_request +Speak_response,27,&NsSmartDeviceLinkRPC::Marshaller::mSpeak_response +SetMediaClockTimer_request,28,&NsSmartDeviceLinkRPC::Marshaller::mSetMediaClockTimer_request +SetMediaClockTimer_response,29,&NsSmartDeviceLinkRPC::Marshaller::mSetMediaClockTimer_response +EncodedSyncPData_request,30,&NsSmartDeviceLinkRPC::Marshaller::mEncodedSyncPData_request +EncodedSyncPData_response,31,&NsSmartDeviceLinkRPC::Marshaller::mEncodedSyncPData_response +SubscribeButton_request,32,&NsSmartDeviceLinkRPC::Marshaller::mSubscribeButton_request +SubscribeButton_response,33,&NsSmartDeviceLinkRPC::Marshaller::mSubscribeButton_response +UnsubscribeButton_request,34,&NsSmartDeviceLinkRPC::Marshaller::mUnsubscribeButton_request +UnsubscribeButton_response,35,&NsSmartDeviceLinkRPC::Marshaller::mUnsubscribeButton_response +GenericResponse_response,36,&NsSmartDeviceLinkRPC::Marshaller::mGenericResponse_response +OnHMIStatus_notification,37,&NsSmartDeviceLinkRPC::Marshaller::mOnHMIStatus +OnAppInterfaceUnregistered_notification,38,&NsSmartDeviceLinkRPC::Marshaller::mOnAppInterfaceUnregistered +OnButtonEvent_notification,39,&NsSmartDeviceLinkRPC::Marshaller::mOnButtonEvent +OnButtonPress_notification,40,&NsSmartDeviceLinkRPC::Marshaller::mOnButtonPress +OnCommand_notification,41,&NsSmartDeviceLinkRPC::Marshaller::mOnCommand +OnEncodedSyncPData_notification,42,&NsSmartDeviceLinkRPC::Marshaller::mOnEncodedSyncPData +OnTBTClientState_notification,43,&NsSmartDeviceLinkRPC::Marshaller::mOnTBTClientState +OnDriverDistraction_notification,44,&NsSmartDeviceLinkRPC::Marshaller::mOnDriverDistraction diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.inc new file mode 100644 index 000000000..a465a4be0 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.inc @@ -0,0 +1,250 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp */ +/* Computed positions: -k'1,10' */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." +#endif + + +#define TOTAL_KEYWORDS 45 +#define MIN_WORD_LENGTH 12 +#define MAX_WORD_LENGTH 39 +#define MIN_HASH_VALUE 12 +#define MAX_HASH_VALUE 79 +/* maximum key range = 68, duplicates = 0 */ + +class Marshaller_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::Marshaller::localHash *getPointer (const char *str, unsigned int len); +}; + +inline unsigned int +Marshaller_intHash::hash (register const char *str, register unsigned int len) +{ + static const unsigned char asso_values[] = + { + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 5, 50, 35, 0, 25, + 80, 30, 80, 80, 80, 80, 80, 40, 80, 5, + 0, 80, 15, 0, 80, 10, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 15, 80, 15, 20, 80, + 15, 0, 80, 80, 80, 0, 80, 80, 20, 0, + 15, 20, 0, 80, 10, 25, 5, 0, 35, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80 + }; + return len + asso_values[(unsigned char)str[9]] + asso_values[(unsigned char)str[0]]; +} + +const struct NsSmartDeviceLinkRPC::Marshaller::localHash * +Marshaller_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, + 14, 0, 0, 0, 13, 14, 0, 21, 22, 18, 19, 0, 0, 27, + 28, 24, 0, 26, 27, 13, 34, 35, 31, 32, 18, 19, 0, 26, + 22, 28, 29, 0, 26, 27, 0, 29, 30, 31, 0, 0, 39, 25, + 26, 0, 0, 29, 30, 21, 22, 0, 24, 25, 26, 0, 0, 34, + 35, 0, 0, 23, 24, 0, 0, 0, 0, 24 + }; + static const struct NsSmartDeviceLinkRPC::Marshaller::localHash wordlist[] = + { + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, +#line 42 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"Show_request",24,&NsSmartDeviceLinkRPC::Marshaller::mShow_request}, +#line 44 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"Speak_request",26,&NsSmartDeviceLinkRPC::Marshaller::mSpeak_request}, +#line 45 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"Speak_response",27,&NsSmartDeviceLinkRPC::Marshaller::mSpeak_response}, + {""}, {""}, {""}, +#line 40 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"Alert_request",22,&NsSmartDeviceLinkRPC::Marshaller::mAlert_request}, +#line 41 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"Alert_response",23,&NsSmartDeviceLinkRPC::Marshaller::mAlert_response}, + {""}, +#line 28 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"DeleteCommand_request",10,&NsSmartDeviceLinkRPC::Marshaller::mDeleteCommand_request}, +#line 29 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"DeleteCommand_response",11,&NsSmartDeviceLinkRPC::Marshaller::mDeleteCommand_response}, +#line 30 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"AddSubMenu_request",12,&NsSmartDeviceLinkRPC::Marshaller::mAddSubMenu_request}, +#line 31 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"AddSubMenu_response",13,&NsSmartDeviceLinkRPC::Marshaller::mAddSubMenu_response}, + {""}, {""}, +#line 22 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"SetGlobalProperties_request",4,&NsSmartDeviceLinkRPC::Marshaller::mSetGlobalProperties_request}, +#line 23 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"SetGlobalProperties_response",5,&NsSmartDeviceLinkRPC::Marshaller::mSetGlobalProperties_response}, +#line 55 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"OnHMIStatus_notification",37,&NsSmartDeviceLinkRPC::Marshaller::mOnHMIStatus}, + {""}, +#line 36 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"PerformInteraction_request",18,&NsSmartDeviceLinkRPC::Marshaller::mPerformInteraction_request}, +#line 37 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"PerformInteraction_response",19,&NsSmartDeviceLinkRPC::Marshaller::mPerformInteraction_response}, +#line 43 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"Show_response",25,&NsSmartDeviceLinkRPC::Marshaller::mShow_response}, +#line 38 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"DeleteInteractionChoiceSet_request",20,&NsSmartDeviceLinkRPC::Marshaller::mDeleteInteractionChoiceSet_request}, +#line 39 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"DeleteInteractionChoiceSet_response",21,&NsSmartDeviceLinkRPC::Marshaller::mDeleteInteractionChoiceSet_response}, +#line 60 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"OnEncodedSyncPData_notification",42,&NsSmartDeviceLinkRPC::Marshaller::mOnEncodedSyncPData}, +#line 62 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"OnDriverDistraction_notification",44,&NsSmartDeviceLinkRPC::Marshaller::mOnDriverDistraction}, +#line 26 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"AddCommand_request",8,&NsSmartDeviceLinkRPC::Marshaller::mAddCommand_request}, +#line 27 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"AddCommand_response",9,&NsSmartDeviceLinkRPC::Marshaller::mAddCommand_response}, + {""}, +#line 58 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"OnButtonPress_notification",40,&NsSmartDeviceLinkRPC::Marshaller::mOnButtonPress}, +#line 59 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"OnCommand_notification",41,&NsSmartDeviceLinkRPC::Marshaller::mOnCommand}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"RegisterAppInterface_request",0,&NsSmartDeviceLinkRPC::Marshaller::mRegisterAppInterface_request}, +#line 19 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"RegisterAppInterface_response",1,&NsSmartDeviceLinkRPC::Marshaller::mRegisterAppInterface_response}, + {""}, +#line 46 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"SetMediaClockTimer_request",28,&NsSmartDeviceLinkRPC::Marshaller::mSetMediaClockTimer_request}, +#line 47 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"SetMediaClockTimer_response",29,&NsSmartDeviceLinkRPC::Marshaller::mSetMediaClockTimer_response}, + {""}, +#line 61 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"OnTBTClientState_notification",43,&NsSmartDeviceLinkRPC::Marshaller::mOnTBTClientState}, +#line 20 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"UnregisterAppInterface_request",2,&NsSmartDeviceLinkRPC::Marshaller::mUnregisterAppInterface_request}, +#line 21 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"UnregisterAppInterface_response",3,&NsSmartDeviceLinkRPC::Marshaller::mUnregisterAppInterface_response}, + {""}, {""}, +#line 56 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"OnAppInterfaceUnregistered_notification",38,&NsSmartDeviceLinkRPC::Marshaller::mOnAppInterfaceUnregistered}, +#line 52 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"UnsubscribeButton_request",34,&NsSmartDeviceLinkRPC::Marshaller::mUnsubscribeButton_request}, +#line 53 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"UnsubscribeButton_response",35,&NsSmartDeviceLinkRPC::Marshaller::mUnsubscribeButton_response}, + {""}, {""}, +#line 24 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"ResetGlobalProperties_request",6,&NsSmartDeviceLinkRPC::Marshaller::mResetGlobalProperties_request}, +#line 25 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"ResetGlobalProperties_response",7,&NsSmartDeviceLinkRPC::Marshaller::mResetGlobalProperties_response}, +#line 32 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"DeleteSubMenu_request",14,&NsSmartDeviceLinkRPC::Marshaller::mDeleteSubMenu_request}, +#line 33 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"DeleteSubMenu_response",15,&NsSmartDeviceLinkRPC::Marshaller::mDeleteSubMenu_response}, + {""}, +#line 48 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"EncodedSyncPData_request",30,&NsSmartDeviceLinkRPC::Marshaller::mEncodedSyncPData_request}, +#line 49 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"EncodedSyncPData_response",31,&NsSmartDeviceLinkRPC::Marshaller::mEncodedSyncPData_response}, +#line 57 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"OnButtonEvent_notification",39,&NsSmartDeviceLinkRPC::Marshaller::mOnButtonEvent}, + {""}, {""}, +#line 34 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"CreateInteractionChoiceSet_request",16,&NsSmartDeviceLinkRPC::Marshaller::mCreateInteractionChoiceSet_request}, +#line 35 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"CreateInteractionChoiceSet_response",17,&NsSmartDeviceLinkRPC::Marshaller::mCreateInteractionChoiceSet_response}, + {""}, {""}, +#line 50 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"SubscribeButton_request",32,&NsSmartDeviceLinkRPC::Marshaller::mSubscribeButton_request}, +#line 51 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"SubscribeButton_response",33,&NsSmartDeviceLinkRPC::Marshaller::mSubscribeButton_response}, + {""}, {""}, {""}, {""}, +#line 54 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Marshaller.gp" + {"GenericResponse_response",36,&NsSmartDeviceLinkRPC::Marshaller::mGenericResponse_response} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MediaClockFormatMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MediaClockFormatMarshaller.cpp new file mode 100644 index 000000000..d3a80afa7 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MediaClockFormatMarshaller.cpp @@ -0,0 +1,111 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/MediaClockFormat.h" +#include "MediaClockFormatMarshaller.h" +#include "MediaClockFormatMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const MediaClockFormat::MediaClockFormatInternal MediaClockFormatMarshaller::getIndex(const char* s) +{ + if(!s) + return MediaClockFormat::INVALID_ENUM; + const struct PerfectHashTable* p=MediaClockFormat_intHash::getPointer(s,strlen(s)); + return p ? static_cast<MediaClockFormat::MediaClockFormatInternal>(p->idx) : MediaClockFormat::INVALID_ENUM; +} + + +bool MediaClockFormatMarshaller::fromJSON(const Json::Value& s,MediaClockFormat& e) +{ + e.mInternal=MediaClockFormat::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=MediaClockFormat::INVALID_ENUM); +} + + +Json::Value MediaClockFormatMarshaller::toJSON(const MediaClockFormat& e) +{ + if(e.mInternal==MediaClockFormat::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool MediaClockFormatMarshaller::fromString(const std::string& s,MediaClockFormat& e) +{ + e.mInternal=MediaClockFormat::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string MediaClockFormatMarshaller::toString(const MediaClockFormat& e) +{ + Json::FastWriter writer; + return e.mInternal==MediaClockFormat::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable MediaClockFormatMarshaller::mHashTable[5]= +{ + {"CLOCK1",0}, + {"CLOCK2",1}, + {"CLOCKTEXT1",2}, + {"CLOCKTEXT2",3}, + {"CLOCKTEXT3",4} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MediaClockFormatMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MediaClockFormatMarshaller.gp new file mode 100644 index 000000000..3b13495cd --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MediaClockFormatMarshaller.gp @@ -0,0 +1,21 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name MediaClockFormat_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +CLOCK1,0 +CLOCK2,1 +CLOCKTEXT1,2 +CLOCKTEXT2,3 +CLOCKTEXT3,4 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MediaClockFormatMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MediaClockFormatMarshaller.h new file mode 100644 index 000000000..bc5bfea77 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MediaClockFormatMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_MEDIACLOCKFORMATMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_MEDIACLOCKFORMATMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/MediaClockFormat.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for MediaClockFormat + + class MediaClockFormatMarshaller + { + public: + + static std::string toName(const MediaClockFormat& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(MediaClockFormat& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=MediaClockFormat::INVALID_ENUM; + } + + static bool checkIntegrity(MediaClockFormat& e) { return e.mInternal!=MediaClockFormat::INVALID_ENUM; } + static bool checkIntegrityConst(const MediaClockFormat& e) { return e.mInternal!=MediaClockFormat::INVALID_ENUM; } + + static bool fromString(const std::string& s,MediaClockFormat& e); + static const std::string toString(const MediaClockFormat& e); + + static bool fromJSON(const Json::Value& s,MediaClockFormat& e); + static Json::Value toJSON(const MediaClockFormat& e); + + static const char* getName(MediaClockFormat::MediaClockFormatInternal e) + { + return (e>=0 && e<5) ? mHashTable[e].name : NULL; + } + + static const MediaClockFormat::MediaClockFormatInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[5]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MediaClockFormatMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MediaClockFormatMarshaller.inc new file mode 100644 index 000000000..926a346db --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MediaClockFormatMarshaller.inc @@ -0,0 +1,157 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MediaClockFormatMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MediaClockFormatMarshaller.gp */ +/* Computed positions: -k'$' */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." +#endif + + +#define TOTAL_KEYWORDS 5 +#define MIN_WORD_LENGTH 6 +#define MAX_WORD_LENGTH 10 +#define MIN_HASH_VALUE 6 +#define MAX_HASH_VALUE 15 +/* maximum key range = 10, duplicates = 0 */ + +namespace NsSmartDeviceLinkRPC { + +class MediaClockFormat_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline unsigned int +MediaClockFormat_intHash::hash (register const char *str, register unsigned int len) +{ + static const unsigned char asso_values[] = + { + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 5, + 0, 2, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16 + }; + return len + asso_values[(unsigned char)str[len - 1]]; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +MediaClockFormat_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 10, 6, 10, 0, + 0, 10 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, {""}, {""}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MediaClockFormatMarshaller.gp" + {"CLOCK2",1}, + {""}, {""}, {""}, +#line 20 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MediaClockFormatMarshaller.gp" + {"CLOCKTEXT2",3}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MediaClockFormatMarshaller.gp" + {"CLOCK1",0}, +#line 21 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MediaClockFormatMarshaller.gp" + {"CLOCKTEXT3",4}, + {""}, {""}, +#line 19 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MediaClockFormatMarshaller.gp" + {"CLOCKTEXT1",2} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MenuParams.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MenuParams.cpp new file mode 100644 index 000000000..ce0169fc2 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MenuParams.cpp @@ -0,0 +1,149 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/MenuParams.h" +#include "MenuParamsMarshaller.h" + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + + + +using namespace NsSmartDeviceLinkRPC; + +MenuParams& MenuParams::operator =(const MenuParams& c) +{ + menuName=c.menuName; + parentID=c.parentID ? new unsigned int(c.parentID[0]) : 0; + position=c.position ? new unsigned int(c.position[0]) : 0; + + return *this; +} + + +MenuParams::~MenuParams(void) +{ + if(parentID) + delete parentID; + if(position) + delete position; +} + + +MenuParams::MenuParams(const MenuParams& c) +{ + *this=c; +} + + +bool MenuParams::checkIntegrity(void) +{ + return MenuParamsMarshaller::checkIntegrity(*this); +} + + +MenuParams::MenuParams(void) : + parentID(0), + position(0) +{ +} + + + +bool MenuParams::set_menuName(const std::string& menuName_) +{ + if(menuName_.length()>500) return false; + menuName=menuName_; + return true; +} + +bool MenuParams::set_parentID(unsigned int parentID_) +{ + if(parentID_>2000000000) return false; + delete parentID; + parentID=0; + + parentID=new unsigned int(parentID_); + return true; +} + +void MenuParams::reset_parentID(void) +{ + if(parentID) + delete parentID; + parentID=0; +} + +bool MenuParams::set_position(unsigned int position_) +{ + if(position_>1000) return false; + delete position; + position=0; + + position=new unsigned int(position_); + return true; +} + +void MenuParams::reset_position(void) +{ + if(position) + delete position; + position=0; +} + + + + +const std::string& MenuParams::get_menuName(void) const +{ + return menuName; +} + + +const unsigned int* MenuParams::get_parentID(void) const +{ + return parentID; +} + + +const unsigned int* MenuParams::get_position(void) const +{ + return position; +} + + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MenuParamsMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MenuParamsMarshaller.cpp new file mode 100644 index 000000000..d90f153f4 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MenuParamsMarshaller.cpp @@ -0,0 +1,146 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/MenuParams.h" + + +#include "MenuParamsMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool MenuParamsMarshaller::checkIntegrity(MenuParams& s) +{ + return checkIntegrityConst(s); +} + + +bool MenuParamsMarshaller::fromString(const std::string& s,MenuParams& 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 MenuParamsMarshaller::toString(const MenuParams& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool MenuParamsMarshaller::checkIntegrityConst(const MenuParams& s) +{ + if(s.menuName.length()>500) return false; + if(s.parentID && *s.parentID>2000000000) return false; + if(s.position && *s.position>1000) return false; + return true; +} + +Json::Value MenuParamsMarshaller::toJSON(const MenuParams& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["menuName"]=Json::Value(e.menuName); + + if(e.parentID) + json["parentID"]=Json::Value(*e.parentID); + + if(e.position) + json["position"]=Json::Value(*e.position); + + + return json; +} + + +bool MenuParamsMarshaller::fromJSON(const Json::Value& json,MenuParams& c) +{ + if(c.parentID) delete c.parentID; + c.parentID=0; + + if(c.position) delete c.position; + c.position=0; + + try + { + if(!json.isObject()) return false; + + if(!json.isMember("menuName")) return false; + { + const Json::Value& j=json["menuName"]; + if(!j.isString()) return false; + c.menuName=j.asString(); + } + if(json.isMember("parentID")) + { + const Json::Value& j=json["parentID"]; + if(!j.isInt()) return false; + c.parentID=new unsigned int(j.asInt()); + } + if(json.isMember("position")) + { + const Json::Value& j=json["position"]; + if(!j.isInt()) return false; + c.position=new unsigned int(j.asInt()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MenuParamsMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MenuParamsMarshaller.h new file mode 100644 index 000000000..4a1f85169 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/MenuParamsMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_MENUPARAMSMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_MENUPARAMSMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/MenuParams.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct MenuParamsMarshaller + { + static bool checkIntegrity(MenuParams& e); + static bool checkIntegrityConst(const MenuParams& e); + + static bool fromString(const std::string& s,MenuParams& e); + static const std::string toString(const MenuParams& e); + + static bool fromJSON(const Json::Value& s,MenuParams& e); + static Json::Value toJSON(const MenuParams& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnAppInterfaceUnregistered.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnAppInterfaceUnregistered.cpp new file mode 100644 index 000000000..b426003ef --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnAppInterfaceUnregistered.cpp @@ -0,0 +1,89 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/OnAppInterfaceUnregistered.h" +#include "OnAppInterfaceUnregisteredMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "AppInterfaceUnregisteredReasonMarshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + +OnAppInterfaceUnregistered::~OnAppInterfaceUnregistered(void) +{ +} + + +OnAppInterfaceUnregistered::OnAppInterfaceUnregistered(const OnAppInterfaceUnregistered& c) +{ + *this=c; +} + + +bool OnAppInterfaceUnregistered::checkIntegrity(void) +{ + return OnAppInterfaceUnregisteredMarshaller::checkIntegrity(*this); +} + + +OnAppInterfaceUnregistered::OnAppInterfaceUnregistered(void) : SDLRPCNotification(PROTOCOL_VERSION,Marshaller::METHOD_ONAPPINTERFACEUNREGISTERED) +{ +} + + + +bool OnAppInterfaceUnregistered::set_reason(const AppInterfaceUnregisteredReason& reason_) +{ + if(!AppInterfaceUnregisteredReasonMarshaller::checkIntegrityConst(reason_)) return false; + reason=reason_; + return true; +} + + + + +const AppInterfaceUnregisteredReason& OnAppInterfaceUnregistered::get_reason(void) const +{ + return reason; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnAppInterfaceUnregisteredMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnAppInterfaceUnregisteredMarshaller.cpp new file mode 100644 index 000000000..1241d1a37 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnAppInterfaceUnregisteredMarshaller.cpp @@ -0,0 +1,135 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/OnAppInterfaceUnregistered.h" +#include "AppInterfaceUnregisteredReasonMarshaller.h" + +#include "OnAppInterfaceUnregisteredMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool OnAppInterfaceUnregisteredMarshaller::checkIntegrity(OnAppInterfaceUnregistered& s) +{ + return checkIntegrityConst(s); +} + + +bool OnAppInterfaceUnregisteredMarshaller::fromString(const std::string& s,OnAppInterfaceUnregistered& 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 OnAppInterfaceUnregisteredMarshaller::toString(const OnAppInterfaceUnregistered& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool OnAppInterfaceUnregisteredMarshaller::checkIntegrityConst(const OnAppInterfaceUnregistered& s) +{ + if(!AppInterfaceUnregisteredReasonMarshaller::checkIntegrityConst(s.reason)) return false; + return true; +} + +Json::Value OnAppInterfaceUnregisteredMarshaller::toJSON(const OnAppInterfaceUnregistered& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["notification"]=Json::Value(Json::objectValue); + json["notification"]["name"]=Json::Value("OnAppInterfaceUnregistered"); + + Json::Value j=Json::Value(Json::objectValue); + + j["reason"]=AppInterfaceUnregisteredReasonMarshaller::toJSON(e.reason); + + json["notification"]["parameters"]=j; + return json; +} + + +bool OnAppInterfaceUnregisteredMarshaller::fromJSON(const Json::Value& js,OnAppInterfaceUnregistered& c) +{ + try + { + if(!js.isObject()) return false; + + if(!js.isMember("notification")) return false; + + if(!js["notification"].isObject()) return false; + const Json::Value& j2=js["notification"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("OnAppInterfaceUnregistered")) return false; + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("reason")) return false; + { + const Json::Value& j=json["reason"]; + if(!AppInterfaceUnregisteredReasonMarshaller::fromJSON(j,c.reason)) + return false; + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnAppInterfaceUnregisteredMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnAppInterfaceUnregisteredMarshaller.h new file mode 100644 index 000000000..1be620084 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnAppInterfaceUnregisteredMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_ONAPPINTERFACEUNREGISTEREDMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_ONAPPINTERFACEUNREGISTEREDMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/OnAppInterfaceUnregistered.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct OnAppInterfaceUnregisteredMarshaller + { + static bool checkIntegrity(OnAppInterfaceUnregistered& e); + static bool checkIntegrityConst(const OnAppInterfaceUnregistered& e); + + static bool fromString(const std::string& s,OnAppInterfaceUnregistered& e); + static const std::string toString(const OnAppInterfaceUnregistered& e); + + static bool fromJSON(const Json::Value& s,OnAppInterfaceUnregistered& e); + static Json::Value toJSON(const OnAppInterfaceUnregistered& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnButtonEvent.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnButtonEvent.cpp new file mode 100644 index 000000000..eabaeec79 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnButtonEvent.cpp @@ -0,0 +1,102 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/OnButtonEvent.h" +#include "OnButtonEventMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "ButtonEventModeMarshaller.h" +#include "ButtonNameMarshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + +OnButtonEvent::~OnButtonEvent(void) +{ +} + + +OnButtonEvent::OnButtonEvent(const OnButtonEvent& c) +{ + *this=c; +} + + +bool OnButtonEvent::checkIntegrity(void) +{ + return OnButtonEventMarshaller::checkIntegrity(*this); +} + + +OnButtonEvent::OnButtonEvent(void) : SDLRPCNotification(PROTOCOL_VERSION,Marshaller::METHOD_ONBUTTONEVENT) +{ +} + + + +bool OnButtonEvent::set_buttonName(const ButtonName& buttonName_) +{ + if(!ButtonNameMarshaller::checkIntegrityConst(buttonName_)) return false; + buttonName=buttonName_; + return true; +} + +bool OnButtonEvent::set_buttonEventMode(const ButtonEventMode& buttonEventMode_) +{ + if(!ButtonEventModeMarshaller::checkIntegrityConst(buttonEventMode_)) return false; + buttonEventMode=buttonEventMode_; + return true; +} + + + + +const ButtonName& OnButtonEvent::get_buttonName(void) const +{ + return buttonName; +} + +const ButtonEventMode& OnButtonEvent::get_buttonEventMode(void) const +{ + return buttonEventMode; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnButtonEventMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnButtonEventMarshaller.cpp new file mode 100644 index 000000000..4f2bd6e42 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnButtonEventMarshaller.cpp @@ -0,0 +1,145 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/OnButtonEvent.h" +#include "ButtonEventModeMarshaller.h" +#include "ButtonNameMarshaller.h" + +#include "OnButtonEventMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +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(!ButtonNameMarshaller::checkIntegrityConst(s.buttonName)) return false; + if(!ButtonEventModeMarshaller::checkIntegrityConst(s.buttonEventMode)) 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["notification"]=Json::Value(Json::objectValue); + json["notification"]["name"]=Json::Value("OnButtonEvent"); + + Json::Value j=Json::Value(Json::objectValue); + + j["buttonName"]=ButtonNameMarshaller::toJSON(e.buttonName); + + j["buttonEventMode"]=ButtonEventModeMarshaller::toJSON(e.buttonEventMode); + + json["notification"]["parameters"]=j; + return json; +} + + +bool OnButtonEventMarshaller::fromJSON(const Json::Value& js,OnButtonEvent& c) +{ + try + { + if(!js.isObject()) return false; + + if(!js.isMember("notification")) return false; + + if(!js["notification"].isObject()) return false; + const Json::Value& j2=js["notification"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("OnButtonEvent")) return false; + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("buttonName")) return false; + { + const Json::Value& j=json["buttonName"]; + if(!ButtonNameMarshaller::fromJSON(j,c.buttonName)) + return false; + } + if(!json.isMember("buttonEventMode")) return false; + { + const Json::Value& j=json["buttonEventMode"]; + if(!ButtonEventModeMarshaller::fromJSON(j,c.buttonEventMode)) + return false; + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnButtonEventMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnButtonEventMarshaller.h new file mode 100644 index 000000000..a58d1e2cc --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnButtonEventMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_ONBUTTONEVENTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_ONBUTTONEVENTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/OnButtonEvent.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + 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/SDLRPCObjectsImpl/V1/OnButtonPress.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnButtonPress.cpp new file mode 100644 index 000000000..7db8e1354 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnButtonPress.cpp @@ -0,0 +1,102 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/OnButtonPress.h" +#include "OnButtonPressMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "ButtonNameMarshaller.h" +#include "ButtonPressModeMarshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + +OnButtonPress::~OnButtonPress(void) +{ +} + + +OnButtonPress::OnButtonPress(const OnButtonPress& c) +{ + *this=c; +} + + +bool OnButtonPress::checkIntegrity(void) +{ + return OnButtonPressMarshaller::checkIntegrity(*this); +} + + +OnButtonPress::OnButtonPress(void) : SDLRPCNotification(PROTOCOL_VERSION,Marshaller::METHOD_ONBUTTONPRESS) +{ +} + + + +bool OnButtonPress::set_buttonName(const ButtonName& buttonName_) +{ + if(!ButtonNameMarshaller::checkIntegrityConst(buttonName_)) return false; + buttonName=buttonName_; + return true; +} + +bool OnButtonPress::set_buttonPressMode(const ButtonPressMode& buttonPressMode_) +{ + if(!ButtonPressModeMarshaller::checkIntegrityConst(buttonPressMode_)) return false; + buttonPressMode=buttonPressMode_; + return true; +} + + + + +const ButtonName& OnButtonPress::get_buttonName(void) const +{ + return buttonName; +} + +const ButtonPressMode& OnButtonPress::get_buttonPressMode(void) const +{ + return buttonPressMode; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnButtonPressMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnButtonPressMarshaller.cpp new file mode 100644 index 000000000..a46515328 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnButtonPressMarshaller.cpp @@ -0,0 +1,145 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/OnButtonPress.h" +#include "ButtonNameMarshaller.h" +#include "ButtonPressModeMarshaller.h" + +#include "OnButtonPressMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +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(!ButtonNameMarshaller::checkIntegrityConst(s.buttonName)) return false; + if(!ButtonPressModeMarshaller::checkIntegrityConst(s.buttonPressMode)) 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["notification"]=Json::Value(Json::objectValue); + json["notification"]["name"]=Json::Value("OnButtonPress"); + + Json::Value j=Json::Value(Json::objectValue); + + j["buttonName"]=ButtonNameMarshaller::toJSON(e.buttonName); + + j["buttonPressMode"]=ButtonPressModeMarshaller::toJSON(e.buttonPressMode); + + json["notification"]["parameters"]=j; + return json; +} + + +bool OnButtonPressMarshaller::fromJSON(const Json::Value& js,OnButtonPress& c) +{ + try + { + if(!js.isObject()) return false; + + if(!js.isMember("notification")) return false; + + if(!js["notification"].isObject()) return false; + const Json::Value& j2=js["notification"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("OnButtonPress")) return false; + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("buttonName")) return false; + { + const Json::Value& j=json["buttonName"]; + if(!ButtonNameMarshaller::fromJSON(j,c.buttonName)) + return false; + } + if(!json.isMember("buttonPressMode")) return false; + { + const Json::Value& j=json["buttonPressMode"]; + if(!ButtonPressModeMarshaller::fromJSON(j,c.buttonPressMode)) + return false; + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnButtonPressMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnButtonPressMarshaller.h new file mode 100644 index 000000000..766cd8c3e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnButtonPressMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_ONBUTTONPRESSMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_ONBUTTONPRESSMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/OnButtonPress.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + 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/SDLRPCObjectsImpl/V1/OnCommand.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnCommand.cpp new file mode 100644 index 000000000..650f9b108 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnCommand.cpp @@ -0,0 +1,101 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/OnCommand.h" +#include "OnCommandMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "TriggerSourceMarshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + +OnCommand::~OnCommand(void) +{ +} + + +OnCommand::OnCommand(const OnCommand& c) +{ + *this=c; +} + + +bool OnCommand::checkIntegrity(void) +{ + return OnCommandMarshaller::checkIntegrity(*this); +} + + +OnCommand::OnCommand(void) : SDLRPCNotification(PROTOCOL_VERSION,Marshaller::METHOD_ONCOMMAND) +{ +} + + + +bool OnCommand::set_cmdID(unsigned int cmdID_) +{ + if(cmdID_>2000000000) return false; + cmdID=cmdID_; + return true; +} + +bool OnCommand::set_triggerSource(const TriggerSource& triggerSource_) +{ + if(!TriggerSourceMarshaller::checkIntegrityConst(triggerSource_)) return false; + triggerSource=triggerSource_; + return true; +} + + + + +unsigned int OnCommand::get_cmdID(void) const +{ + return cmdID; +} + +const TriggerSource& OnCommand::get_triggerSource(void) const +{ + return triggerSource; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnCommandMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnCommandMarshaller.cpp new file mode 100644 index 000000000..83bac74cc --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnCommandMarshaller.cpp @@ -0,0 +1,144 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/OnCommand.h" +#include "TriggerSourceMarshaller.h" + +#include "OnCommandMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +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; + if(!TriggerSourceMarshaller::checkIntegrityConst(s.triggerSource)) 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["notification"]=Json::Value(Json::objectValue); + json["notification"]["name"]=Json::Value("OnCommand"); + + Json::Value j=Json::Value(Json::objectValue); + + j["cmdID"]=Json::Value(e.cmdID); + + j["triggerSource"]=TriggerSourceMarshaller::toJSON(e.triggerSource); + + json["notification"]["parameters"]=j; + return json; +} + + +bool OnCommandMarshaller::fromJSON(const Json::Value& js,OnCommand& c) +{ + try + { + if(!js.isObject()) return false; + + if(!js.isMember("notification")) return false; + + if(!js["notification"].isObject()) return false; + const Json::Value& j2=js["notification"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("OnCommand")) return false; + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("cmdID")) return false; + { + const Json::Value& j=json["cmdID"]; + if(!j.isInt()) return false; + c.cmdID=j.asInt(); + } + if(!json.isMember("triggerSource")) return false; + { + const Json::Value& j=json["triggerSource"]; + if(!TriggerSourceMarshaller::fromJSON(j,c.triggerSource)) + return false; + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnCommandMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnCommandMarshaller.h new file mode 100644 index 000000000..f39f9d2e8 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnCommandMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_ONCOMMANDMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_ONCOMMANDMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/OnCommand.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + 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/SDLRPCObjectsImpl/V1/OnDriverDistraction.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnDriverDistraction.cpp new file mode 100644 index 000000000..3db16b972 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnDriverDistraction.cpp @@ -0,0 +1,89 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/OnDriverDistraction.h" +#include "OnDriverDistractionMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "DriverDistractionStateMarshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + +OnDriverDistraction::~OnDriverDistraction(void) +{ +} + + +OnDriverDistraction::OnDriverDistraction(const OnDriverDistraction& c) +{ + *this=c; +} + + +bool OnDriverDistraction::checkIntegrity(void) +{ + return OnDriverDistractionMarshaller::checkIntegrity(*this); +} + + +OnDriverDistraction::OnDriverDistraction(void) : SDLRPCNotification(PROTOCOL_VERSION,Marshaller::METHOD_ONDRIVERDISTRACTION) +{ +} + + + +bool OnDriverDistraction::set_state(const DriverDistractionState& state_) +{ + if(!DriverDistractionStateMarshaller::checkIntegrityConst(state_)) return false; + state=state_; + return true; +} + + + + +const DriverDistractionState& OnDriverDistraction::get_state(void) const +{ + return state; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnDriverDistractionMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnDriverDistractionMarshaller.cpp new file mode 100644 index 000000000..eb3602be5 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnDriverDistractionMarshaller.cpp @@ -0,0 +1,135 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/OnDriverDistraction.h" +#include "DriverDistractionStateMarshaller.h" + +#include "OnDriverDistractionMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +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(!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["notification"]=Json::Value(Json::objectValue); + json["notification"]["name"]=Json::Value("OnDriverDistraction"); + + Json::Value j=Json::Value(Json::objectValue); + + j["state"]=DriverDistractionStateMarshaller::toJSON(e.state); + + json["notification"]["parameters"]=j; + return json; +} + + +bool OnDriverDistractionMarshaller::fromJSON(const Json::Value& js,OnDriverDistraction& c) +{ + try + { + if(!js.isObject()) return false; + + if(!js.isMember("notification")) return false; + + if(!js["notification"].isObject()) return false; + const Json::Value& j2=js["notification"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("OnDriverDistraction")) return false; + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("state")) return false; + { + const Json::Value& j=json["state"]; + if(!DriverDistractionStateMarshaller::fromJSON(j,c.state)) + return false; + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnDriverDistractionMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnDriverDistractionMarshaller.h new file mode 100644 index 000000000..5fac52c56 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnDriverDistractionMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_ONDRIVERDISTRACTIONMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_ONDRIVERDISTRACTIONMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/OnDriverDistraction.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + 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/SDLRPCObjectsImpl/V1/OnEncodedSyncPData.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnEncodedSyncPData.cpp new file mode 100644 index 000000000..68614ffaa --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnEncodedSyncPData.cpp @@ -0,0 +1,112 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/OnEncodedSyncPData.h" +#include "OnEncodedSyncPDataMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +OnEncodedSyncPData& OnEncodedSyncPData::operator =(const OnEncodedSyncPData& c) +{ + data= c.data ? new std::vector<std::string>(c.data[0]) : 0; + + return *this;} + + +OnEncodedSyncPData::~OnEncodedSyncPData(void) +{ + if(data) + delete data; +} + + +OnEncodedSyncPData::OnEncodedSyncPData(const OnEncodedSyncPData& c) +{ + *this=c; +} + + +bool OnEncodedSyncPData::checkIntegrity(void) +{ + return OnEncodedSyncPDataMarshaller::checkIntegrity(*this); +} + + +OnEncodedSyncPData::OnEncodedSyncPData(void) : SDLRPCNotification(PROTOCOL_VERSION,Marshaller::METHOD_ONENCODEDSYNCPDATA), + data(0) +{ +} + + + +bool OnEncodedSyncPData::set_data(const std::vector<std::string>& data_) +{ + unsigned int i=data_.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(data_[i].length()>10000) return false; + } + delete data; + data=0; + + data=new std::vector<std::string>(data_); + return true; +} + +void OnEncodedSyncPData::reset_data(void) +{ + if(data) + delete data; + data=0; +} + + + + +const std::vector<std::string>* OnEncodedSyncPData::get_data(void) const +{ + return data; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnEncodedSyncPDataMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnEncodedSyncPDataMarshaller.cpp new file mode 100644 index 000000000..f8a7fc097 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnEncodedSyncPDataMarshaller.cpp @@ -0,0 +1,159 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/OnEncodedSyncPData.h" + + +#include "OnEncodedSyncPDataMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool OnEncodedSyncPDataMarshaller::checkIntegrity(OnEncodedSyncPData& s) +{ + return checkIntegrityConst(s); +} + + +bool OnEncodedSyncPDataMarshaller::fromString(const std::string& s,OnEncodedSyncPData& 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 OnEncodedSyncPDataMarshaller::toString(const OnEncodedSyncPData& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool OnEncodedSyncPDataMarshaller::checkIntegrityConst(const OnEncodedSyncPData& s) +{ + if(s.data) + { + unsigned int i=s.data[0].size(); + if(i>100 || i<1) return false; + while(i--) + { + if(s.data[0][i].length()>10000) return false; + } + } + return true; +} + +Json::Value OnEncodedSyncPDataMarshaller::toJSON(const OnEncodedSyncPData& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["notification"]=Json::Value(Json::objectValue); + json["notification"]["name"]=Json::Value("OnEncodedSyncPData"); + + Json::Value j=Json::Value(Json::objectValue); + + if(e.data) + { + unsigned int sz=e.data->size(); + j["data"]=Json::Value(Json::arrayValue); + j["data"].resize(sz); + for(unsigned int i=0;i<sz;i++) + j["data"][i]=Json::Value(e.data[0][i]); + } + + json["notification"]["parameters"]=j; + return json; +} + + +bool OnEncodedSyncPDataMarshaller::fromJSON(const Json::Value& js,OnEncodedSyncPData& c) +{ + if(c.data) delete c.data; + c.data=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("notification")) return false; + + if(!js["notification"].isObject()) return false; + const Json::Value& j2=js["notification"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("OnEncodedSyncPData")) return false; + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(json.isMember("data")) + { + const Json::Value& j=json["data"]; + if(!j.isArray()) return false; + c.data=new std::vector<std::string>(); + c.data->resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + if(!j[i].isString()) + return false; + else + c.data[0][i]=j[i].asString(); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnEncodedSyncPDataMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnEncodedSyncPDataMarshaller.h new file mode 100644 index 000000000..a06aa4ccf --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnEncodedSyncPDataMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_ONENCODEDSYNCPDATAMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_ONENCODEDSYNCPDATAMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/OnEncodedSyncPData.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct OnEncodedSyncPDataMarshaller + { + static bool checkIntegrity(OnEncodedSyncPData& e); + static bool checkIntegrityConst(const OnEncodedSyncPData& e); + + static bool fromString(const std::string& s,OnEncodedSyncPData& e); + static const std::string toString(const OnEncodedSyncPData& e); + + static bool fromJSON(const Json::Value& s,OnEncodedSyncPData& e); + static Json::Value toJSON(const OnEncodedSyncPData& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnHMIStatus.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnHMIStatus.cpp new file mode 100644 index 000000000..0c723c517 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnHMIStatus.cpp @@ -0,0 +1,115 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/OnHMIStatus.h" +#include "OnHMIStatusMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "AudioStreamingStateMarshaller.h" +#include "HMILevelMarshaller.h" +#include "SystemContextMarshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + +OnHMIStatus::~OnHMIStatus(void) +{ +} + + +OnHMIStatus::OnHMIStatus(const OnHMIStatus& c) +{ + *this=c; +} + + +bool OnHMIStatus::checkIntegrity(void) +{ + return OnHMIStatusMarshaller::checkIntegrity(*this); +} + + +OnHMIStatus::OnHMIStatus(void) : SDLRPCNotification(PROTOCOL_VERSION,Marshaller::METHOD_ONHMISTATUS) +{ +} + + + +bool OnHMIStatus::set_hmiLevel(const HMILevel& hmiLevel_) +{ + if(!HMILevelMarshaller::checkIntegrityConst(hmiLevel_)) return false; + hmiLevel=hmiLevel_; + return true; +} + +bool OnHMIStatus::set_audioStreamingState(const AudioStreamingState& audioStreamingState_) +{ + if(!AudioStreamingStateMarshaller::checkIntegrityConst(audioStreamingState_)) return false; + audioStreamingState=audioStreamingState_; + return true; +} + +bool OnHMIStatus::set_systemContext(const SystemContext& systemContext_) +{ + if(!SystemContextMarshaller::checkIntegrityConst(systemContext_)) return false; + systemContext=systemContext_; + return true; +} + + + + +const HMILevel& OnHMIStatus::get_hmiLevel(void) const +{ + return hmiLevel; +} + +const AudioStreamingState& OnHMIStatus::get_audioStreamingState(void) const +{ + return audioStreamingState; +} + +const SystemContext& OnHMIStatus::get_systemContext(void) const +{ + return systemContext; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnHMIStatusMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnHMIStatusMarshaller.cpp new file mode 100644 index 000000000..d8cbe828e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnHMIStatusMarshaller.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 "../include/JSONHandler/SDLRPCObjects/V1/OnHMIStatus.h" +#include "AudioStreamingStateMarshaller.h" +#include "HMILevelMarshaller.h" +#include "SystemContextMarshaller.h" + +#include "OnHMIStatusMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool OnHMIStatusMarshaller::checkIntegrity(OnHMIStatus& s) +{ + return checkIntegrityConst(s); +} + + +bool OnHMIStatusMarshaller::fromString(const std::string& s,OnHMIStatus& 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 OnHMIStatusMarshaller::toString(const OnHMIStatus& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool OnHMIStatusMarshaller::checkIntegrityConst(const OnHMIStatus& s) +{ + if(!HMILevelMarshaller::checkIntegrityConst(s.hmiLevel)) return false; + if(!AudioStreamingStateMarshaller::checkIntegrityConst(s.audioStreamingState)) return false; + if(!SystemContextMarshaller::checkIntegrityConst(s.systemContext)) return false; + return true; +} + +Json::Value OnHMIStatusMarshaller::toJSON(const OnHMIStatus& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["notification"]=Json::Value(Json::objectValue); + json["notification"]["name"]=Json::Value("OnHMIStatus"); + + Json::Value j=Json::Value(Json::objectValue); + + j["hmiLevel"]=HMILevelMarshaller::toJSON(e.hmiLevel); + + j["audioStreamingState"]=AudioStreamingStateMarshaller::toJSON(e.audioStreamingState); + + j["systemContext"]=SystemContextMarshaller::toJSON(e.systemContext); + + json["notification"]["parameters"]=j; + return json; +} + + +bool OnHMIStatusMarshaller::fromJSON(const Json::Value& js,OnHMIStatus& c) +{ + try + { + if(!js.isObject()) return false; + + if(!js.isMember("notification")) return false; + + if(!js["notification"].isObject()) return false; + const Json::Value& j2=js["notification"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("OnHMIStatus")) return false; + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("hmiLevel")) return false; + { + const Json::Value& j=json["hmiLevel"]; + if(!HMILevelMarshaller::fromJSON(j,c.hmiLevel)) + return false; + } + if(!json.isMember("audioStreamingState")) return false; + { + const Json::Value& j=json["audioStreamingState"]; + if(!AudioStreamingStateMarshaller::fromJSON(j,c.audioStreamingState)) + return false; + } + if(!json.isMember("systemContext")) return false; + { + const Json::Value& j=json["systemContext"]; + if(!SystemContextMarshaller::fromJSON(j,c.systemContext)) + return false; + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnHMIStatusMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnHMIStatusMarshaller.h new file mode 100644 index 000000000..3eae53291 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnHMIStatusMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_ONHMISTATUSMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_ONHMISTATUSMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/OnHMIStatus.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct OnHMIStatusMarshaller + { + static bool checkIntegrity(OnHMIStatus& e); + static bool checkIntegrityConst(const OnHMIStatus& e); + + static bool fromString(const std::string& s,OnHMIStatus& e); + static const std::string toString(const OnHMIStatus& e); + + static bool fromJSON(const Json::Value& s,OnHMIStatus& e); + static Json::Value toJSON(const OnHMIStatus& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnTBTClientState.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnTBTClientState.cpp new file mode 100644 index 000000000..63e1a38b7 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnTBTClientState.cpp @@ -0,0 +1,89 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/OnTBTClientState.h" +#include "OnTBTClientStateMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "TBTStateMarshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + +OnTBTClientState::~OnTBTClientState(void) +{ +} + + +OnTBTClientState::OnTBTClientState(const OnTBTClientState& c) +{ + *this=c; +} + + +bool OnTBTClientState::checkIntegrity(void) +{ + return OnTBTClientStateMarshaller::checkIntegrity(*this); +} + + +OnTBTClientState::OnTBTClientState(void) : SDLRPCNotification(PROTOCOL_VERSION,Marshaller::METHOD_ONTBTCLIENTSTATE) +{ +} + + + +bool OnTBTClientState::set_state(const TBTState& state_) +{ + if(!TBTStateMarshaller::checkIntegrityConst(state_)) return false; + state=state_; + return true; +} + + + + +const TBTState& OnTBTClientState::get_state(void) const +{ + return state; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnTBTClientStateMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnTBTClientStateMarshaller.cpp new file mode 100644 index 000000000..2bb137a3c --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnTBTClientStateMarshaller.cpp @@ -0,0 +1,135 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/OnTBTClientState.h" +#include "TBTStateMarshaller.h" + +#include "OnTBTClientStateMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +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(!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["notification"]=Json::Value(Json::objectValue); + json["notification"]["name"]=Json::Value("OnTBTClientState"); + + Json::Value j=Json::Value(Json::objectValue); + + j["state"]=TBTStateMarshaller::toJSON(e.state); + + json["notification"]["parameters"]=j; + return json; +} + + +bool OnTBTClientStateMarshaller::fromJSON(const Json::Value& js,OnTBTClientState& c) +{ + try + { + if(!js.isObject()) return false; + + if(!js.isMember("notification")) return false; + + if(!js["notification"].isObject()) return false; + const Json::Value& j2=js["notification"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("OnTBTClientState")) return false; + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("state")) return false; + { + const Json::Value& j=json["state"]; + if(!TBTStateMarshaller::fromJSON(j,c.state)) + return false; + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnTBTClientStateMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnTBTClientStateMarshaller.h new file mode 100644 index 000000000..bae0c0461 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/OnTBTClientStateMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_ONTBTCLIENTSTATEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_ONTBTCLIENTSTATEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/OnTBTClientState.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + 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/SDLRPCObjectsImpl/V1/PerfectHashTable.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerfectHashTable.h new file mode 100644 index 000000000..d0da6d495 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerfectHashTable.h @@ -0,0 +1,44 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 PERFECTHASHTABLE_INCLUDE +#define PERFECTHASHTABLE_INCLUDE + +namespace NsSmartDeviceLinkRPC +{ + struct PerfectHashTable + { + const char *name; + unsigned int idx; + }; +} +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerformInteraction_request.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerformInteraction_request.cpp new file mode 100644 index 000000000..95249b10f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerformInteraction_request.cpp @@ -0,0 +1,234 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/PerformInteraction_request.h" +#include "PerformInteraction_requestMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "InteractionModeMarshaller.h" +#include "TTSChunkMarshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +PerformInteraction_request& PerformInteraction_request::operator =(const PerformInteraction_request& c) +{ + initialText= c.initialText; + initialPrompt= c.initialPrompt; + interactionMode= c.interactionMode; + interactionChoiceSetIDList= c.interactionChoiceSetIDList; + helpPrompt= c.helpPrompt ? new std::vector<TTSChunk>(c.helpPrompt[0]) : 0; + timeoutPrompt= c.timeoutPrompt ? new std::vector<TTSChunk>(c.timeoutPrompt[0]) : 0; + timeout= c.timeout ? new unsigned int(c.timeout[0]) : 0; + + return *this;} + + +PerformInteraction_request::~PerformInteraction_request(void) +{ + if(helpPrompt) + delete helpPrompt; + if(timeoutPrompt) + delete timeoutPrompt; + if(timeout) + delete timeout; +} + + +PerformInteraction_request::PerformInteraction_request(const PerformInteraction_request& c) +{ + *this=c; +} + + +bool PerformInteraction_request::checkIntegrity(void) +{ + return PerformInteraction_requestMarshaller::checkIntegrity(*this); +} + + +PerformInteraction_request::PerformInteraction_request(void) : SDLRPCRequest(PROTOCOL_VERSION,Marshaller::METHOD_PERFORMINTERACTION_REQUEST), + helpPrompt(0), + timeoutPrompt(0), + timeout(0) +{ +} + + + +bool PerformInteraction_request::set_initialText(const std::string& initialText_) +{ + if(initialText_.length()>500) return false; + initialText=initialText_; + return true; +} + +bool PerformInteraction_request::set_initialPrompt(const std::vector<TTSChunk>& initialPrompt_) +{ + unsigned int i=initialPrompt_.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!TTSChunkMarshaller::checkIntegrityConst(initialPrompt_[i])) return false; + } + initialPrompt=initialPrompt_; + return true; +} + +bool PerformInteraction_request::set_interactionMode(const InteractionMode& interactionMode_) +{ + if(!InteractionModeMarshaller::checkIntegrityConst(interactionMode_)) return false; + interactionMode=interactionMode_; + return true; +} + +bool PerformInteraction_request::set_interactionChoiceSetIDList(const std::vector<unsigned int>& interactionChoiceSetIDList_) +{ + unsigned int i=interactionChoiceSetIDList_.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(interactionChoiceSetIDList_[i]>2000000000) return false; + } + interactionChoiceSetIDList=interactionChoiceSetIDList_; + return true; +} + +bool PerformInteraction_request::set_helpPrompt(const std::vector<TTSChunk>& helpPrompt_) +{ + unsigned int i=helpPrompt_.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!TTSChunkMarshaller::checkIntegrityConst(helpPrompt_[i])) return false; + } + delete helpPrompt; + helpPrompt=0; + + helpPrompt=new std::vector<TTSChunk>(helpPrompt_); + return true; +} + +void PerformInteraction_request::reset_helpPrompt(void) +{ + if(helpPrompt) + delete helpPrompt; + helpPrompt=0; +} + +bool PerformInteraction_request::set_timeoutPrompt(const std::vector<TTSChunk>& timeoutPrompt_) +{ + unsigned int i=timeoutPrompt_.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!TTSChunkMarshaller::checkIntegrityConst(timeoutPrompt_[i])) return false; + } + delete timeoutPrompt; + timeoutPrompt=0; + + timeoutPrompt=new std::vector<TTSChunk>(timeoutPrompt_); + return true; +} + +void PerformInteraction_request::reset_timeoutPrompt(void) +{ + if(timeoutPrompt) + delete timeoutPrompt; + timeoutPrompt=0; +} + +bool PerformInteraction_request::set_timeout(unsigned int timeout_) +{ + if(timeout_>100000) return false; + if(timeout_<5000) return false; + delete timeout; + timeout=0; + + timeout=new unsigned int(timeout_); + return true; +} + +void PerformInteraction_request::reset_timeout(void) +{ + if(timeout) + delete timeout; + timeout=0; +} + + + + +const std::string& PerformInteraction_request::get_initialText(void) const +{ + return initialText; +} + +const std::vector<TTSChunk>& PerformInteraction_request::get_initialPrompt(void) const +{ + return initialPrompt; +} + +const InteractionMode& PerformInteraction_request::get_interactionMode(void) const +{ + return interactionMode; +} + +const std::vector<unsigned int>& PerformInteraction_request::get_interactionChoiceSetIDList(void) const +{ + return interactionChoiceSetIDList; +} + +const std::vector<TTSChunk>* PerformInteraction_request::get_helpPrompt(void) const +{ + return helpPrompt; +} + +const std::vector<TTSChunk>* PerformInteraction_request::get_timeoutPrompt(void) const +{ + return timeoutPrompt; +} + +const unsigned int* PerformInteraction_request::get_timeout(void) const +{ + return timeout; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerformInteraction_requestMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerformInteraction_requestMarshaller.cpp new file mode 100644 index 000000000..a5d8b86ce --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerformInteraction_requestMarshaller.cpp @@ -0,0 +1,285 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/PerformInteraction_request.h" +#include "InteractionModeMarshaller.h" +#include "TTSChunkMarshaller.h" + +#include "PerformInteraction_requestMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool PerformInteraction_requestMarshaller::checkIntegrity(PerformInteraction_request& s) +{ + return checkIntegrityConst(s); +} + + +bool PerformInteraction_requestMarshaller::fromString(const std::string& s,PerformInteraction_request& 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 PerformInteraction_requestMarshaller::toString(const PerformInteraction_request& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool PerformInteraction_requestMarshaller::checkIntegrityConst(const PerformInteraction_request& s) +{ + if(s.initialText.length()>500) return false; + { + unsigned int i=s.initialPrompt.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!TTSChunkMarshaller::checkIntegrityConst(s.initialPrompt[i])) return false; + } + } + if(!InteractionModeMarshaller::checkIntegrityConst(s.interactionMode)) return false; + { + unsigned int i=s.interactionChoiceSetIDList.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(s.interactionChoiceSetIDList[i]>2000000000) return false; + } + } + if(s.helpPrompt) + { + unsigned int i=s.helpPrompt[0].size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!TTSChunkMarshaller::checkIntegrityConst(s.helpPrompt[0][i])) return false; + } + } + if(s.timeoutPrompt) + { + unsigned int i=s.timeoutPrompt[0].size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!TTSChunkMarshaller::checkIntegrityConst(s.timeoutPrompt[0][i])) return false; + } + } + if(s.timeout && *s.timeout>100000) return false; + if(s.timeout && *s.timeout<5000) return false; + return true; +} + +Json::Value PerformInteraction_requestMarshaller::toJSON(const PerformInteraction_request& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["request"]=Json::Value(Json::objectValue); + json["request"]["name"]=Json::Value("PerformInteraction"); + json["request"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["initialText"]=Json::Value(e.initialText); + + j["initialPrompt"]=Json::Value(Json::arrayValue); + j["initialPrompt"].resize(e.initialPrompt.size()); + for(unsigned int i=0;i<e.initialPrompt.size();i++) + j["initialPrompt"][i]=TTSChunkMarshaller::toJSON(e.initialPrompt[i]); + + j["interactionMode"]=InteractionModeMarshaller::toJSON(e.interactionMode); + + j["interactionChoiceSetIDList"]=Json::Value(Json::arrayValue); + j["interactionChoiceSetIDList"].resize(e.interactionChoiceSetIDList.size()); + for(unsigned int i=0;i<e.interactionChoiceSetIDList.size();i++) + j["interactionChoiceSetIDList"][i]=Json::Value(e.interactionChoiceSetIDList[i]); + + if(e.helpPrompt) + { + unsigned int sz=e.helpPrompt->size(); + j["helpPrompt"]=Json::Value(Json::arrayValue); + j["helpPrompt"].resize(sz); + for(unsigned int i=0;i<sz;i++) + j["helpPrompt"][i]=TTSChunkMarshaller::toJSON(e.helpPrompt[0][i]); + } + + if(e.timeoutPrompt) + { + unsigned int sz=e.timeoutPrompt->size(); + j["timeoutPrompt"]=Json::Value(Json::arrayValue); + j["timeoutPrompt"].resize(sz); + for(unsigned int i=0;i<sz;i++) + j["timeoutPrompt"][i]=TTSChunkMarshaller::toJSON(e.timeoutPrompt[0][i]); + } + + if(e.timeout) + j["timeout"]=Json::Value(*e.timeout); + + json["request"]["parameters"]=j; + return json; +} + + +bool PerformInteraction_requestMarshaller::fromJSON(const Json::Value& js,PerformInteraction_request& c) +{ + if(c.helpPrompt) delete c.helpPrompt; + c.helpPrompt=0; + + if(c.timeoutPrompt) delete c.timeoutPrompt; + c.timeoutPrompt=0; + + if(c.timeout) delete c.timeout; + c.timeout=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("request")) return false; + + if(!js["request"].isObject()) return false; + const Json::Value& j2=js["request"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("PerformInteraction")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("initialText")) return false; + { + const Json::Value& j=json["initialText"]; + if(!j.isString()) return false; + c.initialText=j.asString(); + } + if(!json.isMember("initialPrompt")) return false; + { + const Json::Value& j=json["initialPrompt"]; + if(!j.isArray()) return false; + c.initialPrompt.resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + { + TTSChunk t; + if(!TTSChunkMarshaller::fromJSON(j[i],t)) + return false; + c.initialPrompt[i]=t; + } + + } + if(!json.isMember("interactionMode")) return false; + { + const Json::Value& j=json["interactionMode"]; + if(!InteractionModeMarshaller::fromJSON(j,c.interactionMode)) + return false; + } + if(!json.isMember("interactionChoiceSetIDList")) return false; + { + const Json::Value& j=json["interactionChoiceSetIDList"]; + if(!j.isArray()) return false; + c.interactionChoiceSetIDList.resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + if(!j[i].isInt()) + return false; + else + c.interactionChoiceSetIDList[i]=j[i].asInt(); + } + if(json.isMember("helpPrompt")) + { + const Json::Value& j=json["helpPrompt"]; + if(!j.isArray()) return false; + c.helpPrompt=new std::vector<TTSChunk>(); + c.helpPrompt->resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + { + TTSChunk t; + if(!TTSChunkMarshaller::fromJSON(j[i],t)) + return false; + c.helpPrompt[0][i]=t; + } + + } + if(json.isMember("timeoutPrompt")) + { + const Json::Value& j=json["timeoutPrompt"]; + if(!j.isArray()) return false; + c.timeoutPrompt=new std::vector<TTSChunk>(); + c.timeoutPrompt->resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + { + TTSChunk t; + if(!TTSChunkMarshaller::fromJSON(j[i],t)) + return false; + c.timeoutPrompt[0][i]=t; + } + + } + if(json.isMember("timeout")) + { + const Json::Value& j=json["timeout"]; + if(!j.isInt()) return false; + c.timeout=new unsigned int(j.asInt()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerformInteraction_requestMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerformInteraction_requestMarshaller.h new file mode 100644 index 000000000..2eebc438f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerformInteraction_requestMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_PERFORMINTERACTION_REQUESTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_PERFORMINTERACTION_REQUESTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/PerformInteraction_request.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct PerformInteraction_requestMarshaller + { + static bool checkIntegrity(PerformInteraction_request& e); + static bool checkIntegrityConst(const PerformInteraction_request& e); + + static bool fromString(const std::string& s,PerformInteraction_request& e); + static const std::string toString(const PerformInteraction_request& e); + + static bool fromJSON(const Json::Value& s,PerformInteraction_request& e); + static Json::Value toJSON(const PerformInteraction_request& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerformInteraction_response.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerformInteraction_response.cpp new file mode 100644 index 000000000..22bbc055c --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerformInteraction_response.cpp @@ -0,0 +1,145 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/PerformInteraction_response.h" +#include "PerformInteraction_responseMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "TriggerSourceMarshaller.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +PerformInteraction_response& PerformInteraction_response::operator =(const PerformInteraction_response& c) +{ + success = c.success; + resultCode = c.resultCode; + info = c.info ? new std::string(c.info[0]) : 0; + choiceID = c.choiceID ? new unsigned int(c.choiceID[0]) : 0; + triggerSource = c.triggerSource ? new TriggerSource(c.triggerSource[0]) : 0; + + return *this; +} + +PerformInteraction_response::~PerformInteraction_response(void) +{ + if (choiceID) + { + delete choiceID; + } + if (triggerSource) + { + delete triggerSource; + } +} + +PerformInteraction_response::PerformInteraction_response(const PerformInteraction_response& c) +{ + *this = c; +} + +bool PerformInteraction_response::checkIntegrity(void) +{ + return PerformInteraction_responseMarshaller::checkIntegrity(*this); +} + +PerformInteraction_response::PerformInteraction_response(void) + : SDLRPCResponse(PROTOCOL_VERSION, Marshaller::METHOD_PERFORMINTERACTION_RESPONSE), + choiceID(0), + triggerSource(0) +{} + +bool PerformInteraction_response::set_choiceID(unsigned int choiceID_) +{ + if (choiceID_ > 2000000000) + { + return false; + } + delete choiceID; + choiceID = 0; + + choiceID = new unsigned int(choiceID_); + return true; +} + +void PerformInteraction_response::reset_choiceID(void) +{ + if (choiceID) + { + delete choiceID; + } + choiceID = 0; +} + +bool PerformInteraction_response::set_triggerSource(const TriggerSource& triggerSource_) +{ + if (!TriggerSourceMarshaller::checkIntegrityConst(triggerSource_)) + { + return false; + } + delete triggerSource; + triggerSource = 0; + + triggerSource = new TriggerSource(triggerSource_); + return true; +} + +void PerformInteraction_response::reset_triggerSource(void) +{ + if (triggerSource) + { + delete triggerSource; + } + triggerSource = 0; +} + +const unsigned int* PerformInteraction_response::get_choiceID(void) const +{ + return choiceID; +} + +const TriggerSource* PerformInteraction_response::get_triggerSource(void) const +{ + return triggerSource; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerformInteraction_responseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerformInteraction_responseMarshaller.cpp new file mode 100644 index 000000000..332809b77 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerformInteraction_responseMarshaller.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 "../include/JSONHandler/SDLRPCObjects/V1/PerformInteraction_response.h" +#include "ResultMarshaller.h" +#include "TriggerSourceMarshaller.h" + +#include "PerformInteraction_responseMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool PerformInteraction_responseMarshaller::checkIntegrity(PerformInteraction_response& s) +{ + return checkIntegrityConst(s); +} + + +bool PerformInteraction_responseMarshaller::fromString(const std::string& s,PerformInteraction_response& 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 PerformInteraction_responseMarshaller::toString(const PerformInteraction_response& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool PerformInteraction_responseMarshaller::checkIntegrityConst(const PerformInteraction_response& s) +{ + if(!ResultMarshaller::checkIntegrityConst(static_cast<NsSmartDeviceLinkRPCV2::Result>(s.resultCode))) return false; + if(s.info && s.info->length()>1000) return false; + if(s.choiceID && *s.choiceID>2000000000) return false; + if(s.triggerSource && !TriggerSourceMarshaller::checkIntegrityConst(*s.triggerSource)) return false; + return true; +} + +Json::Value PerformInteraction_responseMarshaller::toJSON(const PerformInteraction_response& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["response"]=Json::Value(Json::objectValue); + json["response"]["name"]=Json::Value("PerformInteraction"); + json["response"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["success"]=Json::Value(e.success); + + j["resultCode"]=ResultMarshaller::toJSON(static_cast<NsSmartDeviceLinkRPCV2::Result>(e.resultCode)); + + if(e.info) + j["info"]=Json::Value(*e.info); + + if(e.choiceID) + j["choiceID"]=Json::Value(*e.choiceID); + + if(e.triggerSource) + j["triggerSource"]=TriggerSourceMarshaller::toJSON(*e.triggerSource); + + json["response"]["parameters"]=j; + return json; +} + + +bool PerformInteraction_responseMarshaller::fromJSON(const Json::Value& js,PerformInteraction_response& c) +{ + if(c.info) delete c.info; + c.info=0; + + if(c.choiceID) delete c.choiceID; + c.choiceID=0; + + if(c.triggerSource) delete c.triggerSource; + c.triggerSource=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("response")) return false; + + if(!js["response"].isObject()) return false; + const Json::Value& j2=js["response"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("PerformInteraction")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("success")) return false; + { + const Json::Value& j=json["success"]; + if(!j.isBool()) return false; + c.success=j.asBool(); + } + if(!json.isMember("resultCode")) return false; + { + const Json::Value& j=json["resultCode"]; + NsSmartDeviceLinkRPC::Result result = static_cast<NsSmartDeviceLinkRPC::Result>(c.resultCode); + if(!ResultMarshaller::fromJSON(j, result)) + return false; + c.resultCode = static_cast<NsSmartDeviceLinkRPCV2::Result>(result); + } + if(json.isMember("info")) + { + const Json::Value& j=json["info"]; + if(!j.isString()) return false; + c.info=new std::string(j.asString()); + } + if(json.isMember("choiceID")) + { + const Json::Value& j=json["choiceID"]; + if(!j.isInt()) return false; + c.choiceID=new unsigned int(j.asInt()); + } + if(json.isMember("triggerSource")) + { + const Json::Value& j=json["triggerSource"]; + c.triggerSource=new TriggerSource(); + if(!TriggerSourceMarshaller::fromJSON(j,c.triggerSource[0])) + return false; + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerformInteraction_responseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerformInteraction_responseMarshaller.h new file mode 100644 index 000000000..54f3517fc --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/PerformInteraction_responseMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_PERFORMINTERACTION_RESPONSEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_PERFORMINTERACTION_RESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/PerformInteraction_response.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct PerformInteraction_responseMarshaller + { + static bool checkIntegrity(PerformInteraction_response& e); + static bool checkIntegrityConst(const PerformInteraction_response& e); + + static bool fromString(const std::string& s,PerformInteraction_response& e); + static const std::string toString(const PerformInteraction_response& e); + + static bool fromJSON(const Json::Value& s,PerformInteraction_response& e); + static Json::Value toJSON(const PerformInteraction_response& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/RegisterAppInterface_request.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/RegisterAppInterface_request.cpp new file mode 100644 index 000000000..4ac0d7981 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/RegisterAppInterface_request.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 "../include/JSONHandler/SDLRPCObjects/V1/RegisterAppInterface_request.h" +#include "RegisterAppInterface_requestMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "LanguageMarshaller.h" +#include "SyncMsgVersionMarshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +RegisterAppInterface_request& RegisterAppInterface_request::operator =(const RegisterAppInterface_request& c) +{ + syncMsgVersion= c.syncMsgVersion; + appName= c.appName; + ngnMediaScreenAppName= c.ngnMediaScreenAppName ? new std::string(c.ngnMediaScreenAppName[0]) : 0; + vrSynonyms= c.vrSynonyms ? new std::vector<std::string>(c.vrSynonyms[0]) : 0; + usesVehicleData= c.usesVehicleData ? new bool(c.usesVehicleData[0]) : 0; + isMediaApplication= c.isMediaApplication; + languageDesired= c.languageDesired; + autoActivateID= c.autoActivateID ? new std::string(c.autoActivateID[0]) : 0; + + return *this;} + + +RegisterAppInterface_request::~RegisterAppInterface_request(void) +{ + if(ngnMediaScreenAppName) + delete ngnMediaScreenAppName; + if(vrSynonyms) + delete vrSynonyms; + if(usesVehicleData) + delete usesVehicleData; + if(autoActivateID) + delete autoActivateID; +} + + +RegisterAppInterface_request::RegisterAppInterface_request(const RegisterAppInterface_request& c) +{ + *this=c; +} + + +bool RegisterAppInterface_request::checkIntegrity(void) +{ + return RegisterAppInterface_requestMarshaller::checkIntegrity(*this); +} + + +RegisterAppInterface_request::RegisterAppInterface_request(void) : SDLRPCRequest(PROTOCOL_VERSION,Marshaller::METHOD_REGISTERAPPINTERFACE_REQUEST), + ngnMediaScreenAppName(0), + vrSynonyms(0), + usesVehicleData(0), + autoActivateID(0) +{ +} + + + +bool RegisterAppInterface_request::set_syncMsgVersion(const SyncMsgVersion& syncMsgVersion_) +{ + if(!SyncMsgVersionMarshaller::checkIntegrityConst(syncMsgVersion_)) return false; + syncMsgVersion=syncMsgVersion_; + return true; +} + +bool RegisterAppInterface_request::set_appName(const std::string& appName_) +{ + if(appName_.length()>100) return false; + appName=appName_; + return true; +} + +bool RegisterAppInterface_request::set_ngnMediaScreenAppName(const std::string& ngnMediaScreenAppName_) +{ + if(ngnMediaScreenAppName_.length()>100) return false; + delete ngnMediaScreenAppName; + ngnMediaScreenAppName=0; + + ngnMediaScreenAppName=new std::string(ngnMediaScreenAppName_); + return true; +} + +void RegisterAppInterface_request::reset_ngnMediaScreenAppName(void) +{ + if(ngnMediaScreenAppName) + delete ngnMediaScreenAppName; + ngnMediaScreenAppName=0; +} + +bool RegisterAppInterface_request::set_vrSynonyms(const std::vector<std::string>& vrSynonyms_) +{ + unsigned int i=vrSynonyms_.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(vrSynonyms_[i].length()>40) return false; + } + delete vrSynonyms; + vrSynonyms=0; + + vrSynonyms=new std::vector<std::string>(vrSynonyms_); + return true; +} + +void RegisterAppInterface_request::reset_vrSynonyms(void) +{ + if(vrSynonyms) + delete vrSynonyms; + vrSynonyms=0; +} + +bool RegisterAppInterface_request::set_usesVehicleData(bool usesVehicleData_) +{ + delete usesVehicleData; + usesVehicleData=0; + + usesVehicleData=new bool(usesVehicleData_); + return true; +} + +void RegisterAppInterface_request::reset_usesVehicleData(void) +{ + if(usesVehicleData) + delete usesVehicleData; + usesVehicleData=0; +} + +bool RegisterAppInterface_request::set_isMediaApplication(bool isMediaApplication_) +{ + isMediaApplication=isMediaApplication_; + return true; +} + +bool RegisterAppInterface_request::set_languageDesired(const Language& languageDesired_) +{ + if(!LanguageMarshaller::checkIntegrityConst(languageDesired_)) return false; + languageDesired=languageDesired_; + return true; +} + +bool RegisterAppInterface_request::set_autoActivateID(const std::string& autoActivateID_) +{ + if(autoActivateID_.length()>16) return false; + delete autoActivateID; + autoActivateID=0; + + autoActivateID=new std::string(autoActivateID_); + return true; +} + +void RegisterAppInterface_request::reset_autoActivateID(void) +{ + if(autoActivateID) + delete autoActivateID; + autoActivateID=0; +} + + + + +const SyncMsgVersion& RegisterAppInterface_request::get_syncMsgVersion(void) const +{ + return syncMsgVersion; +} + +const std::string& RegisterAppInterface_request::get_appName(void) const +{ + return appName; +} + +const std::string* RegisterAppInterface_request::get_ngnMediaScreenAppName(void) const +{ + return ngnMediaScreenAppName; +} + +const std::vector<std::string>* RegisterAppInterface_request::get_vrSynonyms(void) const +{ + return vrSynonyms; +} + +const bool* RegisterAppInterface_request::get_usesVehicleData(void) const +{ + return usesVehicleData; +} + +bool RegisterAppInterface_request::get_isMediaApplication(void) const +{ + return isMediaApplication; +} + +const Language& RegisterAppInterface_request::get_languageDesired(void) const +{ + return languageDesired; +} + +const std::string* RegisterAppInterface_request::get_autoActivateID(void) const +{ + return autoActivateID; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/RegisterAppInterface_requestMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/RegisterAppInterface_requestMarshaller.cpp new file mode 100644 index 000000000..bcfcb0df6 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/RegisterAppInterface_requestMarshaller.cpp @@ -0,0 +1,236 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/RegisterAppInterface_request.h" +#include "LanguageMarshaller.h" +#include "SyncMsgVersionMarshaller.h" + +#include "RegisterAppInterface_requestMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool RegisterAppInterface_requestMarshaller::checkIntegrity(RegisterAppInterface_request& s) +{ + return checkIntegrityConst(s); +} + + +bool RegisterAppInterface_requestMarshaller::fromString(const std::string& s,RegisterAppInterface_request& 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 RegisterAppInterface_requestMarshaller::toString(const RegisterAppInterface_request& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool RegisterAppInterface_requestMarshaller::checkIntegrityConst(const RegisterAppInterface_request& s) +{ + if(!SyncMsgVersionMarshaller::checkIntegrityConst(s.syncMsgVersion)) return false; + if(s.appName.length()>100) return false; + if(s.ngnMediaScreenAppName && s.ngnMediaScreenAppName->length()>100) return false; + if(s.vrSynonyms) + { + unsigned int i=s.vrSynonyms[0].size(); + if(i>100 || i<1) return false; + while(i--) + { + if(s.vrSynonyms[0][i].length()>40) return false; + } + } + if(!LanguageMarshaller::checkIntegrityConst(s.languageDesired)) return false; + if(s.autoActivateID && s.autoActivateID->length()>16) return false; + return true; +} + +Json::Value RegisterAppInterface_requestMarshaller::toJSON(const RegisterAppInterface_request& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["request"]=Json::Value(Json::objectValue); + json["request"]["name"]=Json::Value("RegisterAppInterface"); + json["request"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["syncMsgVersion"]=SyncMsgVersionMarshaller::toJSON(e.syncMsgVersion); + + j["appName"]=Json::Value(e.appName); + + if(e.ngnMediaScreenAppName) + j["ngnMediaScreenAppName"]=Json::Value(*e.ngnMediaScreenAppName); + + if(e.vrSynonyms) + { + unsigned int sz=e.vrSynonyms->size(); + j["vrSynonyms"]=Json::Value(Json::arrayValue); + j["vrSynonyms"].resize(sz); + for(unsigned int i=0;i<sz;i++) + j["vrSynonyms"][i]=Json::Value(e.vrSynonyms[0][i]); + } + + if(e.usesVehicleData) + j["usesVehicleData"]=Json::Value(*e.usesVehicleData); + + j["isMediaApplication"]=Json::Value(e.isMediaApplication); + + j["languageDesired"]=LanguageMarshaller::toJSON(e.languageDesired); + + if(e.autoActivateID) + j["autoActivateID"]=Json::Value(*e.autoActivateID); + + json["request"]["parameters"]=j; + return json; +} + + +bool RegisterAppInterface_requestMarshaller::fromJSON(const Json::Value& js,RegisterAppInterface_request& c) +{ + if(c.ngnMediaScreenAppName) delete c.ngnMediaScreenAppName; + c.ngnMediaScreenAppName=0; + + if(c.vrSynonyms) delete c.vrSynonyms; + c.vrSynonyms=0; + + if(c.usesVehicleData) delete c.usesVehicleData; + c.usesVehicleData=0; + + if(c.autoActivateID) delete c.autoActivateID; + c.autoActivateID=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("request")) return false; + + if(!js["request"].isObject()) return false; + const Json::Value& j2=js["request"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("RegisterAppInterface")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("syncMsgVersion")) return false; + { + const Json::Value& j=json["syncMsgVersion"]; + if(!SyncMsgVersionMarshaller::fromJSON(j,c.syncMsgVersion)) + return false; + } + if(!json.isMember("appName")) return false; + { + const Json::Value& j=json["appName"]; + if(!j.isString()) return false; + c.appName=j.asString(); + } + if(json.isMember("ngnMediaScreenAppName")) + { + const Json::Value& j=json["ngnMediaScreenAppName"]; + if(!j.isString()) return false; + c.ngnMediaScreenAppName=new std::string(j.asString()); + } + if(json.isMember("vrSynonyms")) + { + const Json::Value& j=json["vrSynonyms"]; + if(!j.isArray()) return false; + c.vrSynonyms=new std::vector<std::string>(); + c.vrSynonyms->resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + if(!j[i].isString()) + return false; + else + c.vrSynonyms[0][i]=j[i].asString(); + } + if(json.isMember("usesVehicleData")) + { + const Json::Value& j=json["usesVehicleData"]; + if(!j.isBool()) return false; + c.usesVehicleData=new bool(j.asBool()); + } + if(!json.isMember("isMediaApplication")) return false; + { + const Json::Value& j=json["isMediaApplication"]; + if(!j.isBool()) return false; + c.isMediaApplication=j.asBool(); + } + if(!json.isMember("languageDesired")) return false; + { + const Json::Value& j=json["languageDesired"]; + if(!LanguageMarshaller::fromJSON(j,c.languageDesired)) + return false; + } + if(json.isMember("autoActivateID")) + { + const Json::Value& j=json["autoActivateID"]; + if(!j.isString()) return false; + c.autoActivateID=new std::string(j.asString()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/RegisterAppInterface_requestMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/RegisterAppInterface_requestMarshaller.h new file mode 100644 index 000000000..5ec33dfa5 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/RegisterAppInterface_requestMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_REGISTERAPPINTERFACE_REQUESTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_REGISTERAPPINTERFACE_REQUESTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/RegisterAppInterface_request.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct RegisterAppInterface_requestMarshaller + { + static bool checkIntegrity(RegisterAppInterface_request& e); + static bool checkIntegrityConst(const RegisterAppInterface_request& e); + + static bool fromString(const std::string& s,RegisterAppInterface_request& e); + static const std::string toString(const RegisterAppInterface_request& e); + + static bool fromJSON(const Json::Value& s,RegisterAppInterface_request& e); + static Json::Value toJSON(const RegisterAppInterface_request& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/RegisterAppInterface_response.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/RegisterAppInterface_response.cpp new file mode 100644 index 000000000..0fbf2c2c8 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/RegisterAppInterface_response.cpp @@ -0,0 +1,380 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/RegisterAppInterface_response.h" +#include "RegisterAppInterface_responseMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "ButtonCapabilitiesMarshaller.h" +#include "DisplayCapabilitiesMarshaller.h" +#include "HmiZoneCapabilitiesMarshaller.h" +#include "LanguageMarshaller.h" +#include "SpeechCapabilitiesMarshaller.h" +#include "SyncMsgVersionMarshaller.h" +#include "VrCapabilitiesMarshaller.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +RegisterAppInterface_response& RegisterAppInterface_response::operator =(const RegisterAppInterface_response& c) +{ + success = c.success; + resultCode = c.resultCode; + info = c.info ? new std::string(c.info[0]) : 0; + syncMsgVersion = c.syncMsgVersion ? new SyncMsgVersion(c.syncMsgVersion[0]) : 0; + autoActivateID = c.autoActivateID ? new std::string(c.autoActivateID[0]) : 0; + language = c.language ? new Language(c.language[0]) : 0; + displayCapabilities = c.displayCapabilities ? new DisplayCapabilities(c.displayCapabilities[0]) : 0; + buttonCapabilities = c.buttonCapabilities ? new std::vector<ButtonCapabilities>(c.buttonCapabilities[0]) : 0; + hmiZoneCapabilities = c.hmiZoneCapabilities ? new std::vector<HmiZoneCapabilities>(c.hmiZoneCapabilities[0]) : 0; + speechCapabilities = c.speechCapabilities ? new std::vector<SpeechCapabilities>(c.speechCapabilities[0]) : 0; + vrCapabilities = c.vrCapabilities ? new std::vector<VrCapabilities>(c.vrCapabilities[0]) : 0; + + return *this; +} + +RegisterAppInterface_response::~RegisterAppInterface_response(void) +{ + if (syncMsgVersion) + { + delete syncMsgVersion; + } + if (autoActivateID) + { + delete autoActivateID; + } + if (language) + { + delete language; + } + if (displayCapabilities) + { + delete displayCapabilities; + } + if (buttonCapabilities) + { + delete buttonCapabilities; + } + if (hmiZoneCapabilities) + { + delete hmiZoneCapabilities; + } + if (speechCapabilities) + { + delete speechCapabilities; + } + if (vrCapabilities) + { + delete vrCapabilities; + } +} + +RegisterAppInterface_response::RegisterAppInterface_response(const RegisterAppInterface_response& c) +{ + *this = c; +} + +bool RegisterAppInterface_response::checkIntegrity(void) +{ + return RegisterAppInterface_responseMarshaller::checkIntegrity(*this); +} + +RegisterAppInterface_response::RegisterAppInterface_response(void) + : SDLRPCResponse(PROTOCOL_VERSION, Marshaller::METHOD_REGISTERAPPINTERFACE_RESPONSE), + syncMsgVersion(0), + autoActivateID(0), + language(0), + displayCapabilities(0), + buttonCapabilities(0), + hmiZoneCapabilities(0), + speechCapabilities(0), + vrCapabilities(0) +{} + +bool RegisterAppInterface_response::set_syncMsgVersion(const SyncMsgVersion& syncMsgVersion_) +{ + if (!SyncMsgVersionMarshaller::checkIntegrityConst(syncMsgVersion_)) + { + return false; + } + delete syncMsgVersion; + syncMsgVersion = 0; + + syncMsgVersion = new SyncMsgVersion(syncMsgVersion_); + return true; +} + +void RegisterAppInterface_response::reset_syncMsgVersion(void) +{ + if (syncMsgVersion) + { + delete syncMsgVersion; + } + syncMsgVersion = 0; +} + +bool RegisterAppInterface_response::set_autoActivateID(const std::string& autoActivateID_) +{ + if (autoActivateID_.length() > 16) + { + return false; + } + delete autoActivateID; + autoActivateID = 0; + + autoActivateID = new std::string(autoActivateID_); + return true; +} + +void RegisterAppInterface_response::reset_autoActivateID(void) +{ + if (autoActivateID) + { + delete autoActivateID; + } + autoActivateID = 0; +} + +bool RegisterAppInterface_response::set_language(const Language& language_) +{ + if (!LanguageMarshaller::checkIntegrityConst(language_)) + { + return false; + } + delete language; + language = 0; + + language = new Language(language_); + return true; +} + +void RegisterAppInterface_response::reset_language(void) +{ + if (language) + { + delete language; + } + language = 0; +} + +bool RegisterAppInterface_response::set_displayCapabilities(const DisplayCapabilities& displayCapabilities_) +{ + if (!DisplayCapabilitiesMarshaller::checkIntegrityConst(displayCapabilities_)) + { + return false; + } + delete displayCapabilities; + displayCapabilities = 0; + + displayCapabilities = new DisplayCapabilities(displayCapabilities_); + return true; +} + +void RegisterAppInterface_response::reset_displayCapabilities(void) +{ + if (displayCapabilities) + { + delete displayCapabilities; + } + displayCapabilities = 0; +} + +bool RegisterAppInterface_response::set_buttonCapabilities(const std::vector<ButtonCapabilities>& buttonCapabilities_) +{ + unsigned int i = buttonCapabilities_.size(); + if (i > 100 || i < 1) + { + return false; + } + while (i--) + { + if (!ButtonCapabilitiesMarshaller::checkIntegrityConst(buttonCapabilities_[i])) + { + return false; + } + } + delete buttonCapabilities; + buttonCapabilities = 0; + + buttonCapabilities = new std::vector<ButtonCapabilities>(buttonCapabilities_); + return true; +} + +void RegisterAppInterface_response::reset_buttonCapabilities(void) +{ + if (buttonCapabilities) + { + delete buttonCapabilities; + } + buttonCapabilities = 0; +} + +bool RegisterAppInterface_response::set_hmiZoneCapabilities(const std::vector<HmiZoneCapabilities>& hmiZoneCapabilities_) +{ + unsigned int i = hmiZoneCapabilities_.size(); + if (i > 100 || i < 1) + { + return false; + } + while (i--) + { + if (!HmiZoneCapabilitiesMarshaller::checkIntegrityConst(hmiZoneCapabilities_[i])) + { + return false; + } + } + delete hmiZoneCapabilities; + hmiZoneCapabilities = 0; + + hmiZoneCapabilities = new std::vector<HmiZoneCapabilities>(hmiZoneCapabilities_); + return true; +} + +void RegisterAppInterface_response::reset_hmiZoneCapabilities(void) +{ + if (hmiZoneCapabilities) + { + delete hmiZoneCapabilities; + } + hmiZoneCapabilities = 0; +} + +bool RegisterAppInterface_response::set_speechCapabilities(const std::vector<SpeechCapabilities>& speechCapabilities_) +{ + unsigned int i = speechCapabilities_.size(); + if (i > 100 || i < 1) + { + return false; + } + while (i--) + { + if (!SpeechCapabilitiesMarshaller::checkIntegrityConst(speechCapabilities_[i])) + { + return false; + } + } + delete speechCapabilities; + speechCapabilities = 0; + + speechCapabilities = new std::vector<SpeechCapabilities>(speechCapabilities_); + return true; +} + +void RegisterAppInterface_response::reset_speechCapabilities(void) +{ + if (speechCapabilities) + { + delete speechCapabilities; + } + speechCapabilities = 0; +} + +bool RegisterAppInterface_response::set_vrCapabilities(const std::vector<VrCapabilities>& vrCapabilities_) +{ + unsigned int i = vrCapabilities_.size(); + if (i > 100 || i < 1) + { + return false; + } + while (i--) + { + if (!VrCapabilitiesMarshaller::checkIntegrityConst(vrCapabilities_[i])) + { + return false; + } + } + delete vrCapabilities; + vrCapabilities = 0; + + vrCapabilities = new std::vector<VrCapabilities>(vrCapabilities_); + return true; +} + +void RegisterAppInterface_response::reset_vrCapabilities(void) +{ + if (vrCapabilities) + { + delete vrCapabilities; + } + vrCapabilities = 0; +} +const SyncMsgVersion* RegisterAppInterface_response::get_syncMsgVersion(void) const +{ + return syncMsgVersion; +} + +const std::string* RegisterAppInterface_response::get_autoActivateID(void) const +{ + return autoActivateID; +} + +const Language* RegisterAppInterface_response::get_language(void) const +{ + return language; +} + +const DisplayCapabilities* RegisterAppInterface_response::get_displayCapabilities(void) const +{ + return displayCapabilities; +} + +const std::vector<ButtonCapabilities>* RegisterAppInterface_response::get_buttonCapabilities(void) const +{ + return buttonCapabilities; +} + +const std::vector<HmiZoneCapabilities>* RegisterAppInterface_response::get_hmiZoneCapabilities(void) const +{ + return hmiZoneCapabilities; +} + +const std::vector<SpeechCapabilities>* RegisterAppInterface_response::get_speechCapabilities(void) const +{ + return speechCapabilities; +} + +const std::vector<VrCapabilities>* RegisterAppInterface_response::get_vrCapabilities(void) const +{ + return vrCapabilities; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/RegisterAppInterface_responseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/RegisterAppInterface_responseMarshaller.cpp new file mode 100644 index 000000000..0952fd3b2 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/RegisterAppInterface_responseMarshaller.cpp @@ -0,0 +1,367 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/RegisterAppInterface_response.h" +#include "ButtonCapabilitiesMarshaller.h" +#include "DisplayCapabilitiesMarshaller.h" +#include "HmiZoneCapabilitiesMarshaller.h" +#include "LanguageMarshaller.h" +#include "ResultMarshaller.h" +#include "SpeechCapabilitiesMarshaller.h" +#include "SyncMsgVersionMarshaller.h" +#include "VrCapabilitiesMarshaller.h" + +#include "RegisterAppInterface_responseMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool RegisterAppInterface_responseMarshaller::checkIntegrity(RegisterAppInterface_response& s) +{ + return checkIntegrityConst(s); +} + + +bool RegisterAppInterface_responseMarshaller::fromString(const std::string& s,RegisterAppInterface_response& 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 RegisterAppInterface_responseMarshaller::toString(const RegisterAppInterface_response& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool RegisterAppInterface_responseMarshaller::checkIntegrityConst(const RegisterAppInterface_response& s) +{ + if(!ResultMarshaller::checkIntegrityConst(static_cast<NsSmartDeviceLinkRPCV2::Result>(s.resultCode))) return false; + if(s.info && s.info->length()>1000) return false; + if(s.syncMsgVersion && !SyncMsgVersionMarshaller::checkIntegrityConst(*s.syncMsgVersion)) return false; + if(s.autoActivateID && s.autoActivateID->length()>16) return false; + if(s.language && !LanguageMarshaller::checkIntegrityConst(*s.language)) return false; + if(s.displayCapabilities && !DisplayCapabilitiesMarshaller::checkIntegrityConst(*s.displayCapabilities)) return false; + if(s.buttonCapabilities) + { + unsigned int i=s.buttonCapabilities[0].size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!ButtonCapabilitiesMarshaller::checkIntegrityConst(s.buttonCapabilities[0][i])) return false; + } + } + if(s.hmiZoneCapabilities) + { + unsigned int i=s.hmiZoneCapabilities[0].size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!HmiZoneCapabilitiesMarshaller::checkIntegrityConst(s.hmiZoneCapabilities[0][i])) return false; + } + } + if(s.speechCapabilities) + { + unsigned int i=s.speechCapabilities[0].size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!SpeechCapabilitiesMarshaller::checkIntegrityConst(s.speechCapabilities[0][i])) return false; + } + } + if(s.vrCapabilities) + { + unsigned int i=s.vrCapabilities[0].size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!VrCapabilitiesMarshaller::checkIntegrityConst(s.vrCapabilities[0][i])) return false; + } + } + return true; +} + +Json::Value RegisterAppInterface_responseMarshaller::toJSON(const RegisterAppInterface_response& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["response"]=Json::Value(Json::objectValue); + json["response"]["name"]=Json::Value("RegisterAppInterface"); + json["response"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["success"]=Json::Value(e.success); + + j["resultCode"]=ResultMarshaller::toJSON(static_cast<NsSmartDeviceLinkRPCV2::Result>(e.resultCode)); + + if(e.info) + j["info"]=Json::Value(*e.info); + + if(e.syncMsgVersion) + j["syncMsgVersion"]=SyncMsgVersionMarshaller::toJSON(*e.syncMsgVersion); + + if(e.autoActivateID) + j["autoActivateID"]=Json::Value(*e.autoActivateID); + + if(e.language) + j["language"]=LanguageMarshaller::toJSON(*e.language); + + if(e.displayCapabilities) + j["displayCapabilities"]=DisplayCapabilitiesMarshaller::toJSON(*e.displayCapabilities); + + if(e.buttonCapabilities) + { + unsigned int sz=e.buttonCapabilities->size(); + j["buttonCapabilities"]=Json::Value(Json::arrayValue); + j["buttonCapabilities"].resize(sz); + for(unsigned int i=0;i<sz;i++) + j["buttonCapabilities"][i]=ButtonCapabilitiesMarshaller::toJSON(e.buttonCapabilities[0][i]); + } + + if(e.hmiZoneCapabilities) + { + unsigned int sz=e.hmiZoneCapabilities->size(); + j["hmiZoneCapabilities"]=Json::Value(Json::arrayValue); + j["hmiZoneCapabilities"].resize(sz); + for(unsigned int i=0;i<sz;i++) + j["hmiZoneCapabilities"][i]=HmiZoneCapabilitiesMarshaller::toJSON(e.hmiZoneCapabilities[0][i]); + } + + if(e.speechCapabilities) + { + unsigned int sz=e.speechCapabilities->size(); + j["speechCapabilities"]=Json::Value(Json::arrayValue); + j["speechCapabilities"].resize(sz); + for(unsigned int i=0;i<sz;i++) + j["speechCapabilities"][i]=SpeechCapabilitiesMarshaller::toJSON(e.speechCapabilities[0][i]); + } + + if(e.vrCapabilities) + { + unsigned int sz=e.vrCapabilities->size(); + j["vrCapabilities"]=Json::Value(Json::arrayValue); + j["vrCapabilities"].resize(sz); + for(unsigned int i=0;i<sz;i++) + j["vrCapabilities"][i]=VrCapabilitiesMarshaller::toJSON(e.vrCapabilities[0][i]); + } + + json["response"]["parameters"]=j; + return json; +} + + +bool RegisterAppInterface_responseMarshaller::fromJSON(const Json::Value& js,RegisterAppInterface_response& c) +{ + if(c.info) delete c.info; + c.info=0; + + if(c.syncMsgVersion) delete c.syncMsgVersion; + c.syncMsgVersion=0; + + if(c.autoActivateID) delete c.autoActivateID; + c.autoActivateID=0; + + if(c.language) delete c.language; + c.language=0; + + if(c.displayCapabilities) delete c.displayCapabilities; + c.displayCapabilities=0; + + if(c.buttonCapabilities) delete c.buttonCapabilities; + c.buttonCapabilities=0; + + if(c.hmiZoneCapabilities) delete c.hmiZoneCapabilities; + c.hmiZoneCapabilities=0; + + if(c.speechCapabilities) delete c.speechCapabilities; + c.speechCapabilities=0; + + if(c.vrCapabilities) delete c.vrCapabilities; + c.vrCapabilities=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("response")) return false; + + if(!js["response"].isObject()) return false; + const Json::Value& j2=js["response"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("RegisterAppInterface")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("success")) return false; + { + const Json::Value& j=json["success"]; + if(!j.isBool()) return false; + c.success=j.asBool(); + } + if(!json.isMember("resultCode")) return false; + { + const Json::Value& j=json["resultCode"]; + NsSmartDeviceLinkRPC::Result result = static_cast<NsSmartDeviceLinkRPC::Result>(c.resultCode); + if(!ResultMarshaller::fromJSON(j, result)) + return false; + c.resultCode = static_cast<NsSmartDeviceLinkRPCV2::Result>(result); + } + if(json.isMember("info")) + { + const Json::Value& j=json["info"]; + if(!j.isString()) return false; + c.info=new std::string(j.asString()); + } + if(json.isMember("syncMsgVersion")) + { + const Json::Value& j=json["syncMsgVersion"]; + c.syncMsgVersion=new SyncMsgVersion(); + if(!SyncMsgVersionMarshaller::fromJSON(j,c.syncMsgVersion[0])) + return false; + } + if(json.isMember("autoActivateID")) + { + const Json::Value& j=json["autoActivateID"]; + if(!j.isString()) return false; + c.autoActivateID=new std::string(j.asString()); + } + if(json.isMember("language")) + { + const Json::Value& j=json["language"]; + c.language=new Language(); + if(!LanguageMarshaller::fromJSON(j,c.language[0])) + return false; + } + if(json.isMember("displayCapabilities")) + { + const Json::Value& j=json["displayCapabilities"]; + c.displayCapabilities=new DisplayCapabilities(); + if(!DisplayCapabilitiesMarshaller::fromJSON(j,c.displayCapabilities[0])) + return false; + } + if(json.isMember("buttonCapabilities")) + { + const Json::Value& j=json["buttonCapabilities"]; + if(!j.isArray()) return false; + c.buttonCapabilities=new std::vector<ButtonCapabilities>(); + c.buttonCapabilities->resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + { + ButtonCapabilities t; + if(!ButtonCapabilitiesMarshaller::fromJSON(j[i],t)) + return false; + c.buttonCapabilities[0][i]=t; + } + + } + if(json.isMember("hmiZoneCapabilities")) + { + const Json::Value& j=json["hmiZoneCapabilities"]; + if(!j.isArray()) return false; + c.hmiZoneCapabilities=new std::vector<HmiZoneCapabilities>(); + c.hmiZoneCapabilities->resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + { + HmiZoneCapabilities t; + if(!HmiZoneCapabilitiesMarshaller::fromJSON(j[i],t)) + return false; + c.hmiZoneCapabilities[0][i]=t; + } + + } + if(json.isMember("speechCapabilities")) + { + const Json::Value& j=json["speechCapabilities"]; + if(!j.isArray()) return false; + c.speechCapabilities=new std::vector<SpeechCapabilities>(); + c.speechCapabilities->resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + { + SpeechCapabilities t; + if(!SpeechCapabilitiesMarshaller::fromJSON(j[i],t)) + return false; + c.speechCapabilities[0][i]=t; + } + + } + if(json.isMember("vrCapabilities")) + { + const Json::Value& j=json["vrCapabilities"]; + if(!j.isArray()) return false; + c.vrCapabilities=new std::vector<VrCapabilities>(); + c.vrCapabilities->resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + { + VrCapabilities t; + if(!VrCapabilitiesMarshaller::fromJSON(j[i],t)) + return false; + c.vrCapabilities[0][i]=t; + } + + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/RegisterAppInterface_responseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/RegisterAppInterface_responseMarshaller.h new file mode 100644 index 000000000..b6ad563a4 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/RegisterAppInterface_responseMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_REGISTERAPPINTERFACE_RESPONSEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_REGISTERAPPINTERFACE_RESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/RegisterAppInterface_response.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct RegisterAppInterface_responseMarshaller + { + static bool checkIntegrity(RegisterAppInterface_response& e); + static bool checkIntegrityConst(const RegisterAppInterface_response& e); + + static bool fromString(const std::string& s,RegisterAppInterface_response& e); + static const std::string toString(const RegisterAppInterface_response& e); + + static bool fromJSON(const Json::Value& s,RegisterAppInterface_response& e); + static Json::Value toJSON(const RegisterAppInterface_response& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResetGlobalProperties_request.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResetGlobalProperties_request.cpp new file mode 100644 index 000000000..f0e346407 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResetGlobalProperties_request.cpp @@ -0,0 +1,94 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/ResetGlobalProperties_request.h" +#include "ResetGlobalProperties_requestMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "GlobalPropertyMarshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + +ResetGlobalProperties_request::~ResetGlobalProperties_request(void) +{ +} + + +ResetGlobalProperties_request::ResetGlobalProperties_request(const ResetGlobalProperties_request& c) +{ + *this=c; +} + + +bool ResetGlobalProperties_request::checkIntegrity(void) +{ + return ResetGlobalProperties_requestMarshaller::checkIntegrity(*this); +} + + +ResetGlobalProperties_request::ResetGlobalProperties_request(void) : SDLRPCRequest(PROTOCOL_VERSION,Marshaller::METHOD_RESETGLOBALPROPERTIES_REQUEST) +{ +} + + + +bool ResetGlobalProperties_request::set_properties(const std::vector<GlobalProperty>& properties_) +{ + unsigned int i=properties_.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!GlobalPropertyMarshaller::checkIntegrityConst(properties_[i])) return false; + } + properties=properties_; + return true; +} + + + + +const std::vector<GlobalProperty>& ResetGlobalProperties_request::get_properties(void) const +{ + return properties; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResetGlobalProperties_requestMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResetGlobalProperties_requestMarshaller.cpp new file mode 100644 index 000000000..d07333697 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResetGlobalProperties_requestMarshaller.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 "../include/JSONHandler/SDLRPCObjects/V1/ResetGlobalProperties_request.h" +#include "GlobalPropertyMarshaller.h" + +#include "ResetGlobalProperties_requestMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool ResetGlobalProperties_requestMarshaller::checkIntegrity(ResetGlobalProperties_request& s) +{ + return checkIntegrityConst(s); +} + + +bool ResetGlobalProperties_requestMarshaller::fromString(const std::string& s,ResetGlobalProperties_request& 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 ResetGlobalProperties_requestMarshaller::toString(const ResetGlobalProperties_request& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool ResetGlobalProperties_requestMarshaller::checkIntegrityConst(const ResetGlobalProperties_request& s) +{ + { + unsigned int i=s.properties.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!GlobalPropertyMarshaller::checkIntegrityConst(s.properties[i])) return false; + } + } + return true; +} + +Json::Value ResetGlobalProperties_requestMarshaller::toJSON(const ResetGlobalProperties_request& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["request"]=Json::Value(Json::objectValue); + json["request"]["name"]=Json::Value("ResetGlobalProperties"); + json["request"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["properties"]=Json::Value(Json::arrayValue); + j["properties"].resize(e.properties.size()); + for(unsigned int i=0;i<e.properties.size();i++) + j["properties"][i]=GlobalPropertyMarshaller::toJSON(e.properties[i]); + + json["request"]["parameters"]=j; + return json; +} + + +bool ResetGlobalProperties_requestMarshaller::fromJSON(const Json::Value& js,ResetGlobalProperties_request& c) +{ + try + { + if(!js.isObject()) return false; + + if(!js.isMember("request")) return false; + + if(!js["request"].isObject()) return false; + const Json::Value& j2=js["request"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("ResetGlobalProperties")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("properties")) return false; + { + const Json::Value& j=json["properties"]; + if(!j.isArray()) return false; + for(unsigned int i=0;i<j.size();i++) + { + GlobalProperty t; + if(GlobalPropertyMarshaller::fromJSON(j[i],t)) + { + c.properties.push_back(t); + } + } + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResetGlobalProperties_requestMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResetGlobalProperties_requestMarshaller.h new file mode 100644 index 000000000..47cc096ca --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResetGlobalProperties_requestMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_RESETGLOBALPROPERTIES_REQUESTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_RESETGLOBALPROPERTIES_REQUESTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/ResetGlobalProperties_request.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct ResetGlobalProperties_requestMarshaller + { + static bool checkIntegrity(ResetGlobalProperties_request& e); + static bool checkIntegrityConst(const ResetGlobalProperties_request& e); + + static bool fromString(const std::string& s,ResetGlobalProperties_request& e); + static const std::string toString(const ResetGlobalProperties_request& e); + + static bool fromJSON(const Json::Value& s,ResetGlobalProperties_request& e); + static Json::Value toJSON(const ResetGlobalProperties_request& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResetGlobalProperties_response.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResetGlobalProperties_response.cpp new file mode 100644 index 000000000..6ddcf98fa --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResetGlobalProperties_response.cpp @@ -0,0 +1,76 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/ResetGlobalProperties_response.h" +#include "ResetGlobalProperties_responseMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +ResetGlobalProperties_response& ResetGlobalProperties_response::operator =(const ResetGlobalProperties_response& c) +{ + success = c.success; + resultCode = c.resultCode; + info = c.info ? new std::string(c.info[0]) : 0; + + return *this; +} + +ResetGlobalProperties_response::~ResetGlobalProperties_response(void) +{} + +ResetGlobalProperties_response::ResetGlobalProperties_response(const ResetGlobalProperties_response& c) +{ + *this = c; +} + +bool ResetGlobalProperties_response::checkIntegrity(void) +{ + return ResetGlobalProperties_responseMarshaller::checkIntegrity(*this); +} + +ResetGlobalProperties_response::ResetGlobalProperties_response(void) + : SDLRPCResponse(PROTOCOL_VERSION, Marshaller::METHOD_RESETGLOBALPROPERTIES_RESPONSE) +{} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResetGlobalProperties_responseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResetGlobalProperties_responseMarshaller.cpp new file mode 100644 index 000000000..4e96802c1 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResetGlobalProperties_responseMarshaller.cpp @@ -0,0 +1,161 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/ResetGlobalProperties_response.h" +#include "ResultMarshaller.h" + +#include "ResetGlobalProperties_responseMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool ResetGlobalProperties_responseMarshaller::checkIntegrity(ResetGlobalProperties_response& s) +{ + return checkIntegrityConst(s); +} + + +bool ResetGlobalProperties_responseMarshaller::fromString(const std::string& s,ResetGlobalProperties_response& 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 ResetGlobalProperties_responseMarshaller::toString(const ResetGlobalProperties_response& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool ResetGlobalProperties_responseMarshaller::checkIntegrityConst(const ResetGlobalProperties_response& s) +{ + if(!ResultMarshaller::checkIntegrityConst(static_cast<NsSmartDeviceLinkRPCV2::Result>(s.resultCode))) return false; + if(s.info && s.info->length()>1000) return false; + return true; +} + +Json::Value ResetGlobalProperties_responseMarshaller::toJSON(const ResetGlobalProperties_response& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["response"]=Json::Value(Json::objectValue); + json["response"]["name"]=Json::Value("ResetGlobalProperties"); + json["response"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["success"]=Json::Value(e.success); + + j["resultCode"]=ResultMarshaller::toJSON(static_cast<NsSmartDeviceLinkRPCV2::Result>(e.resultCode)); + + if(e.info) + j["info"]=Json::Value(*e.info); + + json["response"]["parameters"]=j; + return json; +} + + +bool ResetGlobalProperties_responseMarshaller::fromJSON(const Json::Value& js,ResetGlobalProperties_response& c) +{ + if(c.info) delete c.info; + c.info=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("response")) return false; + + if(!js["response"].isObject()) return false; + const Json::Value& j2=js["response"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("ResetGlobalProperties")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("success")) return false; + { + const Json::Value& j=json["success"]; + if(!j.isBool()) return false; + c.success=j.asBool(); + } + if(!json.isMember("resultCode")) return false; + { + const Json::Value& j=json["resultCode"]; + NsSmartDeviceLinkRPC::Result result = static_cast<NsSmartDeviceLinkRPC::Result>(c.resultCode); + if(!ResultMarshaller::fromJSON(j, result)) + return false; + c.resultCode = static_cast<NsSmartDeviceLinkRPCV2::Result>(result); + } + if(json.isMember("info")) + { + const Json::Value& j=json["info"]; + if(!j.isString()) return false; + c.info=new std::string(j.asString()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResetGlobalProperties_responseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResetGlobalProperties_responseMarshaller.h new file mode 100644 index 000000000..9a50d1d91 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResetGlobalProperties_responseMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_RESETGLOBALPROPERTIES_RESPONSEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_RESETGLOBALPROPERTIES_RESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/ResetGlobalProperties_response.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct ResetGlobalProperties_responseMarshaller + { + static bool checkIntegrity(ResetGlobalProperties_response& e); + static bool checkIntegrityConst(const ResetGlobalProperties_response& e); + + static bool fromString(const std::string& s,ResetGlobalProperties_response& e); + static const std::string toString(const ResetGlobalProperties_response& e); + + static bool fromJSON(const Json::Value& s,ResetGlobalProperties_response& e); + static Json::Value toJSON(const ResetGlobalProperties_response& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Result.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Result.cpp new file mode 100644 index 000000000..acc37fa8f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Result.cpp @@ -0,0 +1,78 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/Result.h" +#include "ResetGlobalProperties_responseMarshaller.h" + +// TODO(AK): remove this after new code generation +#include "../include/JSONHandler/SDLRPCObjects/V2/Result.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +using namespace NsSmartDeviceLinkRPC; + +Result::Result() : mInternal(INVALID_ENUM) +{} + +Result::Result(ResultInternal e) : mInternal(e) +{} + +Result::Result(const Result& result) +{ + mInternal = result.mInternal; +} + +Result::ResultInternal Result::get(void) const +{ + return mInternal; +} +void Result::set(ResultInternal e) +{ + mInternal = e; +} + +// TODO(AK): remove this after new code generation +Result::operator NsSmartDeviceLinkRPCV2::Result() +{ + return NsSmartDeviceLinkRPCV2::Result( + static_cast<NsSmartDeviceLinkRPCV2::Result::ResultInternal>(mInternal)); +} + +// TODO(AK): remove this after new code generation +Result& Result::operator= (const Result& result) +{ + mInternal = result.mInternal; + return *this; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.cpp new file mode 100644 index 000000000..d6ba6a214 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.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 <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/Result.h" +#include "ResultMarshaller.h" +#include "ResultMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const Result::ResultInternal ResultMarshaller::getIndex(const char* s) +{ + if(!s) + return Result::INVALID_ENUM; + const struct PerfectHashTable* p=Result_intHash::getPointer(s,strlen(s)); + return p ? static_cast<Result::ResultInternal>(p->idx) : Result::INVALID_ENUM; +} + + +bool ResultMarshaller::fromJSON(const Json::Value& s,Result& e) +{ + e.mInternal=Result::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=Result::INVALID_ENUM); +} + + +Json::Value ResultMarshaller::toJSON(const Result& e) +{ + if(e.mInternal==Result::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool ResultMarshaller::fromString(const std::string& s,Result& e) +{ + e.mInternal=Result::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string ResultMarshaller::toString(const Result& e) +{ + Json::FastWriter writer; + return e.mInternal==Result::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable ResultMarshaller::mHashTable[20]= +{ + {"SUCCESS",0}, + {"INVALID_DATA",1}, + {"UNSUPPORTED_REQUEST",2}, + {"OUT_OF_MEMORY",3}, + {"TOO_MANY_PENDING_REQUESTS",4}, + {"INVALID_ID",5}, + {"DUPLICATE_NAME",6}, + {"TOO_MANY_APPLICATIONS",7}, + {"APPLICATION_REGISTERED_ALREADY",8}, + {"UNSUPPORTED_VERSION",9}, + {"WRONG_LANGUAGE",10}, + {"APPLICATION_NOT_REGISTERED",11}, + {"IN_USE",12}, + {"SUBSCRIBED_ALREADY",13}, + {"REJECTED",14}, + {"ABORTED",15}, + {"IGNORED",16}, + {"UNSUPPORTED_BUTTON",17}, + {"FILE_NOT_FOUND",18}, + {"GENERIC_ERROR",19} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp new file mode 100644 index 000000000..f23c23085 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp @@ -0,0 +1,36 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name Result_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +SUCCESS,0 +INVALID_DATA,1 +UNSUPPORTED_REQUEST,2 +OUT_OF_MEMORY,3 +TOO_MANY_PENDING_REQUESTS,4 +INVALID_ID,5 +DUPLICATE_NAME,6 +TOO_MANY_APPLICATIONS,7 +APPLICATION_REGISTERED_ALREADY,8 +UNSUPPORTED_VERSION,9 +WRONG_LANGUAGE,10 +APPLICATION_NOT_REGISTERED,11 +IN_USE,12 +SUBSCRIBED_ALREADY,13 +REJECTED,14 +ABORTED,15 +IGNORED,16 +UNSUPPORTED_BUTTON,17 +FILE_NOT_FOUND,18 +GENERIC_ERROR,19 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.h new file mode 100644 index 000000000..7361c973c --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_RESULTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_RESULTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/Result.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for Result + + class ResultMarshaller + { + public: + + static std::string toName(const Result& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(Result& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=Result::INVALID_ENUM; + } + + static bool checkIntegrity(Result& e) { return e.mInternal!=Result::INVALID_ENUM; } + static bool checkIntegrityConst(const Result& e) { return e.mInternal!=Result::INVALID_ENUM; } + + static bool fromString(const std::string& s,Result& e); + static const std::string toString(const Result& e); + + static bool fromJSON(const Json::Value& s,Result& e); + static Json::Value toJSON(const Result& e); + + static const char* getName(Result::ResultInternal e) + { + return (e>=0 && e<20) ? mHashTable[e].name : NULL; + } + + static const Result::ResultInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[20]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.inc new file mode 100644 index 000000000..f79567fdc --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.inc @@ -0,0 +1,183 @@ +/* Copyright (c) 2013 Ford Motor Company */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp */ +/* Computed positions: -k'1,13' */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." +#endif + + +#define TOTAL_KEYWORDS 20 +#define MIN_WORD_LENGTH 6 +#define MAX_WORD_LENGTH 30 +#define MIN_HASH_VALUE 6 +#define MAX_HASH_VALUE 40 +/* maximum key range = 35, duplicates = 0 */ + +class Result_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline unsigned int +Result_intHash::hash (register const char *str, register unsigned int len) +{ + static const unsigned char asso_values[] = + { + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 10, 5, 41, 0, 41, + 20, 0, 41, 0, 41, 41, 0, 15, 0, 5, + 41, 41, 0, 15, 0, 0, 5, 0, 41, 0, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41 + }; + register int hval = len; + + switch (hval) + { + default: + hval += asso_values[(unsigned char)str[12]]; + /*FALLTHROUGH*/ + case 12: + case 11: + case 10: + case 9: + case 8: + case 7: + case 6: + case 5: + case 4: + case 3: + case 2: + case 1: + hval += asso_values[(unsigned char)str[0]]; + break; + } + return hval; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +Result_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 0, 0, 6, 7, 8, 0, 10, 0, 12, 13, + 14, 0, 0, 7, 13, 19, 0, 21, 7, 18, 19, 25, 0, 0, + 0, 14, 0, 0, 0, 18, 14, 0, 26, 0, 0, 0, 30 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, {""}, {""}, +#line 29 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"IN_USE",12}, +#line 33 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"IGNORED",16}, +#line 31 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"REJECTED",14}, + {""}, +#line 22 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"INVALID_ID",5}, + {""}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"INVALID_DATA",1}, +#line 36 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"GENERIC_ERROR",19}, +#line 27 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"WRONG_LANGUAGE",10}, + {""}, {""}, +#line 32 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"ABORTED",15}, +#line 20 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"OUT_OF_MEMORY",3}, +#line 19 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"UNSUPPORTED_REQUEST",2}, + {""}, +#line 24 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"TOO_MANY_APPLICATIONS",7}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"SUCCESS",0}, +#line 34 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"UNSUPPORTED_BUTTON",17}, +#line 26 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"UNSUPPORTED_VERSION",9}, +#line 21 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"TOO_MANY_PENDING_REQUESTS",4}, + {""}, {""}, {""}, +#line 23 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"DUPLICATE_NAME",6}, + {""}, {""}, {""}, +#line 30 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"SUBSCRIBED_ALREADY",13}, +#line 35 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"FILE_NOT_FOUND",18}, + {""}, +#line 28 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"APPLICATION_NOT_REGISTERED",11}, + {""}, {""}, {""}, +#line 25 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/ResultMarshaller.gp" + {"APPLICATION_REGISTERED_ALREADY",8} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetGlobalProperties_request.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetGlobalProperties_request.cpp new file mode 100644 index 000000000..ca2346662 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetGlobalProperties_request.cpp @@ -0,0 +1,144 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/SetGlobalProperties_request.h" +#include "SetGlobalProperties_requestMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "TTSChunkMarshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +SetGlobalProperties_request& SetGlobalProperties_request::operator =(const SetGlobalProperties_request& c) +{ + helpPrompt= c.helpPrompt ? new std::vector<TTSChunk>(c.helpPrompt[0]) : 0; + timeoutPrompt= c.timeoutPrompt ? new std::vector<TTSChunk>(c.timeoutPrompt[0]) : 0; + + return *this;} + + +SetGlobalProperties_request::~SetGlobalProperties_request(void) +{ + if(helpPrompt) + delete helpPrompt; + if(timeoutPrompt) + delete timeoutPrompt; +} + + +SetGlobalProperties_request::SetGlobalProperties_request(const SetGlobalProperties_request& c) +{ + *this=c; +} + + +bool SetGlobalProperties_request::checkIntegrity(void) +{ + return SetGlobalProperties_requestMarshaller::checkIntegrity(*this); +} + + +SetGlobalProperties_request::SetGlobalProperties_request(void) : SDLRPCRequest(PROTOCOL_VERSION,Marshaller::METHOD_SETGLOBALPROPERTIES_REQUEST), + helpPrompt(0), + timeoutPrompt(0) +{ +} + + + +bool SetGlobalProperties_request::set_helpPrompt(const std::vector<TTSChunk>& helpPrompt_) +{ + unsigned int i=helpPrompt_.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!TTSChunkMarshaller::checkIntegrityConst(helpPrompt_[i])) return false; + } + delete helpPrompt; + helpPrompt=0; + + helpPrompt=new std::vector<TTSChunk>(helpPrompt_); + return true; +} + +void SetGlobalProperties_request::reset_helpPrompt(void) +{ + if(helpPrompt) + delete helpPrompt; + helpPrompt=0; +} + +bool SetGlobalProperties_request::set_timeoutPrompt(const std::vector<TTSChunk>& timeoutPrompt_) +{ + unsigned int i=timeoutPrompt_.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!TTSChunkMarshaller::checkIntegrityConst(timeoutPrompt_[i])) return false; + } + delete timeoutPrompt; + timeoutPrompt=0; + + timeoutPrompt=new std::vector<TTSChunk>(timeoutPrompt_); + return true; +} + +void SetGlobalProperties_request::reset_timeoutPrompt(void) +{ + if(timeoutPrompt) + delete timeoutPrompt; + timeoutPrompt=0; +} + + + + +const std::vector<TTSChunk>* SetGlobalProperties_request::get_helpPrompt(void) const +{ + return helpPrompt; +} + +const std::vector<TTSChunk>* SetGlobalProperties_request::get_timeoutPrompt(void) const +{ + return timeoutPrompt; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetGlobalProperties_requestMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetGlobalProperties_requestMarshaller.cpp new file mode 100644 index 000000000..1fb2135ec --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetGlobalProperties_requestMarshaller.cpp @@ -0,0 +1,201 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/SetGlobalProperties_request.h" +#include "TTSChunkMarshaller.h" + +#include "SetGlobalProperties_requestMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool SetGlobalProperties_requestMarshaller::checkIntegrity(SetGlobalProperties_request& s) +{ + return checkIntegrityConst(s); +} + + +bool SetGlobalProperties_requestMarshaller::fromString(const std::string& s,SetGlobalProperties_request& 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 SetGlobalProperties_requestMarshaller::toString(const SetGlobalProperties_request& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SetGlobalProperties_requestMarshaller::checkIntegrityConst(const SetGlobalProperties_request& s) +{ + if(s.helpPrompt) + { + unsigned int i=s.helpPrompt[0].size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!TTSChunkMarshaller::checkIntegrityConst(s.helpPrompt[0][i])) return false; + } + } + if(s.timeoutPrompt) + { + unsigned int i=s.timeoutPrompt[0].size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!TTSChunkMarshaller::checkIntegrityConst(s.timeoutPrompt[0][i])) return false; + } + } + return true; +} + +Json::Value SetGlobalProperties_requestMarshaller::toJSON(const SetGlobalProperties_request& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["request"]=Json::Value(Json::objectValue); + json["request"]["name"]=Json::Value("SetGlobalProperties"); + json["request"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + if(e.helpPrompt) + { + unsigned int sz=e.helpPrompt->size(); + j["helpPrompt"]=Json::Value(Json::arrayValue); + j["helpPrompt"].resize(sz); + for(unsigned int i=0;i<sz;i++) + j["helpPrompt"][i]=TTSChunkMarshaller::toJSON(e.helpPrompt[0][i]); + } + + if(e.timeoutPrompt) + { + unsigned int sz=e.timeoutPrompt->size(); + j["timeoutPrompt"]=Json::Value(Json::arrayValue); + j["timeoutPrompt"].resize(sz); + for(unsigned int i=0;i<sz;i++) + j["timeoutPrompt"][i]=TTSChunkMarshaller::toJSON(e.timeoutPrompt[0][i]); + } + + json["request"]["parameters"]=j; + return json; +} + + +bool SetGlobalProperties_requestMarshaller::fromJSON(const Json::Value& js,SetGlobalProperties_request& c) +{ + if(c.helpPrompt) delete c.helpPrompt; + c.helpPrompt=0; + + if(c.timeoutPrompt) delete c.timeoutPrompt; + c.timeoutPrompt=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("request")) return false; + + if(!js["request"].isObject()) return false; + const Json::Value& j2=js["request"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("SetGlobalProperties")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(json.isMember("helpPrompt")) + { + const Json::Value& j=json["helpPrompt"]; + if(!j.isArray()) return false; + c.helpPrompt=new std::vector<TTSChunk>(); + c.helpPrompt->resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + { + TTSChunk t; + if(!TTSChunkMarshaller::fromJSON(j[i],t)) + return false; + c.helpPrompt[0][i]=t; + } + + } + if(json.isMember("timeoutPrompt")) + { + const Json::Value& j=json["timeoutPrompt"]; + if(!j.isArray()) return false; + c.timeoutPrompt=new std::vector<TTSChunk>(); + c.timeoutPrompt->resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + { + TTSChunk t; + if(!TTSChunkMarshaller::fromJSON(j[i],t)) + return false; + c.timeoutPrompt[0][i]=t; + } + + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetGlobalProperties_requestMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetGlobalProperties_requestMarshaller.h new file mode 100644 index 000000000..15efd9deb --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetGlobalProperties_requestMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_SETGLOBALPROPERTIES_REQUESTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_SETGLOBALPROPERTIES_REQUESTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/SetGlobalProperties_request.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct SetGlobalProperties_requestMarshaller + { + static bool checkIntegrity(SetGlobalProperties_request& e); + static bool checkIntegrityConst(const SetGlobalProperties_request& e); + + static bool fromString(const std::string& s,SetGlobalProperties_request& e); + static const std::string toString(const SetGlobalProperties_request& e); + + static bool fromJSON(const Json::Value& s,SetGlobalProperties_request& e); + static Json::Value toJSON(const SetGlobalProperties_request& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetGlobalProperties_response.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetGlobalProperties_response.cpp new file mode 100644 index 000000000..042acaa74 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetGlobalProperties_response.cpp @@ -0,0 +1,77 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/SetGlobalProperties_response.h" +#include "SetGlobalProperties_responseMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +SetGlobalProperties_response& SetGlobalProperties_response::operator =(const SetGlobalProperties_response& c) +{ + success = c.success; + resultCode = c.resultCode; + info = c.info ? new std::string(c.info[0]) : 0; + + return *this; +} + +SetGlobalProperties_response::~SetGlobalProperties_response(void) +{} + +SetGlobalProperties_response::SetGlobalProperties_response(const SetGlobalProperties_response& c) +{ + *this = c; +} + +bool SetGlobalProperties_response::checkIntegrity(void) +{ + return SetGlobalProperties_responseMarshaller::checkIntegrity(*this); +} + +SetGlobalProperties_response::SetGlobalProperties_response(void) + : SDLRPCResponse(PROTOCOL_VERSION, Marshaller::METHOD_SETGLOBALPROPERTIES_RESPONSE) +{ +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetGlobalProperties_responseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetGlobalProperties_responseMarshaller.cpp new file mode 100644 index 000000000..f384f4cb2 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetGlobalProperties_responseMarshaller.cpp @@ -0,0 +1,161 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/SetGlobalProperties_response.h" +#include "ResultMarshaller.h" + +#include "SetGlobalProperties_responseMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool SetGlobalProperties_responseMarshaller::checkIntegrity(SetGlobalProperties_response& s) +{ + return checkIntegrityConst(s); +} + + +bool SetGlobalProperties_responseMarshaller::fromString(const std::string& s,SetGlobalProperties_response& 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 SetGlobalProperties_responseMarshaller::toString(const SetGlobalProperties_response& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SetGlobalProperties_responseMarshaller::checkIntegrityConst(const SetGlobalProperties_response& s) +{ + if(!ResultMarshaller::checkIntegrityConst(static_cast<NsSmartDeviceLinkRPCV2::Result>(s.resultCode))) return false; + if(s.info && s.info->length()>1000) return false; + return true; +} + +Json::Value SetGlobalProperties_responseMarshaller::toJSON(const SetGlobalProperties_response& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["response"]=Json::Value(Json::objectValue); + json["response"]["name"]=Json::Value("SetGlobalProperties"); + json["response"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["success"]=Json::Value(e.success); + + j["resultCode"]=ResultMarshaller::toJSON(static_cast<NsSmartDeviceLinkRPCV2::Result>(e.resultCode)); + + if(e.info) + j["info"]=Json::Value(*e.info); + + json["response"]["parameters"]=j; + return json; +} + + +bool SetGlobalProperties_responseMarshaller::fromJSON(const Json::Value& js,SetGlobalProperties_response& c) +{ + if(c.info) delete c.info; + c.info=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("response")) return false; + + if(!js["response"].isObject()) return false; + const Json::Value& j2=js["response"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("SetGlobalProperties")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("success")) return false; + { + const Json::Value& j=json["success"]; + if(!j.isBool()) return false; + c.success=j.asBool(); + } + if(!json.isMember("resultCode")) return false; + { + const Json::Value& j=json["resultCode"]; + NsSmartDeviceLinkRPC::Result result = static_cast<NsSmartDeviceLinkRPC::Result>(c.resultCode); + if(!ResultMarshaller::fromJSON(j, result)) + return false; + c.resultCode = static_cast<NsSmartDeviceLinkRPCV2::Result>(result); + } + if(json.isMember("info")) + { + const Json::Value& j=json["info"]; + if(!j.isString()) return false; + c.info=new std::string(j.asString()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetGlobalProperties_responseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetGlobalProperties_responseMarshaller.h new file mode 100644 index 000000000..56928f332 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetGlobalProperties_responseMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_SETGLOBALPROPERTIES_RESPONSEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_SETGLOBALPROPERTIES_RESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/SetGlobalProperties_response.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct SetGlobalProperties_responseMarshaller + { + static bool checkIntegrity(SetGlobalProperties_response& e); + static bool checkIntegrityConst(const SetGlobalProperties_response& e); + + static bool fromString(const std::string& s,SetGlobalProperties_response& e); + static const std::string toString(const SetGlobalProperties_response& e); + + static bool fromJSON(const Json::Value& s,SetGlobalProperties_response& e); + static Json::Value toJSON(const SetGlobalProperties_response& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetMediaClockTimer_request.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetMediaClockTimer_request.cpp new file mode 100644 index 000000000..7c2a2a2a7 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetMediaClockTimer_request.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 "../include/JSONHandler/SDLRPCObjects/V1/SetMediaClockTimer_request.h" +#include "SetMediaClockTimer_requestMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "StartTimeMarshaller.h" +#include "UpdateModeMarshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +SetMediaClockTimer_request& SetMediaClockTimer_request::operator =(const SetMediaClockTimer_request& c) +{ + startTime= c.startTime ? new StartTime(c.startTime[0]) : 0; + updateMode= c.updateMode; + + return *this;} + + +SetMediaClockTimer_request::~SetMediaClockTimer_request(void) +{ + if(startTime) + delete startTime; +} + + +SetMediaClockTimer_request::SetMediaClockTimer_request(const SetMediaClockTimer_request& c) +{ + *this=c; +} + + +bool SetMediaClockTimer_request::checkIntegrity(void) +{ + return SetMediaClockTimer_requestMarshaller::checkIntegrity(*this); +} + + +SetMediaClockTimer_request::SetMediaClockTimer_request(void) : SDLRPCRequest(PROTOCOL_VERSION,Marshaller::METHOD_SETMEDIACLOCKTIMER_REQUEST), + startTime(0) +{ +} + + + +bool SetMediaClockTimer_request::set_startTime(const StartTime& startTime_) +{ + if(!StartTimeMarshaller::checkIntegrityConst(startTime_)) return false; + delete startTime; + startTime=0; + + startTime=new StartTime(startTime_); + return true; +} + +void SetMediaClockTimer_request::reset_startTime(void) +{ + if(startTime) + delete startTime; + startTime=0; +} + +bool SetMediaClockTimer_request::set_updateMode(const UpdateMode& updateMode_) +{ + if(!UpdateModeMarshaller::checkIntegrityConst(updateMode_)) return false; + updateMode=updateMode_; + return true; +} + + + + +const StartTime* SetMediaClockTimer_request::get_startTime(void) const +{ + return startTime; +} + +const UpdateMode& SetMediaClockTimer_request::get_updateMode(void) const +{ + return updateMode; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetMediaClockTimer_requestMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetMediaClockTimer_requestMarshaller.cpp new file mode 100644 index 000000000..520b0a29e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetMediaClockTimer_requestMarshaller.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 "../include/JSONHandler/SDLRPCObjects/V1/SetMediaClockTimer_request.h" +#include "StartTimeMarshaller.h" +#include "UpdateModeMarshaller.h" + +#include "SetMediaClockTimer_requestMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool SetMediaClockTimer_requestMarshaller::checkIntegrity(SetMediaClockTimer_request& s) +{ + return checkIntegrityConst(s); +} + + +bool SetMediaClockTimer_requestMarshaller::fromString(const std::string& s,SetMediaClockTimer_request& 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 SetMediaClockTimer_requestMarshaller::toString(const SetMediaClockTimer_request& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SetMediaClockTimer_requestMarshaller::checkIntegrityConst(const SetMediaClockTimer_request& s) +{ + if(s.startTime && !StartTimeMarshaller::checkIntegrityConst(*s.startTime)) return false; + if(!UpdateModeMarshaller::checkIntegrityConst(s.updateMode)) return false; + return true; +} + +Json::Value SetMediaClockTimer_requestMarshaller::toJSON(const SetMediaClockTimer_request& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["request"]=Json::Value(Json::objectValue); + json["request"]["name"]=Json::Value("SetMediaClockTimer"); + json["request"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + if(e.startTime) + j["startTime"]=StartTimeMarshaller::toJSON(*e.startTime); + + j["updateMode"]=UpdateModeMarshaller::toJSON(e.updateMode); + + json["request"]["parameters"]=j; + return json; +} + + +bool SetMediaClockTimer_requestMarshaller::fromJSON(const Json::Value& js,SetMediaClockTimer_request& c) +{ + if(c.startTime) delete c.startTime; + c.startTime=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("request")) return false; + + if(!js["request"].isObject()) return false; + const Json::Value& j2=js["request"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("SetMediaClockTimer")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(json.isMember("startTime")) + { + const Json::Value& j=json["startTime"]; + c.startTime=new StartTime(); + if(!StartTimeMarshaller::fromJSON(j,c.startTime[0])) + return false; + } + if(!json.isMember("updateMode")) return false; + { + const Json::Value& j=json["updateMode"]; + if(!UpdateModeMarshaller::fromJSON(j,c.updateMode)) + return false; + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetMediaClockTimer_requestMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetMediaClockTimer_requestMarshaller.h new file mode 100644 index 000000000..f0f307bf8 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetMediaClockTimer_requestMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_SETMEDIACLOCKTIMER_REQUESTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_SETMEDIACLOCKTIMER_REQUESTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/SetMediaClockTimer_request.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct SetMediaClockTimer_requestMarshaller + { + static bool checkIntegrity(SetMediaClockTimer_request& e); + static bool checkIntegrityConst(const SetMediaClockTimer_request& e); + + static bool fromString(const std::string& s,SetMediaClockTimer_request& e); + static const std::string toString(const SetMediaClockTimer_request& e); + + static bool fromJSON(const Json::Value& s,SetMediaClockTimer_request& e); + static Json::Value toJSON(const SetMediaClockTimer_request& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetMediaClockTimer_response.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetMediaClockTimer_response.cpp new file mode 100644 index 000000000..4ef3d18da --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetMediaClockTimer_response.cpp @@ -0,0 +1,76 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/SetMediaClockTimer_response.h" +#include "SetMediaClockTimer_responseMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +SetMediaClockTimer_response& SetMediaClockTimer_response::operator =(const SetMediaClockTimer_response& c) +{ + success = c.success; + resultCode = c.resultCode; + info = c.info ? new std::string(c.info[0]) : 0; + + return *this; +} + +SetMediaClockTimer_response::~SetMediaClockTimer_response(void) +{} + +SetMediaClockTimer_response::SetMediaClockTimer_response(const SetMediaClockTimer_response& c) +{ + *this = c; +} + +bool SetMediaClockTimer_response::checkIntegrity(void) +{ + return SetMediaClockTimer_responseMarshaller::checkIntegrity(*this); +} + +SetMediaClockTimer_response::SetMediaClockTimer_response(void) + : SDLRPCResponse(PROTOCOL_VERSION, Marshaller::METHOD_SETMEDIACLOCKTIMER_RESPONSE) +{} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetMediaClockTimer_responseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetMediaClockTimer_responseMarshaller.cpp new file mode 100644 index 000000000..429adf6eb --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetMediaClockTimer_responseMarshaller.cpp @@ -0,0 +1,161 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/SetMediaClockTimer_response.h" +#include "ResultMarshaller.h" + +#include "SetMediaClockTimer_responseMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool SetMediaClockTimer_responseMarshaller::checkIntegrity(SetMediaClockTimer_response& s) +{ + return checkIntegrityConst(s); +} + + +bool SetMediaClockTimer_responseMarshaller::fromString(const std::string& s,SetMediaClockTimer_response& 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 SetMediaClockTimer_responseMarshaller::toString(const SetMediaClockTimer_response& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SetMediaClockTimer_responseMarshaller::checkIntegrityConst(const SetMediaClockTimer_response& s) +{ + if(!ResultMarshaller::checkIntegrityConst(static_cast<NsSmartDeviceLinkRPCV2::Result>(s.resultCode))) return false; + if(s.info && s.info->length()>1000) return false; + return true; +} + +Json::Value SetMediaClockTimer_responseMarshaller::toJSON(const SetMediaClockTimer_response& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["response"]=Json::Value(Json::objectValue); + json["response"]["name"]=Json::Value("SetMediaClockTimer"); + json["response"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["success"]=Json::Value(e.success); + + j["resultCode"]=ResultMarshaller::toJSON(static_cast<NsSmartDeviceLinkRPCV2::Result>(e.resultCode)); + + if(e.info) + j["info"]=Json::Value(*e.info); + + json["response"]["parameters"]=j; + return json; +} + + +bool SetMediaClockTimer_responseMarshaller::fromJSON(const Json::Value& js,SetMediaClockTimer_response& c) +{ + if(c.info) delete c.info; + c.info=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("response")) return false; + + if(!js["response"].isObject()) return false; + const Json::Value& j2=js["response"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("SetMediaClockTimer")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("success")) return false; + { + const Json::Value& j=json["success"]; + if(!j.isBool()) return false; + c.success=j.asBool(); + } + if(!json.isMember("resultCode")) return false; + { + const Json::Value& j=json["resultCode"]; + NsSmartDeviceLinkRPC::Result result = static_cast<NsSmartDeviceLinkRPC::Result>(c.resultCode); + if(!ResultMarshaller::fromJSON(j, result)) + return false; + c.resultCode = static_cast<NsSmartDeviceLinkRPCV2::Result>(result); + } + if(json.isMember("info")) + { + const Json::Value& j=json["info"]; + if(!j.isString()) return false; + c.info=new std::string(j.asString()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetMediaClockTimer_responseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetMediaClockTimer_responseMarshaller.h new file mode 100644 index 000000000..4af1b73cb --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SetMediaClockTimer_responseMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_SETMEDIACLOCKTIMER_RESPONSEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_SETMEDIACLOCKTIMER_RESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/SetMediaClockTimer_response.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct SetMediaClockTimer_responseMarshaller + { + static bool checkIntegrity(SetMediaClockTimer_response& e); + static bool checkIntegrityConst(const SetMediaClockTimer_response& e); + + static bool fromString(const std::string& s,SetMediaClockTimer_response& e); + static const std::string toString(const SetMediaClockTimer_response& e); + + static bool fromJSON(const Json::Value& s,SetMediaClockTimer_response& e); + static Json::Value toJSON(const SetMediaClockTimer_response& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Show_request.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Show_request.cpp new file mode 100644 index 000000000..969b6a816 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Show_request.cpp @@ -0,0 +1,238 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/Show_request.h" +#include "Show_requestMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "TextAlignmentMarshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +Show_request& Show_request::operator =(const Show_request& c) +{ + mainField1= c.mainField1 ? new std::string(c.mainField1[0]) : 0; + mainField2= c.mainField2 ? new std::string(c.mainField2[0]) : 0; + alignment= c.alignment ? new TextAlignment(c.alignment[0]) : 0; + statusBar= c.statusBar ? new std::string(c.statusBar[0]) : 0; + mediaClock= c.mediaClock ? new std::string(c.mediaClock[0]) : 0; + mediaTrack= c.mediaTrack ? new std::string(c.mediaTrack[0]) : 0; + + return *this;} + + +Show_request::~Show_request(void) +{ + if(mainField1) + delete mainField1; + if(mainField2) + delete mainField2; + if(alignment) + delete alignment; + if(statusBar) + delete statusBar; + if(mediaClock) + delete mediaClock; + if(mediaTrack) + delete mediaTrack; +} + + +Show_request::Show_request(const Show_request& c) +{ + *this=c; +} + + +bool Show_request::checkIntegrity(void) +{ + return Show_requestMarshaller::checkIntegrity(*this); +} + + +Show_request::Show_request(void) : SDLRPCRequest(PROTOCOL_VERSION,Marshaller::METHOD_SHOW_REQUEST), + mainField1(0), + mainField2(0), + alignment(0), + statusBar(0), + mediaClock(0), + mediaTrack(0) +{ +} + + + +bool Show_request::set_mainField1(const std::string& mainField1_) +{ + if(mainField1_.length()>500) return false; + delete mainField1; + mainField1=0; + + mainField1=new std::string(mainField1_); + return true; +} + +void Show_request::reset_mainField1(void) +{ + if(mainField1) + delete mainField1; + mainField1=0; +} + +bool Show_request::set_mainField2(const std::string& mainField2_) +{ + if(mainField2_.length()>500) return false; + delete mainField2; + mainField2=0; + + mainField2=new std::string(mainField2_); + return true; +} + +void Show_request::reset_mainField2(void) +{ + if(mainField2) + delete mainField2; + mainField2=0; +} + +bool Show_request::set_alignment(const TextAlignment& alignment_) +{ + if(!TextAlignmentMarshaller::checkIntegrityConst(alignment_)) return false; + delete alignment; + alignment=0; + + alignment=new TextAlignment(alignment_); + return true; +} + +void Show_request::reset_alignment(void) +{ + if(alignment) + delete alignment; + alignment=0; +} + +bool Show_request::set_statusBar(const std::string& statusBar_) +{ + if(statusBar_.length()>500) return false; + delete statusBar; + statusBar=0; + + statusBar=new std::string(statusBar_); + return true; +} + +void Show_request::reset_statusBar(void) +{ + if(statusBar) + delete statusBar; + statusBar=0; +} + +bool Show_request::set_mediaClock(const std::string& mediaClock_) +{ + if(mediaClock_.length()>500) return false; + delete mediaClock; + mediaClock=0; + + mediaClock=new std::string(mediaClock_); + return true; +} + +void Show_request::reset_mediaClock(void) +{ + if(mediaClock) + delete mediaClock; + mediaClock=0; +} + +bool Show_request::set_mediaTrack(const std::string& mediaTrack_) +{ + if(mediaTrack_.length()>500) return false; + delete mediaTrack; + mediaTrack=0; + + mediaTrack=new std::string(mediaTrack_); + return true; +} + +void Show_request::reset_mediaTrack(void) +{ + if(mediaTrack) + delete mediaTrack; + mediaTrack=0; +} + + + + +const std::string* Show_request::get_mainField1(void) const +{ + return mainField1; +} + +const std::string* Show_request::get_mainField2(void) const +{ + return mainField2; +} + +const TextAlignment* Show_request::get_alignment(void) const +{ + return alignment; +} + +const std::string* Show_request::get_statusBar(void) const +{ + return statusBar; +} + +const std::string* Show_request::get_mediaClock(void) const +{ + return mediaClock; +} + +const std::string* Show_request::get_mediaTrack(void) const +{ + return mediaTrack; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Show_requestMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Show_requestMarshaller.cpp new file mode 100644 index 000000000..56f83ecf3 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Show_requestMarshaller.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 "../include/JSONHandler/SDLRPCObjects/V1/Show_request.h" +#include "TextAlignmentMarshaller.h" + +#include "Show_requestMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool Show_requestMarshaller::checkIntegrity(Show_request& s) +{ + return checkIntegrityConst(s); +} + + +bool Show_requestMarshaller::fromString(const std::string& s,Show_request& 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 Show_requestMarshaller::toString(const Show_request& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool Show_requestMarshaller::checkIntegrityConst(const Show_request& s) +{ + if(s.mainField1 && s.mainField1->length()>500) return false; + if(s.mainField2 && s.mainField2->length()>500) return false; + if(s.alignment && !TextAlignmentMarshaller::checkIntegrityConst(*s.alignment)) return false; + if(s.statusBar && s.statusBar->length()>500) return false; + if(s.mediaClock && s.mediaClock->length()>500) return false; + if(s.mediaTrack && s.mediaTrack->length()>500) return false; + return true; +} + +Json::Value Show_requestMarshaller::toJSON(const Show_request& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["request"]=Json::Value(Json::objectValue); + json["request"]["name"]=Json::Value("Show"); + json["request"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + if(e.mainField1) + j["mainField1"]=Json::Value(*e.mainField1); + + if(e.mainField2) + j["mainField2"]=Json::Value(*e.mainField2); + + if(e.alignment) + j["alignment"]=TextAlignmentMarshaller::toJSON(*e.alignment); + + if(e.statusBar) + j["statusBar"]=Json::Value(*e.statusBar); + + if(e.mediaClock) + j["mediaClock"]=Json::Value(*e.mediaClock); + + if(e.mediaTrack) + j["mediaTrack"]=Json::Value(*e.mediaTrack); + + json["request"]["parameters"]=j; + return json; +} + + +bool Show_requestMarshaller::fromJSON(const Json::Value& js,Show_request& c) +{ + if(c.mainField1) delete c.mainField1; + c.mainField1=0; + + if(c.mainField2) delete c.mainField2; + c.mainField2=0; + + if(c.alignment) delete c.alignment; + c.alignment=0; + + if(c.statusBar) delete c.statusBar; + c.statusBar=0; + + if(c.mediaClock) delete c.mediaClock; + c.mediaClock=0; + + if(c.mediaTrack) delete c.mediaTrack; + c.mediaTrack=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("request")) return false; + + if(!js["request"].isObject()) return false; + const Json::Value& j2=js["request"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("Show")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(json.isMember("mainField1")) + { + const Json::Value& j=json["mainField1"]; + if(!j.isString()) return false; + c.mainField1=new std::string(j.asString()); + } + if(json.isMember("mainField2")) + { + const Json::Value& j=json["mainField2"]; + if(!j.isString()) return false; + c.mainField2=new std::string(j.asString()); + } + if(json.isMember("alignment")) + { + const Json::Value& j=json["alignment"]; + c.alignment=new TextAlignment(); + if(!TextAlignmentMarshaller::fromJSON(j,c.alignment[0])) + return false; + } + if(json.isMember("statusBar")) + { + const Json::Value& j=json["statusBar"]; + if(!j.isString()) return false; + c.statusBar=new std::string(j.asString()); + } + if(json.isMember("mediaClock")) + { + const Json::Value& j=json["mediaClock"]; + if(!j.isString()) return false; + c.mediaClock=new std::string(j.asString()); + } + if(json.isMember("mediaTrack")) + { + const Json::Value& j=json["mediaTrack"]; + if(!j.isString()) return false; + c.mediaTrack=new std::string(j.asString()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Show_requestMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Show_requestMarshaller.h new file mode 100644 index 000000000..15b731256 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Show_requestMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_SHOW_REQUESTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_SHOW_REQUESTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/Show_request.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct Show_requestMarshaller + { + static bool checkIntegrity(Show_request& e); + static bool checkIntegrityConst(const Show_request& e); + + static bool fromString(const std::string& s,Show_request& e); + static const std::string toString(const Show_request& e); + + static bool fromJSON(const Json::Value& s,Show_request& e); + static Json::Value toJSON(const Show_request& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Show_response.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Show_response.cpp new file mode 100644 index 000000000..1d94ea720 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Show_response.cpp @@ -0,0 +1,75 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/Show_response.h" +#include "Show_responseMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +Show_response& Show_response::operator =(const Show_response& c) +{ + success = c.success; + resultCode = c.resultCode; + info = c.info ? new std::string(c.info[0]) : 0; + + return *this; +} + +Show_response::~Show_response(void) +{} + +Show_response::Show_response(const Show_response& c) +{ + *this = c; +} + +bool Show_response::checkIntegrity(void) +{ + return Show_responseMarshaller::checkIntegrity(*this); +} + +Show_response::Show_response(void) : SDLRPCResponse(PROTOCOL_VERSION, Marshaller::METHOD_SHOW_RESPONSE) +{} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Show_responseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Show_responseMarshaller.cpp new file mode 100644 index 000000000..50654f6dd --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Show_responseMarshaller.cpp @@ -0,0 +1,161 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/Show_response.h" +#include "ResultMarshaller.h" + +#include "Show_responseMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool Show_responseMarshaller::checkIntegrity(Show_response& s) +{ + return checkIntegrityConst(s); +} + + +bool Show_responseMarshaller::fromString(const std::string& s,Show_response& 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 Show_responseMarshaller::toString(const Show_response& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool Show_responseMarshaller::checkIntegrityConst(const Show_response& s) +{ + if(!ResultMarshaller::checkIntegrityConst(static_cast<NsSmartDeviceLinkRPCV2::Result>(s.resultCode))) return false; + if(s.info && s.info->length()>1000) return false; + return true; +} + +Json::Value Show_responseMarshaller::toJSON(const Show_response& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["response"]=Json::Value(Json::objectValue); + json["response"]["name"]=Json::Value("Show"); + json["response"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["success"]=Json::Value(e.success); + + j["resultCode"]=ResultMarshaller::toJSON(static_cast<NsSmartDeviceLinkRPCV2::Result>(e.resultCode)); + + if(e.info) + j["info"]=Json::Value(*e.info); + + json["response"]["parameters"]=j; + return json; +} + + +bool Show_responseMarshaller::fromJSON(const Json::Value& js,Show_response& c) +{ + if(c.info) delete c.info; + c.info=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("response")) return false; + + if(!js["response"].isObject()) return false; + const Json::Value& j2=js["response"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("Show")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("success")) return false; + { + const Json::Value& j=json["success"]; + if(!j.isBool()) return false; + c.success=j.asBool(); + } + if(!json.isMember("resultCode")) return false; + { + const Json::Value& j=json["resultCode"]; + NsSmartDeviceLinkRPC::Result result = static_cast<NsSmartDeviceLinkRPC::Result>(c.resultCode); + if(!ResultMarshaller::fromJSON(j, result)) + return false; + c.resultCode = static_cast<NsSmartDeviceLinkRPCV2::Result>(result); + } + if(json.isMember("info")) + { + const Json::Value& j=json["info"]; + if(!j.isString()) return false; + c.info=new std::string(j.asString()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Show_responseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Show_responseMarshaller.h new file mode 100644 index 000000000..2b77f20d1 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Show_responseMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_SHOW_RESPONSEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_SHOW_RESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/Show_response.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct Show_responseMarshaller + { + static bool checkIntegrity(Show_response& e); + static bool checkIntegrityConst(const Show_response& e); + + static bool fromString(const std::string& s,Show_response& e); + static const std::string toString(const Show_response& e); + + static bool fromJSON(const Json::Value& s,Show_response& e); + static Json::Value toJSON(const Show_response& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Speak_request.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Speak_request.cpp new file mode 100644 index 000000000..d1d3ad545 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Speak_request.cpp @@ -0,0 +1,94 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/Speak_request.h" +#include "Speak_requestMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "TTSChunkMarshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + +Speak_request::~Speak_request(void) +{ +} + + +Speak_request::Speak_request(const Speak_request& c) +{ + *this=c; +} + + +bool Speak_request::checkIntegrity(void) +{ + return Speak_requestMarshaller::checkIntegrity(*this); +} + + +Speak_request::Speak_request(void) : SDLRPCRequest(PROTOCOL_VERSION,Marshaller::METHOD_SPEAK_REQUEST) +{ +} + + + +bool Speak_request::set_ttsChunks(const std::vector<TTSChunk>& ttsChunks_) +{ + unsigned int i=ttsChunks_.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!TTSChunkMarshaller::checkIntegrityConst(ttsChunks_[i])) return false; + } + ttsChunks=ttsChunks_; + return true; +} + + + + +const std::vector<TTSChunk>& Speak_request::get_ttsChunks(void) const +{ + return ttsChunks; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Speak_requestMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Speak_requestMarshaller.cpp new file mode 100644 index 000000000..4ee518a52 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Speak_requestMarshaller.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 "../include/JSONHandler/SDLRPCObjects/V1/Speak_request.h" +#include "TTSChunkMarshaller.h" + +#include "Speak_requestMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool Speak_requestMarshaller::checkIntegrity(Speak_request& s) +{ + return checkIntegrityConst(s); +} + + +bool Speak_requestMarshaller::fromString(const std::string& s,Speak_request& 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 Speak_requestMarshaller::toString(const Speak_request& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool Speak_requestMarshaller::checkIntegrityConst(const Speak_request& s) +{ + { + unsigned int i=s.ttsChunks.size(); + if(i>100 || i<1) return false; + while(i--) + { + if(!TTSChunkMarshaller::checkIntegrityConst(s.ttsChunks[i])) return false; + } + } + return true; +} + +Json::Value Speak_requestMarshaller::toJSON(const Speak_request& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["request"]=Json::Value(Json::objectValue); + json["request"]["name"]=Json::Value("Speak"); + json["request"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["ttsChunks"]=Json::Value(Json::arrayValue); + j["ttsChunks"].resize(e.ttsChunks.size()); + for(unsigned int i=0;i<e.ttsChunks.size();i++) + j["ttsChunks"][i]=TTSChunkMarshaller::toJSON(e.ttsChunks[i]); + + json["request"]["parameters"]=j; + return json; +} + + +bool Speak_requestMarshaller::fromJSON(const Json::Value& js,Speak_request& c) +{ + try + { + if(!js.isObject()) return false; + + if(!js.isMember("request")) return false; + + if(!js["request"].isObject()) return false; + const Json::Value& j2=js["request"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("Speak")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("ttsChunks")) return false; + { + const Json::Value& j=json["ttsChunks"]; + if(!j.isArray()) return false; + c.ttsChunks.resize(j.size()); + for(unsigned int i=0;i<j.size();i++) + { + TTSChunk t; + if(!TTSChunkMarshaller::fromJSON(j[i],t)) + return false; + c.ttsChunks[i]=t; + } + + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Speak_requestMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Speak_requestMarshaller.h new file mode 100644 index 000000000..0661e66d9 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Speak_requestMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_SPEAK_REQUESTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_SPEAK_REQUESTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/Speak_request.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct Speak_requestMarshaller + { + static bool checkIntegrity(Speak_request& e); + static bool checkIntegrityConst(const Speak_request& e); + + static bool fromString(const std::string& s,Speak_request& e); + static const std::string toString(const Speak_request& e); + + static bool fromJSON(const Json::Value& s,Speak_request& e); + static Json::Value toJSON(const Speak_request& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Speak_response.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Speak_response.cpp new file mode 100644 index 000000000..c6921b220 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Speak_response.cpp @@ -0,0 +1,75 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/Speak_response.h" +#include "Speak_responseMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +Speak_response& Speak_response::operator =(const Speak_response& c) +{ + success = c.success; + resultCode = c.resultCode; + info = c.info ? new std::string(c.info[0]) : 0; + + return *this; +} + +Speak_response::~Speak_response(void) +{} + +Speak_response::Speak_response(const Speak_response& c) +{ + *this = c; +} + +bool Speak_response::checkIntegrity(void) +{ + return Speak_responseMarshaller::checkIntegrity(*this); +} + +Speak_response::Speak_response(void) : SDLRPCResponse(PROTOCOL_VERSION, Marshaller::METHOD_SPEAK_RESPONSE) +{} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Speak_responseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Speak_responseMarshaller.cpp new file mode 100644 index 000000000..5adb1731a --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Speak_responseMarshaller.cpp @@ -0,0 +1,161 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/Speak_response.h" +#include "ResultMarshaller.h" + +#include "Speak_responseMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool Speak_responseMarshaller::checkIntegrity(Speak_response& s) +{ + return checkIntegrityConst(s); +} + + +bool Speak_responseMarshaller::fromString(const std::string& s,Speak_response& 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 Speak_responseMarshaller::toString(const Speak_response& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool Speak_responseMarshaller::checkIntegrityConst(const Speak_response& s) +{ + if(!ResultMarshaller::checkIntegrityConst(static_cast<NsSmartDeviceLinkRPCV2::Result>(s.resultCode))) return false; + if(s.info && s.info->length()>1000) return false; + return true; +} + +Json::Value Speak_responseMarshaller::toJSON(const Speak_response& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["response"]=Json::Value(Json::objectValue); + json["response"]["name"]=Json::Value("Speak"); + json["response"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["success"]=Json::Value(e.success); + + j["resultCode"]=ResultMarshaller::toJSON(static_cast<NsSmartDeviceLinkRPCV2::Result>(e.resultCode)); + + if(e.info) + j["info"]=Json::Value(*e.info); + + json["response"]["parameters"]=j; + return json; +} + + +bool Speak_responseMarshaller::fromJSON(const Json::Value& js,Speak_response& c) +{ + if(c.info) delete c.info; + c.info=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("response")) return false; + + if(!js["response"].isObject()) return false; + const Json::Value& j2=js["response"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("Speak")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("success")) return false; + { + const Json::Value& j=json["success"]; + if(!j.isBool()) return false; + c.success=j.asBool(); + } + if(!json.isMember("resultCode")) return false; + { + const Json::Value& j=json["resultCode"]; + NsSmartDeviceLinkRPC::Result result = static_cast<NsSmartDeviceLinkRPC::Result>(c.resultCode); + if(!ResultMarshaller::fromJSON(j, result)) + return false; + c.resultCode = static_cast<NsSmartDeviceLinkRPCV2::Result>(result); + } + if(json.isMember("info")) + { + const Json::Value& j=json["info"]; + if(!j.isString()) return false; + c.info=new std::string(j.asString()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Speak_responseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Speak_responseMarshaller.h new file mode 100644 index 000000000..eba715e5f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/Speak_responseMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_SPEAK_RESPONSEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_SPEAK_RESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/Speak_response.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct Speak_responseMarshaller + { + static bool checkIntegrity(Speak_response& e); + static bool checkIntegrityConst(const Speak_response& e); + + static bool fromString(const std::string& s,Speak_response& e); + static const std::string toString(const Speak_response& e); + + static bool fromJSON(const Json::Value& s,Speak_response& e); + static Json::Value toJSON(const Speak_response& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SpeechCapabilitiesMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SpeechCapabilitiesMarshaller.cpp new file mode 100644 index 000000000..1ba2432a1 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SpeechCapabilitiesMarshaller.cpp @@ -0,0 +1,111 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/SpeechCapabilities.h" +#include "SpeechCapabilitiesMarshaller.h" +#include "SpeechCapabilitiesMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const SpeechCapabilities::SpeechCapabilitiesInternal SpeechCapabilitiesMarshaller::getIndex(const char* s) +{ + if(!s) + return SpeechCapabilities::INVALID_ENUM; + const struct PerfectHashTable* p=SpeechCapabilities_intHash::getPointer(s,strlen(s)); + return p ? static_cast<SpeechCapabilities::SpeechCapabilitiesInternal>(p->idx) : SpeechCapabilities::INVALID_ENUM; +} + + +bool SpeechCapabilitiesMarshaller::fromJSON(const Json::Value& s,SpeechCapabilities& e) +{ + e.mInternal=SpeechCapabilities::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=SpeechCapabilities::INVALID_ENUM); +} + + +Json::Value SpeechCapabilitiesMarshaller::toJSON(const SpeechCapabilities& e) +{ + if(e.mInternal==SpeechCapabilities::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool SpeechCapabilitiesMarshaller::fromString(const std::string& s,SpeechCapabilities& e) +{ + e.mInternal=SpeechCapabilities::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string SpeechCapabilitiesMarshaller::toString(const SpeechCapabilities& e) +{ + Json::FastWriter writer; + return e.mInternal==SpeechCapabilities::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable SpeechCapabilitiesMarshaller::mHashTable[5]= +{ + {"TEXT",0}, + {"SAPI_PHONEMES",1}, + {"LHPLUS_PHONEMES",2}, + {"PRE_RECORDED",3}, + {"SILENCE",4} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SpeechCapabilitiesMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SpeechCapabilitiesMarshaller.gp new file mode 100644 index 000000000..698dc17f5 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SpeechCapabilitiesMarshaller.gp @@ -0,0 +1,21 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name SpeechCapabilities_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +TEXT,0 +SAPI_PHONEMES,1 +LHPLUS_PHONEMES,2 +PRE_RECORDED,3 +SILENCE,4 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SpeechCapabilitiesMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SpeechCapabilitiesMarshaller.h new file mode 100644 index 000000000..cd40bc5fc --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SpeechCapabilitiesMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_SPEECHCAPABILITIESMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_SPEECHCAPABILITIESMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/SpeechCapabilities.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for SpeechCapabilities + + class SpeechCapabilitiesMarshaller + { + public: + + static std::string toName(const SpeechCapabilities& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(SpeechCapabilities& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=SpeechCapabilities::INVALID_ENUM; + } + + static bool checkIntegrity(SpeechCapabilities& e) { return e.mInternal!=SpeechCapabilities::INVALID_ENUM; } + static bool checkIntegrityConst(const SpeechCapabilities& e) { return e.mInternal!=SpeechCapabilities::INVALID_ENUM; } + + static bool fromString(const std::string& s,SpeechCapabilities& e); + static const std::string toString(const SpeechCapabilities& e); + + static bool fromJSON(const Json::Value& s,SpeechCapabilities& e); + static Json::Value toJSON(const SpeechCapabilities& e); + + static const char* getName(SpeechCapabilities::SpeechCapabilitiesInternal e) + { + return (e>=0 && e<5) ? mHashTable[e].name : NULL; + } + + static const SpeechCapabilities::SpeechCapabilitiesInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[5]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SpeechCapabilitiesMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SpeechCapabilitiesMarshaller.inc new file mode 100644 index 000000000..f58916b3e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SpeechCapabilitiesMarshaller.inc @@ -0,0 +1,70 @@ +/* Copyright (c) 2013 Ford Motor Company */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SpeechCapabilitiesMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SpeechCapabilitiesMarshaller.gp */ +/* Computed positions: -k'' */ + + +#define TOTAL_KEYWORDS 5 +#define MIN_WORD_LENGTH 4 +#define MAX_WORD_LENGTH 15 +#define MIN_HASH_VALUE 4 +#define MAX_HASH_VALUE 15 +/* maximum key range = 12, duplicates = 0 */ + +class SpeechCapabilities_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline /*ARGSUSED*/ +unsigned int +SpeechCapabilities_intHash::hash (register const char *str, register unsigned int len) +{ + return len; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +SpeechCapabilities_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 4, 0, 0, 7, 0, 0, 0, 0, 12, 13, + 0, 15 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SpeechCapabilitiesMarshaller.gp" + {"TEXT",0}, + {""}, {""}, +#line 21 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SpeechCapabilitiesMarshaller.gp" + {"SILENCE",4}, + {""}, {""}, {""}, {""}, +#line 20 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SpeechCapabilitiesMarshaller.gp" + {"PRE_RECORDED",3}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SpeechCapabilitiesMarshaller.gp" + {"SAPI_PHONEMES",1}, + {""}, +#line 19 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SpeechCapabilitiesMarshaller.gp" + {"LHPLUS_PHONEMES",2} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/StartTime.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/StartTime.cpp new file mode 100644 index 000000000..1e5a52af0 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/StartTime.cpp @@ -0,0 +1,108 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/StartTime.h" +#include "StartTimeMarshaller.h" + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + + + +using namespace NsSmartDeviceLinkRPC; + +StartTime::StartTime(const StartTime& c) +{ + *this=c; +} + + +bool StartTime::checkIntegrity(void) +{ + return StartTimeMarshaller::checkIntegrity(*this); +} + + +StartTime::StartTime(void) +{ +} + + + +bool StartTime::set_hours(unsigned int hours_) +{ + if(hours_>59) return false; + hours=hours_; + return true; +} + +bool StartTime::set_minutes(unsigned int minutes_) +{ + if(minutes_>59) return false; + minutes=minutes_; + return true; +} + +bool StartTime::set_seconds(unsigned int seconds_) +{ + if(seconds_>59) return false; + seconds=seconds_; + return true; +} + + + + +unsigned int StartTime::get_hours(void) const +{ + return hours; +} + + +unsigned int StartTime::get_minutes(void) const +{ + return minutes; +} + + +unsigned int StartTime::get_seconds(void) const +{ + return seconds; +} + + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/StartTimeMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/StartTimeMarshaller.cpp new file mode 100644 index 000000000..1c97f5b52 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/StartTimeMarshaller.cpp @@ -0,0 +1,138 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/StartTime.h" + + +#include "StartTimeMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool StartTimeMarshaller::checkIntegrity(StartTime& s) +{ + return checkIntegrityConst(s); +} + + +bool StartTimeMarshaller::fromString(const std::string& s,StartTime& 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 StartTimeMarshaller::toString(const StartTime& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool StartTimeMarshaller::checkIntegrityConst(const StartTime& s) +{ + if(s.hours>59) return false; + if(s.minutes>59) return false; + if(s.seconds>59) return false; + return true; +} + +Json::Value StartTimeMarshaller::toJSON(const StartTime& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["hours"]=Json::Value(e.hours); + + json["minutes"]=Json::Value(e.minutes); + + json["seconds"]=Json::Value(e.seconds); + + + return json; +} + + +bool StartTimeMarshaller::fromJSON(const Json::Value& json,StartTime& c) +{ + try + { + if(!json.isObject()) return false; + + if(!json.isMember("hours")) return false; + { + const Json::Value& j=json["hours"]; + if(!j.isInt()) return false; + c.hours=j.asInt(); + } + if(!json.isMember("minutes")) return false; + { + const Json::Value& j=json["minutes"]; + if(!j.isInt()) return false; + c.minutes=j.asInt(); + } + if(!json.isMember("seconds")) return false; + { + const Json::Value& j=json["seconds"]; + if(!j.isInt()) return false; + c.seconds=j.asInt(); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/StartTimeMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/StartTimeMarshaller.h new file mode 100644 index 000000000..03e9a6832 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/StartTimeMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_STARTTIMEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_STARTTIMEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/StartTime.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct StartTimeMarshaller + { + static bool checkIntegrity(StartTime& e); + static bool checkIntegrityConst(const StartTime& e); + + static bool fromString(const std::string& s,StartTime& e); + static const std::string toString(const StartTime& e); + + static bool fromJSON(const Json::Value& s,StartTime& e); + static Json::Value toJSON(const StartTime& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SubscribeButton_request.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SubscribeButton_request.cpp new file mode 100644 index 000000000..b6cc3dc34 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SubscribeButton_request.cpp @@ -0,0 +1,89 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/SubscribeButton_request.h" +#include "SubscribeButton_requestMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "ButtonNameMarshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + +SubscribeButton_request::~SubscribeButton_request(void) +{ +} + + +SubscribeButton_request::SubscribeButton_request(const SubscribeButton_request& c) +{ + *this=c; +} + + +bool SubscribeButton_request::checkIntegrity(void) +{ + return SubscribeButton_requestMarshaller::checkIntegrity(*this); +} + + +SubscribeButton_request::SubscribeButton_request(void) : SDLRPCRequest(PROTOCOL_VERSION,Marshaller::METHOD_SUBSCRIBEBUTTON_REQUEST) +{ +} + + + +bool SubscribeButton_request::set_buttonName(const ButtonName& buttonName_) +{ + if(!ButtonNameMarshaller::checkIntegrityConst(buttonName_)) return false; + buttonName=buttonName_; + return true; +} + + + + +const ButtonName& SubscribeButton_request::get_buttonName(void) const +{ + return buttonName; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SubscribeButton_requestMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SubscribeButton_requestMarshaller.cpp new file mode 100644 index 000000000..f8ca51cee --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SubscribeButton_requestMarshaller.cpp @@ -0,0 +1,138 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/SubscribeButton_request.h" +#include "ButtonNameMarshaller.h" + +#include "SubscribeButton_requestMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool SubscribeButton_requestMarshaller::checkIntegrity(SubscribeButton_request& s) +{ + return checkIntegrityConst(s); +} + + +bool SubscribeButton_requestMarshaller::fromString(const std::string& s,SubscribeButton_request& 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 SubscribeButton_requestMarshaller::toString(const SubscribeButton_request& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SubscribeButton_requestMarshaller::checkIntegrityConst(const SubscribeButton_request& s) +{ + if(!ButtonNameMarshaller::checkIntegrityConst(s.buttonName)) return false; + return true; +} + +Json::Value SubscribeButton_requestMarshaller::toJSON(const SubscribeButton_request& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["request"]=Json::Value(Json::objectValue); + json["request"]["name"]=Json::Value("SubscribeButton"); + json["request"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["buttonName"]=ButtonNameMarshaller::toJSON(e.buttonName); + + json["request"]["parameters"]=j; + return json; +} + + +bool SubscribeButton_requestMarshaller::fromJSON(const Json::Value& js,SubscribeButton_request& c) +{ + try + { + if(!js.isObject()) return false; + + if(!js.isMember("request")) return false; + + if(!js["request"].isObject()) return false; + const Json::Value& j2=js["request"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("SubscribeButton")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("buttonName")) return false; + { + const Json::Value& j=json["buttonName"]; + if(!ButtonNameMarshaller::fromJSON(j,c.buttonName)) + return false; + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SubscribeButton_requestMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SubscribeButton_requestMarshaller.h new file mode 100644 index 000000000..b380b243f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SubscribeButton_requestMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_SUBSCRIBEBUTTON_REQUESTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_SUBSCRIBEBUTTON_REQUESTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/SubscribeButton_request.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct SubscribeButton_requestMarshaller + { + static bool checkIntegrity(SubscribeButton_request& e); + static bool checkIntegrityConst(const SubscribeButton_request& e); + + static bool fromString(const std::string& s,SubscribeButton_request& e); + static const std::string toString(const SubscribeButton_request& e); + + static bool fromJSON(const Json::Value& s,SubscribeButton_request& e); + static Json::Value toJSON(const SubscribeButton_request& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SubscribeButton_response.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SubscribeButton_response.cpp new file mode 100644 index 000000000..b88f16198 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SubscribeButton_response.cpp @@ -0,0 +1,76 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/SubscribeButton_response.h" +#include "SubscribeButton_responseMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +SubscribeButton_response& SubscribeButton_response::operator =(const SubscribeButton_response& c) +{ + success = c.success; + resultCode = c.resultCode; + info = c.info ? new std::string(c.info[0]) : 0; + + return *this; +} + +SubscribeButton_response::~SubscribeButton_response(void) +{} + +SubscribeButton_response::SubscribeButton_response(const SubscribeButton_response& c) +{ + *this = c; +} + +bool SubscribeButton_response::checkIntegrity(void) +{ + return SubscribeButton_responseMarshaller::checkIntegrity(*this); +} + +SubscribeButton_response::SubscribeButton_response(void) + : SDLRPCResponse(PROTOCOL_VERSION, Marshaller::METHOD_SUBSCRIBEBUTTON_RESPONSE) +{} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SubscribeButton_responseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SubscribeButton_responseMarshaller.cpp new file mode 100644 index 000000000..017dd93b0 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SubscribeButton_responseMarshaller.cpp @@ -0,0 +1,161 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/SubscribeButton_response.h" +#include "ResultMarshaller.h" + +#include "SubscribeButton_responseMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool SubscribeButton_responseMarshaller::checkIntegrity(SubscribeButton_response& s) +{ + return checkIntegrityConst(s); +} + + +bool SubscribeButton_responseMarshaller::fromString(const std::string& s,SubscribeButton_response& 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 SubscribeButton_responseMarshaller::toString(const SubscribeButton_response& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SubscribeButton_responseMarshaller::checkIntegrityConst(const SubscribeButton_response& s) +{ + if(!ResultMarshaller::checkIntegrityConst(static_cast<NsSmartDeviceLinkRPCV2::Result>(s.resultCode))) return false; + if(s.info && s.info->length()>1000) return false; + return true; +} + +Json::Value SubscribeButton_responseMarshaller::toJSON(const SubscribeButton_response& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["response"]=Json::Value(Json::objectValue); + json["response"]["name"]=Json::Value("SubscribeButton"); + json["response"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["success"]=Json::Value(e.success); + + j["resultCode"]=ResultMarshaller::toJSON(static_cast<NsSmartDeviceLinkRPCV2::Result>(e.resultCode)); + + if(e.info) + j["info"]=Json::Value(*e.info); + + json["response"]["parameters"]=j; + return json; +} + + +bool SubscribeButton_responseMarshaller::fromJSON(const Json::Value& js,SubscribeButton_response& c) +{ + if(c.info) delete c.info; + c.info=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("response")) return false; + + if(!js["response"].isObject()) return false; + const Json::Value& j2=js["response"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("SubscribeButton")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("success")) return false; + { + const Json::Value& j=json["success"]; + if(!j.isBool()) return false; + c.success=j.asBool(); + } + if(!json.isMember("resultCode")) return false; + { + const Json::Value& j=json["resultCode"]; + NsSmartDeviceLinkRPC::Result result = static_cast<NsSmartDeviceLinkRPC::Result>(c.resultCode); + if(!ResultMarshaller::fromJSON(j, result)) + return false; + c.resultCode = static_cast<NsSmartDeviceLinkRPCV2::Result>(result); + } + if(json.isMember("info")) + { + const Json::Value& j=json["info"]; + if(!j.isString()) return false; + c.info=new std::string(j.asString()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SubscribeButton_responseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SubscribeButton_responseMarshaller.h new file mode 100644 index 000000000..102b9c6f4 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SubscribeButton_responseMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_SUBSCRIBEBUTTON_RESPONSEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_SUBSCRIBEBUTTON_RESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/SubscribeButton_response.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct SubscribeButton_responseMarshaller + { + static bool checkIntegrity(SubscribeButton_response& e); + static bool checkIntegrityConst(const SubscribeButton_response& e); + + static bool fromString(const std::string& s,SubscribeButton_response& e); + static const std::string toString(const SubscribeButton_response& e); + + static bool fromJSON(const Json::Value& s,SubscribeButton_response& e); + static Json::Value toJSON(const SubscribeButton_response& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SyncMsgVersion.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SyncMsgVersion.cpp new file mode 100644 index 000000000..cffc86e31 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SyncMsgVersion.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 "../include/JSONHandler/SDLRPCObjects/V1/SyncMsgVersion.h" +#include "SyncMsgVersionMarshaller.h" + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + + + +using namespace NsSmartDeviceLinkRPC; + +SyncMsgVersion::SyncMsgVersion(const SyncMsgVersion& c) +{ + *this=c; +} + + +bool SyncMsgVersion::checkIntegrity(void) +{ + return SyncMsgVersionMarshaller::checkIntegrity(*this); +} + + +SyncMsgVersion::SyncMsgVersion(void) +{ +} + + + +bool SyncMsgVersion::set_majorVersion(unsigned int majorVersion_) +{ + if(majorVersion_>1) return false; + if(majorVersion_<1) return false; + majorVersion=majorVersion_; + return true; +} + +bool SyncMsgVersion::set_minorVersion(unsigned int minorVersion_) +{ + if(minorVersion_>1000) return false; + minorVersion=minorVersion_; + return true; +} + + + + +unsigned int SyncMsgVersion::get_majorVersion(void) const +{ + return majorVersion; +} + + +unsigned int SyncMsgVersion::get_minorVersion(void) const +{ + return minorVersion; +} + + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SyncMsgVersionMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SyncMsgVersionMarshaller.cpp new file mode 100644 index 000000000..a76cdfbad --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SyncMsgVersionMarshaller.cpp @@ -0,0 +1,130 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/SyncMsgVersion.h" + + +#include "SyncMsgVersionMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool SyncMsgVersionMarshaller::checkIntegrity(SyncMsgVersion& s) +{ + return checkIntegrityConst(s); +} + + +bool SyncMsgVersionMarshaller::fromString(const std::string& s,SyncMsgVersion& 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 SyncMsgVersionMarshaller::toString(const SyncMsgVersion& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool SyncMsgVersionMarshaller::checkIntegrityConst(const SyncMsgVersion& s) +{ + if(s.majorVersion>1) return false; + if(s.majorVersion<1) return false; + if(s.minorVersion>1000) return false; + return true; +} + +Json::Value SyncMsgVersionMarshaller::toJSON(const SyncMsgVersion& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["majorVersion"]=Json::Value(e.majorVersion); + + json["minorVersion"]=Json::Value(e.minorVersion); + + + return json; +} + + +bool SyncMsgVersionMarshaller::fromJSON(const Json::Value& json,SyncMsgVersion& c) +{ + try + { + if(!json.isObject()) return false; + + if(!json.isMember("majorVersion")) return false; + { + const Json::Value& j=json["majorVersion"]; + if(!j.isInt()) return false; + c.majorVersion=j.asInt(); + } + if(!json.isMember("minorVersion")) return false; + { + const Json::Value& j=json["minorVersion"]; + if(!j.isInt()) return false; + c.minorVersion=j.asInt(); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SyncMsgVersionMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SyncMsgVersionMarshaller.h new file mode 100644 index 000000000..c681bf2c1 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SyncMsgVersionMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_SYNCMSGVERSIONMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_SYNCMSGVERSIONMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/SyncMsgVersion.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct SyncMsgVersionMarshaller + { + static bool checkIntegrity(SyncMsgVersion& e); + static bool checkIntegrityConst(const SyncMsgVersion& e); + + static bool fromString(const std::string& s,SyncMsgVersion& e); + static const std::string toString(const SyncMsgVersion& e); + + static bool fromJSON(const Json::Value& s,SyncMsgVersion& e); + static Json::Value toJSON(const SyncMsgVersion& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SystemContextMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SystemContextMarshaller.cpp new file mode 100644 index 000000000..77ba41464 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SystemContextMarshaller.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 <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/SystemContext.h" +#include "SystemContextMarshaller.h" +#include "SystemContextMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const SystemContext::SystemContextInternal SystemContextMarshaller::getIndex(const char* s) +{ + if(!s) + return SystemContext::INVALID_ENUM; + const struct PerfectHashTable* p=SystemContext_intHash::getPointer(s,strlen(s)); + return p ? static_cast<SystemContext::SystemContextInternal>(p->idx) : SystemContext::INVALID_ENUM; +} + + +bool SystemContextMarshaller::fromJSON(const Json::Value& s,SystemContext& e) +{ + e.mInternal=SystemContext::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=SystemContext::INVALID_ENUM); +} + + +Json::Value SystemContextMarshaller::toJSON(const SystemContext& e) +{ + if(e.mInternal==SystemContext::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool SystemContextMarshaller::fromString(const std::string& s,SystemContext& e) +{ + e.mInternal=SystemContext::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string SystemContextMarshaller::toString(const SystemContext& e) +{ + Json::FastWriter writer; + return e.mInternal==SystemContext::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable SystemContextMarshaller::mHashTable[3]= +{ + {"MAIN",0}, + {"VRSESSION",1}, + {"MENU",2} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SystemContextMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SystemContextMarshaller.gp new file mode 100644 index 000000000..cb2be4d05 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SystemContextMarshaller.gp @@ -0,0 +1,19 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name SystemContext_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +MAIN,0 +VRSESSION,1 +MENU,2 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SystemContextMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SystemContextMarshaller.h new file mode 100644 index 000000000..f5b876cb0 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SystemContextMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_SYSTEMCONTEXTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_SYSTEMCONTEXTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/SystemContext.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for SystemContext + + class SystemContextMarshaller + { + public: + + static std::string toName(const SystemContext& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(SystemContext& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=SystemContext::INVALID_ENUM; + } + + static bool checkIntegrity(SystemContext& e) { return e.mInternal!=SystemContext::INVALID_ENUM; } + static bool checkIntegrityConst(const SystemContext& e) { return e.mInternal!=SystemContext::INVALID_ENUM; } + + static bool fromString(const std::string& s,SystemContext& e); + static const std::string toString(const SystemContext& e); + + static bool fromJSON(const Json::Value& s,SystemContext& e); + static Json::Value toJSON(const SystemContext& e); + + static const char* getName(SystemContext::SystemContextInternal e) + { + return (e>=0 && e<3) ? mHashTable[e].name : NULL; + } + + static const SystemContext::SystemContextInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[3]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SystemContextMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SystemContextMarshaller.inc new file mode 100644 index 000000000..ef72360c5 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SystemContextMarshaller.inc @@ -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. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SystemContextMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SystemContextMarshaller.gp */ +/* Computed positions: -k'2' */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." +#endif + + +#define TOTAL_KEYWORDS 3 +#define MIN_WORD_LENGTH 4 +#define MAX_WORD_LENGTH 9 +#define MIN_HASH_VALUE 4 +#define MAX_HASH_VALUE 9 +/* maximum key range = 6, duplicates = 0 */ + +class SystemContext_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline unsigned int +SystemContext_intHash::hash (register const char *str, register unsigned int len) +{ + static const unsigned char asso_values[] = + { + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10, 1,10,10,10, 0, + 10,10,10,10,10,10,10,10,10,10, + 10,10, 0,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10 + }; + return len + asso_values[(unsigned char)str[1]]; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +SystemContext_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 4, 4, 0, 0, 0, 9 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, +#line 19 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SystemContextMarshaller.gp" + {"MENU",2}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SystemContextMarshaller.gp" + {"MAIN",0}, + {""}, {""}, {""}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/SystemContextMarshaller.gp" + {"VRSESSION",1} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TBTStateMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TBTStateMarshaller.cpp new file mode 100644 index 000000000..dacf604fd --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TBTStateMarshaller.cpp @@ -0,0 +1,110 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/TBTState.h" +#include "TBTStateMarshaller.h" +#include "TBTStateMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const TBTState::TBTStateInternal TBTStateMarshaller::getIndex(const char* s) +{ + if(!s) + return TBTState::INVALID_ENUM; + const struct PerfectHashTable* p=TBTState_intHash::getPointer(s,strlen(s)); + return p ? static_cast<TBTState::TBTStateInternal>(p->idx) : TBTState::INVALID_ENUM; +} + + +bool TBTStateMarshaller::fromJSON(const Json::Value& s,TBTState& e) +{ + e.mInternal=TBTState::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=TBTState::INVALID_ENUM); +} + + +Json::Value TBTStateMarshaller::toJSON(const TBTState& e) +{ + if(e.mInternal==TBTState::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool TBTStateMarshaller::fromString(const std::string& s,TBTState& e) +{ + e.mInternal=TBTState::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string TBTStateMarshaller::toString(const TBTState& e) +{ + Json::FastWriter writer; + return e.mInternal==TBTState::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable TBTStateMarshaller::mHashTable[4]= +{ + {"ROUTE_UPDATE_REQUEST",0}, + {"ROUTE_ACCEPTED",1}, + {"ROUTE_REFUSED",2}, + {"ROUTE_CANCELLED",3} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TBTStateMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TBTStateMarshaller.gp new file mode 100644 index 000000000..ed99cb0b2 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TBTStateMarshaller.gp @@ -0,0 +1,20 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name TBTState_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +ROUTE_UPDATE_REQUEST,0 +ROUTE_ACCEPTED,1 +ROUTE_REFUSED,2 +ROUTE_CANCELLED,3 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TBTStateMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TBTStateMarshaller.h new file mode 100644 index 000000000..b4703eae7 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TBTStateMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_TBTSTATEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_TBTSTATEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/TBTState.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for TBTState + + class TBTStateMarshaller + { + public: + + static std::string toName(const TBTState& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(TBTState& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=TBTState::INVALID_ENUM; + } + + static bool checkIntegrity(TBTState& e) { return e.mInternal!=TBTState::INVALID_ENUM; } + static bool checkIntegrityConst(const TBTState& e) { return e.mInternal!=TBTState::INVALID_ENUM; } + + static bool fromString(const std::string& s,TBTState& e); + static const std::string toString(const TBTState& e); + + static bool fromJSON(const Json::Value& s,TBTState& e); + static Json::Value toJSON(const TBTState& e); + + static const char* getName(TBTState::TBTStateInternal e) + { + return (e>=0 && e<4) ? mHashTable[e].name : NULL; + } + + static const TBTState::TBTStateInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[4]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TBTStateMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TBTStateMarshaller.inc new file mode 100644 index 000000000..7d5db48d6 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TBTStateMarshaller.inc @@ -0,0 +1,100 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TBTStateMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TBTStateMarshaller.gp */ +/* Computed positions: -k'' */ + + +#define TOTAL_KEYWORDS 4 +#define MIN_WORD_LENGTH 13 +#define MAX_WORD_LENGTH 20 +#define MIN_HASH_VALUE 13 +#define MAX_HASH_VALUE 20 +/* maximum key range = 8, duplicates = 0 */ + +namespace NsSmartDeviceLinkRPC { + +class TBTState_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline /*ARGSUSED*/ +unsigned int +TBTState_intHash::hash (register const char *str, register unsigned int len) +{ + return len; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +TBTState_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, + 14, 15, 0, 0, 0, 0, 20 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, +#line 19 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TBTStateMarshaller.gp" + {"ROUTE_REFUSED",2}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TBTStateMarshaller.gp" + {"ROUTE_ACCEPTED",1}, +#line 20 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TBTStateMarshaller.gp" + {"ROUTE_CANCELLED",3}, + {""}, {""}, {""}, {""}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TBTStateMarshaller.gp" + {"ROUTE_UPDATE_REQUEST",0} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TTSChunk.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TTSChunk.cpp new file mode 100644 index 000000000..caaa3c7d5 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TTSChunk.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/SDLRPCObjects/V1/TTSChunk.h" +#include "TTSChunkMarshaller.h" +#include "SpeechCapabilitiesMarshaller.h" +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + + + +using namespace NsSmartDeviceLinkRPC; + +TTSChunk::TTSChunk(const TTSChunk& c) +{ + *this=c; +} + + +bool TTSChunk::checkIntegrity(void) +{ + return TTSChunkMarshaller::checkIntegrity(*this); +} + + +TTSChunk::TTSChunk(void) +{ +} + + + +bool TTSChunk::set_text(const std::string& text_) +{ + if(text_.length()>500) return false; + text=text_; + return true; +} + +bool TTSChunk::set_type(const SpeechCapabilities& type_) +{ + if(!SpeechCapabilitiesMarshaller::checkIntegrityConst(type_)) return false; + type=type_; + return true; +} + + + + +const std::string& TTSChunk::get_text(void) const +{ + return text; +} + + +const SpeechCapabilities& TTSChunk::get_type(void) const +{ + return type; +} + + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TTSChunkMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TTSChunkMarshaller.cpp new file mode 100644 index 000000000..e11e7716b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TTSChunkMarshaller.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/SDLRPCObjects/V1/TTSChunk.h" +#include "SpeechCapabilitiesMarshaller.h" + +#include "TTSChunkMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool TTSChunkMarshaller::checkIntegrity(TTSChunk& s) +{ + return checkIntegrityConst(s); +} + + +bool TTSChunkMarshaller::fromString(const std::string& s,TTSChunk& 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 TTSChunkMarshaller::toString(const TTSChunk& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool TTSChunkMarshaller::checkIntegrityConst(const TTSChunk& s) +{ + if(s.text.length()>500) return false; + if(!SpeechCapabilitiesMarshaller::checkIntegrityConst(s.type)) return false; + return true; +} + +Json::Value TTSChunkMarshaller::toJSON(const TTSChunk& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["text"]=Json::Value(e.text); + + json["type"]=SpeechCapabilitiesMarshaller::toJSON(e.type); + + + return json; +} + + +bool TTSChunkMarshaller::fromJSON(const Json::Value& json,TTSChunk& c) +{ + try + { + if(!json.isObject()) return false; + + if(!json.isMember("text")) return false; + { + const Json::Value& j=json["text"]; + if(!j.isString()) return false; + c.text=j.asString(); + } + if(!json.isMember("type")) return false; + { + const Json::Value& j=json["type"]; + if(!SpeechCapabilitiesMarshaller::fromJSON(j,c.type)) + return false; + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TTSChunkMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TTSChunkMarshaller.h new file mode 100644 index 000000000..f1f7e5ea2 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TTSChunkMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_TTSCHUNKMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_TTSCHUNKMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/TTSChunk.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct TTSChunkMarshaller + { + static bool checkIntegrity(TTSChunk& e); + static bool checkIntegrityConst(const TTSChunk& e); + + static bool fromString(const std::string& s,TTSChunk& e); + static const std::string toString(const TTSChunk& e); + + static bool fromJSON(const Json::Value& s,TTSChunk& e); + static Json::Value toJSON(const TTSChunk& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextAlignmentMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextAlignmentMarshaller.cpp new file mode 100644 index 000000000..05ce153f1 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextAlignmentMarshaller.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 <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/TextAlignment.h" +#include "TextAlignmentMarshaller.h" +#include "TextAlignmentMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const TextAlignment::TextAlignmentInternal TextAlignmentMarshaller::getIndex(const char* s) +{ + if(!s) + return TextAlignment::INVALID_ENUM; + const struct PerfectHashTable* p=TextAlignment_intHash::getPointer(s,strlen(s)); + return p ? static_cast<TextAlignment::TextAlignmentInternal>(p->idx) : TextAlignment::INVALID_ENUM; +} + + +bool TextAlignmentMarshaller::fromJSON(const Json::Value& s,TextAlignment& e) +{ + e.mInternal=TextAlignment::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=TextAlignment::INVALID_ENUM); +} + + +Json::Value TextAlignmentMarshaller::toJSON(const TextAlignment& e) +{ + if(e.mInternal==TextAlignment::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool TextAlignmentMarshaller::fromString(const std::string& s,TextAlignment& e) +{ + e.mInternal=TextAlignment::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string TextAlignmentMarshaller::toString(const TextAlignment& e) +{ + Json::FastWriter writer; + return e.mInternal==TextAlignment::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable TextAlignmentMarshaller::mHashTable[3]= +{ + {"LEFT_ALIGNED",0}, + {"RIGHT_ALIGNED",1}, + {"CENTERED",2} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextAlignmentMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextAlignmentMarshaller.gp new file mode 100644 index 000000000..77f3f9eb1 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextAlignmentMarshaller.gp @@ -0,0 +1,19 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name TextAlignment_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +LEFT_ALIGNED,0 +RIGHT_ALIGNED,1 +CENTERED,2 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextAlignmentMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextAlignmentMarshaller.h new file mode 100644 index 000000000..d2fe2292d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextAlignmentMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_TEXTALIGNMENTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_TEXTALIGNMENTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/TextAlignment.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for TextAlignment + + class TextAlignmentMarshaller + { + public: + + static std::string toName(const TextAlignment& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(TextAlignment& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=TextAlignment::INVALID_ENUM; + } + + static bool checkIntegrity(TextAlignment& e) { return e.mInternal!=TextAlignment::INVALID_ENUM; } + static bool checkIntegrityConst(const TextAlignment& e) { return e.mInternal!=TextAlignment::INVALID_ENUM; } + + static bool fromString(const std::string& s,TextAlignment& e); + static const std::string toString(const TextAlignment& e); + + static bool fromJSON(const Json::Value& s,TextAlignment& e); + static Json::Value toJSON(const TextAlignment& e); + + static const char* getName(TextAlignment::TextAlignmentInternal e) + { + return (e>=0 && e<3) ? mHashTable[e].name : NULL; + } + + static const TextAlignment::TextAlignmentInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[3]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextAlignmentMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextAlignmentMarshaller.inc new file mode 100644 index 000000000..cbcf7fa11 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextAlignmentMarshaller.inc @@ -0,0 +1,93 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextAlignmentMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextAlignmentMarshaller.gp */ +/* Computed positions: -k'' */ + + +#define TOTAL_KEYWORDS 3 +#define MIN_WORD_LENGTH 8 +#define MAX_WORD_LENGTH 13 +#define MIN_HASH_VALUE 8 +#define MAX_HASH_VALUE 13 +/* maximum key range = 6, duplicates = 0 */ + +class TextAlignment_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline /*ARGSUSED*/ +unsigned int +TextAlignment_intHash::hash (register const char *str, register unsigned int len) +{ + return len; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +TextAlignment_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 12, 13 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 19 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextAlignmentMarshaller.gp" + {"CENTERED",2}, + {""}, {""}, {""}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextAlignmentMarshaller.gp" + {"LEFT_ALIGNED",0}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextAlignmentMarshaller.gp" + {"RIGHT_ALIGNED",1} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextField.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextField.cpp new file mode 100644 index 000000000..6ddf20c4f --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextField.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 "../include/JSONHandler/SDLRPCObjects/V1/TextField.h" +#include "TextFieldMarshaller.h" +#include "CharacterSetMarshaller.h" +#include "TextFieldNameMarshaller.h" +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + + + +using namespace NsSmartDeviceLinkRPC; + +TextField::TextField(const TextField& c) +{ + *this=c; +} + + +bool TextField::checkIntegrity(void) +{ + return TextFieldMarshaller::checkIntegrity(*this); +} + + +TextField::TextField(void) +{ +} + + + +bool TextField::set_characterSet(const CharacterSet& characterSet_) +{ + if(!CharacterSetMarshaller::checkIntegrityConst(characterSet_)) return false; + characterSet=characterSet_; + return true; +} + +bool TextField::set_name(const TextFieldName& name_) +{ + if(!TextFieldNameMarshaller::checkIntegrityConst(name_)) return false; + name=name_; + return true; +} + +bool TextField::set_rows(unsigned int rows_) +{ + if(rows_>3) return false; + if(rows_<1) return false; + rows=rows_; + return true; +} + +bool TextField::set_width(unsigned int width_) +{ + if(width_>40) return false; + if(width_<1) return false; + width=width_; + return true; +} + + + + +const CharacterSet& TextField::get_characterSet(void) const +{ + return characterSet; +} + + +const TextFieldName& TextField::get_name(void) const +{ + return name; +} + + +unsigned int TextField::get_rows(void) const +{ + return rows; +} + + +unsigned int TextField::get_width(void) const +{ + return width; +} + + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldMarshaller.cpp new file mode 100644 index 000000000..a643250cb --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldMarshaller.cpp @@ -0,0 +1,150 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/TextField.h" +#include "CharacterSetMarshaller.h" +#include "TextFieldNameMarshaller.h" + +#include "TextFieldMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool TextFieldMarshaller::checkIntegrity(TextField& s) +{ + return checkIntegrityConst(s); +} + + +bool TextFieldMarshaller::fromString(const std::string& s,TextField& 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 TextFieldMarshaller::toString(const TextField& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool TextFieldMarshaller::checkIntegrityConst(const TextField& s) +{ + if(!CharacterSetMarshaller::checkIntegrityConst(s.characterSet)) return false; + if(!TextFieldNameMarshaller::checkIntegrityConst(s.name)) return false; + if(s.rows>3) return false; + if(s.rows<1) return false; + if(s.width>40) return false; + if(s.width<1) return false; + return true; +} + +Json::Value TextFieldMarshaller::toJSON(const TextField& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["characterSet"]=CharacterSetMarshaller::toJSON(e.characterSet); + + json["name"]=TextFieldNameMarshaller::toJSON(e.name); + + json["rows"]=Json::Value(e.rows); + + json["width"]=Json::Value(e.width); + + + return json; +} + + +bool TextFieldMarshaller::fromJSON(const Json::Value& json,TextField& c) +{ + try + { + if(!json.isObject()) return false; + + if(!json.isMember("characterSet")) return false; + { + const Json::Value& j=json["characterSet"]; + if(!CharacterSetMarshaller::fromJSON(j,c.characterSet)) + return false; + } + if(!json.isMember("name")) return false; + { + const Json::Value& j=json["name"]; + if(!TextFieldNameMarshaller::fromJSON(j,c.name)) + return false; + } + if(!json.isMember("rows")) return false; + { + const Json::Value& j=json["rows"]; + if(!j.isInt()) return false; + c.rows=j.asInt(); + } + if(!json.isMember("width")) return false; + { + const Json::Value& j=json["width"]; + if(!j.isInt()) return false; + c.width=j.asInt(); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldMarshaller.h new file mode 100644 index 000000000..7631d6eb4 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_TEXTFIELDMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_TEXTFIELDMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/TextField.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct TextFieldMarshaller + { + static bool checkIntegrity(TextField& e); + static bool checkIntegrityConst(const TextField& e); + + static bool fromString(const std::string& s,TextField& e); + static const std::string toString(const TextField& e); + + static bool fromJSON(const Json::Value& s,TextField& e); + static Json::Value toJSON(const TextField& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.cpp new file mode 100644 index 000000000..1494eee2b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.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 <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/TextFieldName.h" +#include "TextFieldNameMarshaller.h" +#include "TextFieldNameMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const TextFieldName::TextFieldNameInternal TextFieldNameMarshaller::getIndex(const char* s) +{ + if(!s) + return TextFieldName::INVALID_ENUM; + const struct PerfectHashTable* p=TextFieldName_intHash::getPointer(s,strlen(s)); + return p ? static_cast<TextFieldName::TextFieldNameInternal>(p->idx) : TextFieldName::INVALID_ENUM; +} + + +bool TextFieldNameMarshaller::fromJSON(const Json::Value& s,TextFieldName& e) +{ + e.mInternal=TextFieldName::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=TextFieldName::INVALID_ENUM); +} + + +Json::Value TextFieldNameMarshaller::toJSON(const TextFieldName& e) +{ + if(e.mInternal==TextFieldName::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool TextFieldNameMarshaller::fromString(const std::string& s,TextFieldName& e) +{ + e.mInternal=TextFieldName::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string TextFieldNameMarshaller::toString(const TextFieldName& e) +{ + Json::FastWriter writer; + return e.mInternal==TextFieldName::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable TextFieldNameMarshaller::mHashTable[7]= +{ + {"mainField1",0}, + {"mainField2",1}, + {"statusBar",2}, + {"mediaClock",3}, + {"mediaTrack",4}, + {"alertText1",5}, + {"alertText2",6} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.gp new file mode 100644 index 000000000..001026e5e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.gp @@ -0,0 +1,23 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name TextFieldName_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +mainField1,0 +mainField2,1 +statusBar,2 +mediaClock,3 +mediaTrack,4 +alertText1,5 +alertText2,6 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.h new file mode 100644 index 000000000..37b070a9c --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_TEXTFIELDNAMEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_TEXTFIELDNAMEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/TextFieldName.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for TextFieldName + + class TextFieldNameMarshaller + { + public: + + static std::string toName(const TextFieldName& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(TextFieldName& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=TextFieldName::INVALID_ENUM; + } + + static bool checkIntegrity(TextFieldName& e) { return e.mInternal!=TextFieldName::INVALID_ENUM; } + static bool checkIntegrityConst(const TextFieldName& e) { return e.mInternal!=TextFieldName::INVALID_ENUM; } + + static bool fromString(const std::string& s,TextFieldName& e); + static const std::string toString(const TextFieldName& e); + + static bool fromJSON(const Json::Value& s,TextFieldName& e); + static Json::Value toJSON(const TextFieldName& e); + + static const char* getName(TextFieldName::TextFieldNameInternal e) + { + return (e>=0 && e<7) ? mHashTable[e].name : NULL; + } + + static const TextFieldName::TextFieldNameInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[7]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.inc new file mode 100644 index 000000000..5512b621d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.inc @@ -0,0 +1,172 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.gp */ +/* Computed positions: -k'8,10' */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." +#endif + + +#define TOTAL_KEYWORDS 7 +#define MIN_WORD_LENGTH 9 +#define MAX_WORD_LENGTH 10 +#define MIN_HASH_VALUE 9 +#define MAX_HASH_VALUE 19 +/* maximum key range = 11, duplicates = 0 */ + +class TextFieldName_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline unsigned int +TextFieldName_intHash::hash (register const char *str, register unsigned int len) +{ + static const unsigned char asso_values[] = + { + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 2, + 0, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 0, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 4, 5, 20, + 20, 5, 20, 20, 20, 20, 20, 20, 20, 20, + 0, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20 + }; + register int hval = len; + + switch (hval) + { + default: + hval += asso_values[(unsigned char)str[9]]; + /*FALLTHROUGH*/ + case 9: + case 8: + hval += asso_values[(unsigned char)str[7]]; + break; + } + return hval; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +TextFieldName_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 10, 0, 10, 0, + 10, 10, 0, 10, 0, 10 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 19 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.gp" + {"statusBar",2}, +#line 23 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.gp" + {"alertText2",6}, + {""}, +#line 22 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.gp" + {"alertText1",5}, + {""}, +#line 21 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.gp" + {"mediaTrack",4}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.gp" + {"mainField2",1}, + {""}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.gp" + {"mainField1",0}, + {""}, +#line 20 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TextFieldNameMarshaller.gp" + {"mediaClock",3} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TriggerSourceMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TriggerSourceMarshaller.cpp new file mode 100644 index 000000000..475f62be4 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TriggerSourceMarshaller.cpp @@ -0,0 +1,108 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/TriggerSource.h" +#include "TriggerSourceMarshaller.h" +#include "TriggerSourceMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const TriggerSource::TriggerSourceInternal TriggerSourceMarshaller::getIndex(const char* s) +{ + if(!s) + return TriggerSource::INVALID_ENUM; + const struct PerfectHashTable* p=TriggerSource_intHash::getPointer(s,strlen(s)); + return p ? static_cast<TriggerSource::TriggerSourceInternal>(p->idx) : TriggerSource::INVALID_ENUM; +} + + +bool TriggerSourceMarshaller::fromJSON(const Json::Value& s,TriggerSource& e) +{ + e.mInternal=TriggerSource::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=TriggerSource::INVALID_ENUM); +} + + +Json::Value TriggerSourceMarshaller::toJSON(const TriggerSource& e) +{ + if(e.mInternal==TriggerSource::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool TriggerSourceMarshaller::fromString(const std::string& s,TriggerSource& e) +{ + e.mInternal=TriggerSource::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string TriggerSourceMarshaller::toString(const TriggerSource& e) +{ + Json::FastWriter writer; + return e.mInternal==TriggerSource::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable TriggerSourceMarshaller::mHashTable[2]= +{ + {"MENU",0}, + {"VR",1} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TriggerSourceMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TriggerSourceMarshaller.gp new file mode 100644 index 000000000..b0dc33dd6 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TriggerSourceMarshaller.gp @@ -0,0 +1,18 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name TriggerSource_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +MENU,0 +VR,1 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TriggerSourceMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TriggerSourceMarshaller.h new file mode 100644 index 000000000..3ea49c31b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TriggerSourceMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_TRIGGERSOURCEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_TRIGGERSOURCEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/TriggerSource.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for TriggerSource + + class TriggerSourceMarshaller + { + public: + + static std::string toName(const TriggerSource& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(TriggerSource& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=TriggerSource::INVALID_ENUM; + } + + static bool checkIntegrity(TriggerSource& e) { return e.mInternal!=TriggerSource::INVALID_ENUM; } + static bool checkIntegrityConst(const TriggerSource& e) { return e.mInternal!=TriggerSource::INVALID_ENUM; } + + static bool fromString(const std::string& s,TriggerSource& e); + static const std::string toString(const TriggerSource& e); + + static bool fromJSON(const Json::Value& s,TriggerSource& e); + static Json::Value toJSON(const TriggerSource& e); + + static const char* getName(TriggerSource::TriggerSourceInternal e) + { + return (e>=0 && e<2) ? mHashTable[e].name : NULL; + } + + static const TriggerSource::TriggerSourceInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[2]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TriggerSourceMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TriggerSourceMarshaller.inc new file mode 100644 index 000000000..8ae6d4f0e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TriggerSourceMarshaller.inc @@ -0,0 +1,91 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TriggerSourceMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TriggerSourceMarshaller.gp */ +/* Computed positions: -k'' */ + + +#define TOTAL_KEYWORDS 2 +#define MIN_WORD_LENGTH 2 +#define MAX_WORD_LENGTH 4 +#define MIN_HASH_VALUE 2 +#define MAX_HASH_VALUE 4 +/* maximum key range = 3, duplicates = 0 */ + +class TriggerSource_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline /*ARGSUSED*/ +unsigned int +TriggerSource_intHash::hash (register const char *str, register unsigned int len) +{ + return len; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +TriggerSource_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 2, 0, 4 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TriggerSourceMarshaller.gp" + {"VR",1}, + {""}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/TriggerSourceMarshaller.gp" + {"MENU",0} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnregisterAppInterface_request.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnregisterAppInterface_request.cpp new file mode 100644 index 000000000..7b09ec2ac --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnregisterAppInterface_request.cpp @@ -0,0 +1,76 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/UnregisterAppInterface_request.h" +#include "UnregisterAppInterface_requestMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + +UnregisterAppInterface_request::~UnregisterAppInterface_request(void) +{ +} + + +UnregisterAppInterface_request::UnregisterAppInterface_request(const UnregisterAppInterface_request& c) +{ + *this=c; +} + + +bool UnregisterAppInterface_request::checkIntegrity(void) +{ + return UnregisterAppInterface_requestMarshaller::checkIntegrity(*this); +} + + +UnregisterAppInterface_request::UnregisterAppInterface_request(void) : SDLRPCRequest(PROTOCOL_VERSION,Marshaller::METHOD_UNREGISTERAPPINTERFACE_REQUEST) +{ +} + + + + + + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnregisterAppInterface_requestMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnregisterAppInterface_requestMarshaller.cpp new file mode 100644 index 000000000..649d630b3 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnregisterAppInterface_requestMarshaller.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/SDLRPCObjects/V1/UnregisterAppInterface_request.h" + + +#include "UnregisterAppInterface_requestMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool UnregisterAppInterface_requestMarshaller::checkIntegrity(UnregisterAppInterface_request& s) +{ + return checkIntegrityConst(s); +} + + +bool UnregisterAppInterface_requestMarshaller::fromString(const std::string& s,UnregisterAppInterface_request& 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 UnregisterAppInterface_requestMarshaller::toString(const UnregisterAppInterface_request& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool UnregisterAppInterface_requestMarshaller::checkIntegrityConst(const UnregisterAppInterface_request& s) +{ + return true; +} + +Json::Value UnregisterAppInterface_requestMarshaller::toJSON(const UnregisterAppInterface_request& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["request"]=Json::Value(Json::objectValue); + json["request"]["name"]=Json::Value("UnregisterAppInterface"); + json["request"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + json["request"]["parameters"]=j; + return json; +} + + +bool UnregisterAppInterface_requestMarshaller::fromJSON(const Json::Value& js,UnregisterAppInterface_request& c) +{ + try + { + if(!js.isObject()) return false; + + if(!js.isMember("request")) return false; + + if(!js["request"].isObject()) return false; + const Json::Value& j2=js["request"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("UnregisterAppInterface")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnregisterAppInterface_requestMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnregisterAppInterface_requestMarshaller.h new file mode 100644 index 000000000..e0edad192 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnregisterAppInterface_requestMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_UNREGISTERAPPINTERFACE_REQUESTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_UNREGISTERAPPINTERFACE_REQUESTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/UnregisterAppInterface_request.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct UnregisterAppInterface_requestMarshaller + { + static bool checkIntegrity(UnregisterAppInterface_request& e); + static bool checkIntegrityConst(const UnregisterAppInterface_request& e); + + static bool fromString(const std::string& s,UnregisterAppInterface_request& e); + static const std::string toString(const UnregisterAppInterface_request& e); + + static bool fromJSON(const Json::Value& s,UnregisterAppInterface_request& e); + static Json::Value toJSON(const UnregisterAppInterface_request& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnregisterAppInterface_response.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnregisterAppInterface_response.cpp new file mode 100644 index 000000000..d9806e3c6 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnregisterAppInterface_response.cpp @@ -0,0 +1,76 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/UnregisterAppInterface_response.h" +#include "UnregisterAppInterface_responseMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +UnregisterAppInterface_response& UnregisterAppInterface_response::operator =(const UnregisterAppInterface_response& c) +{ + success = c.success; + resultCode = c.resultCode; + info = c.info ? new std::string(c.info[0]) : 0; + + return *this; +} + +UnregisterAppInterface_response::~UnregisterAppInterface_response(void) +{} + +UnregisterAppInterface_response::UnregisterAppInterface_response(const UnregisterAppInterface_response& c) +{ + *this = c; +} + +bool UnregisterAppInterface_response::checkIntegrity(void) +{ + return UnregisterAppInterface_responseMarshaller::checkIntegrity(*this); +} + +UnregisterAppInterface_response::UnregisterAppInterface_response(void) + : SDLRPCResponse(PROTOCOL_VERSION, Marshaller::METHOD_UNREGISTERAPPINTERFACE_RESPONSE) +{} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnregisterAppInterface_responseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnregisterAppInterface_responseMarshaller.cpp new file mode 100644 index 000000000..8232e9d76 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnregisterAppInterface_responseMarshaller.cpp @@ -0,0 +1,161 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/UnregisterAppInterface_response.h" +#include "ResultMarshaller.h" + +#include "UnregisterAppInterface_responseMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool UnregisterAppInterface_responseMarshaller::checkIntegrity(UnregisterAppInterface_response& s) +{ + return checkIntegrityConst(s); +} + + +bool UnregisterAppInterface_responseMarshaller::fromString(const std::string& s,UnregisterAppInterface_response& 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 UnregisterAppInterface_responseMarshaller::toString(const UnregisterAppInterface_response& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool UnregisterAppInterface_responseMarshaller::checkIntegrityConst(const UnregisterAppInterface_response& s) +{ + if(!ResultMarshaller::checkIntegrityConst(static_cast<NsSmartDeviceLinkRPCV2::Result>(s.resultCode))) return false; + if(s.info && s.info->length()>1000) return false; + return true; +} + +Json::Value UnregisterAppInterface_responseMarshaller::toJSON(const UnregisterAppInterface_response& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["response"]=Json::Value(Json::objectValue); + json["response"]["name"]=Json::Value("UnregisterAppInterface"); + json["response"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["success"]=Json::Value(e.success); + + j["resultCode"]=ResultMarshaller::toJSON(static_cast<NsSmartDeviceLinkRPCV2::Result>(e.resultCode)); + + if(e.info) + j["info"]=Json::Value(*e.info); + + json["response"]["parameters"]=j; + return json; +} + + +bool UnregisterAppInterface_responseMarshaller::fromJSON(const Json::Value& js,UnregisterAppInterface_response& c) +{ + if(c.info) delete c.info; + c.info=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("response")) return false; + + if(!js["response"].isObject()) return false; + const Json::Value& j2=js["response"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("UnregisterAppInterface")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("success")) return false; + { + const Json::Value& j=json["success"]; + if(!j.isBool()) return false; + c.success=j.asBool(); + } + if(!json.isMember("resultCode")) return false; + { + const Json::Value& j=json["resultCode"]; + NsSmartDeviceLinkRPC::Result result = static_cast<NsSmartDeviceLinkRPC::Result>(c.resultCode); + if(!ResultMarshaller::fromJSON(j, result)) + return false; + c.resultCode = static_cast<NsSmartDeviceLinkRPCV2::Result>(result); + } + if(json.isMember("info")) + { + const Json::Value& j=json["info"]; + if(!j.isString()) return false; + c.info=new std::string(j.asString()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnregisterAppInterface_responseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnregisterAppInterface_responseMarshaller.h new file mode 100644 index 000000000..794a2d4e0 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnregisterAppInterface_responseMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_UNREGISTERAPPINTERFACE_RESPONSEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_UNREGISTERAPPINTERFACE_RESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/UnregisterAppInterface_response.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct UnregisterAppInterface_responseMarshaller + { + static bool checkIntegrity(UnregisterAppInterface_response& e); + static bool checkIntegrityConst(const UnregisterAppInterface_response& e); + + static bool fromString(const std::string& s,UnregisterAppInterface_response& e); + static const std::string toString(const UnregisterAppInterface_response& e); + + static bool fromJSON(const Json::Value& s,UnregisterAppInterface_response& e); + static Json::Value toJSON(const UnregisterAppInterface_response& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnsubscribeButton_request.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnsubscribeButton_request.cpp new file mode 100644 index 000000000..93ca7a7e8 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnsubscribeButton_request.cpp @@ -0,0 +1,89 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/UnsubscribeButton_request.h" +#include "UnsubscribeButton_requestMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" +#include "ButtonNameMarshaller.h" + +#define PROTOCOL_VERSION 1 + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + +UnsubscribeButton_request::~UnsubscribeButton_request(void) +{ +} + + +UnsubscribeButton_request::UnsubscribeButton_request(const UnsubscribeButton_request& c) +{ + *this=c; +} + + +bool UnsubscribeButton_request::checkIntegrity(void) +{ + return UnsubscribeButton_requestMarshaller::checkIntegrity(*this); +} + + +UnsubscribeButton_request::UnsubscribeButton_request(void) : SDLRPCRequest(PROTOCOL_VERSION,Marshaller::METHOD_UNSUBSCRIBEBUTTON_REQUEST) +{ +} + + + +bool UnsubscribeButton_request::set_buttonName(const ButtonName& buttonName_) +{ + if(!ButtonNameMarshaller::checkIntegrityConst(buttonName_)) return false; + buttonName=buttonName_; + return true; +} + + + + +const ButtonName& UnsubscribeButton_request::get_buttonName(void) const +{ + return buttonName; +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnsubscribeButton_requestMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnsubscribeButton_requestMarshaller.cpp new file mode 100644 index 000000000..9b5145877 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnsubscribeButton_requestMarshaller.cpp @@ -0,0 +1,138 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/UnsubscribeButton_request.h" +#include "ButtonNameMarshaller.h" + +#include "UnsubscribeButton_requestMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool UnsubscribeButton_requestMarshaller::checkIntegrity(UnsubscribeButton_request& s) +{ + return checkIntegrityConst(s); +} + + +bool UnsubscribeButton_requestMarshaller::fromString(const std::string& s,UnsubscribeButton_request& 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 UnsubscribeButton_requestMarshaller::toString(const UnsubscribeButton_request& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool UnsubscribeButton_requestMarshaller::checkIntegrityConst(const UnsubscribeButton_request& s) +{ + if(!ButtonNameMarshaller::checkIntegrityConst(s.buttonName)) return false; + return true; +} + +Json::Value UnsubscribeButton_requestMarshaller::toJSON(const UnsubscribeButton_request& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["request"]=Json::Value(Json::objectValue); + json["request"]["name"]=Json::Value("UnsubscribeButton"); + json["request"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["buttonName"]=ButtonNameMarshaller::toJSON(e.buttonName); + + json["request"]["parameters"]=j; + return json; +} + + +bool UnsubscribeButton_requestMarshaller::fromJSON(const Json::Value& js,UnsubscribeButton_request& c) +{ + try + { + if(!js.isObject()) return false; + + if(!js.isMember("request")) return false; + + if(!js["request"].isObject()) return false; + const Json::Value& j2=js["request"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("UnsubscribeButton")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("buttonName")) return false; + { + const Json::Value& j=json["buttonName"]; + if(!ButtonNameMarshaller::fromJSON(j,c.buttonName)) + return false; + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnsubscribeButton_requestMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnsubscribeButton_requestMarshaller.h new file mode 100644 index 000000000..b79b9486e --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnsubscribeButton_requestMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_UNSUBSCRIBEBUTTON_REQUESTMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_UNSUBSCRIBEBUTTON_REQUESTMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/UnsubscribeButton_request.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct UnsubscribeButton_requestMarshaller + { + static bool checkIntegrity(UnsubscribeButton_request& e); + static bool checkIntegrityConst(const UnsubscribeButton_request& e); + + static bool fromString(const std::string& s,UnsubscribeButton_request& e); + static const std::string toString(const UnsubscribeButton_request& e); + + static bool fromJSON(const Json::Value& s,UnsubscribeButton_request& e); + static Json::Value toJSON(const UnsubscribeButton_request& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnsubscribeButton_response.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnsubscribeButton_response.cpp new file mode 100644 index 000000000..22d8b3553 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnsubscribeButton_response.cpp @@ -0,0 +1,76 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/UnsubscribeButton_response.h" +#include "UnsubscribeButton_responseMarshaller.h" +#include "../include/JSONHandler/SDLRPCObjects/V1/Marshaller.h" + +namespace +{ + const int PROTOCOL_VERSION = 1; +} + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; +UnsubscribeButton_response& UnsubscribeButton_response::operator =(const UnsubscribeButton_response& c) +{ + success = c.success; + resultCode = c.resultCode; + info = c.info ? new std::string(c.info[0]) : 0; + + return *this; +} + +UnsubscribeButton_response::~UnsubscribeButton_response(void) +{} + +UnsubscribeButton_response::UnsubscribeButton_response(const UnsubscribeButton_response& c) +{ + *this = c; +} + +bool UnsubscribeButton_response::checkIntegrity(void) +{ + return UnsubscribeButton_responseMarshaller::checkIntegrity(*this); +} + +UnsubscribeButton_response::UnsubscribeButton_response(void) + : SDLRPCResponse(PROTOCOL_VERSION, Marshaller::METHOD_UNSUBSCRIBEBUTTON_RESPONSE) +{} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnsubscribeButton_responseMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnsubscribeButton_responseMarshaller.cpp new file mode 100644 index 000000000..01bd77002 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnsubscribeButton_responseMarshaller.cpp @@ -0,0 +1,161 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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/SDLRPCObjects/V1/UnsubscribeButton_response.h" +#include "ResultMarshaller.h" + +#include "UnsubscribeButton_responseMarshaller.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +bool UnsubscribeButton_responseMarshaller::checkIntegrity(UnsubscribeButton_response& s) +{ + return checkIntegrityConst(s); +} + + +bool UnsubscribeButton_responseMarshaller::fromString(const std::string& s,UnsubscribeButton_response& 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 UnsubscribeButton_responseMarshaller::toString(const UnsubscribeButton_response& e) +{ + Json::FastWriter writer; + return checkIntegrityConst(e) ? writer.write(toJSON(e)) : ""; +} + + +bool UnsubscribeButton_responseMarshaller::checkIntegrityConst(const UnsubscribeButton_response& s) +{ + if(!ResultMarshaller::checkIntegrityConst(static_cast<NsSmartDeviceLinkRPCV2::Result>(s.resultCode))) return false; + if(s.info && s.info->length()>1000) return false; + return true; +} + +Json::Value UnsubscribeButton_responseMarshaller::toJSON(const UnsubscribeButton_response& e) +{ + Json::Value json(Json::objectValue); + if(!checkIntegrityConst(e)) + return Json::Value(Json::nullValue); + + json["response"]=Json::Value(Json::objectValue); + json["response"]["name"]=Json::Value("UnsubscribeButton"); + json["response"]["correlationID"]=Json::Value(e.getCorrelationID()); + + Json::Value j=Json::Value(Json::objectValue); + + j["success"]=Json::Value(e.success); + + j["resultCode"]=ResultMarshaller::toJSON(static_cast<NsSmartDeviceLinkRPCV2::Result>(e.resultCode)); + + if(e.info) + j["info"]=Json::Value(*e.info); + + json["response"]["parameters"]=j; + return json; +} + + +bool UnsubscribeButton_responseMarshaller::fromJSON(const Json::Value& js,UnsubscribeButton_response& c) +{ + if(c.info) delete c.info; + c.info=0; + + try + { + if(!js.isObject()) return false; + + if(!js.isMember("response")) return false; + + if(!js["response"].isObject()) return false; + const Json::Value& j2=js["response"]; + + if(!j2.isMember("name") || !j2["name"].isString() || j2["name"].asString().compare("UnsubscribeButton")) return false; + if(!j2.isMember("correlationID") || !j2["correlationID"].isInt()) return false; + c.setCorrelationID(j2["correlationID"].asInt()); + + if(!j2.isMember("parameters")) return false; + const Json::Value& json=j2["parameters"]; + if(!json.isObject()) return false; + if(!json.isMember("success")) return false; + { + const Json::Value& j=json["success"]; + if(!j.isBool()) return false; + c.success=j.asBool(); + } + if(!json.isMember("resultCode")) return false; + { + const Json::Value& j=json["resultCode"]; + NsSmartDeviceLinkRPC::Result result = static_cast<NsSmartDeviceLinkRPC::Result>(c.resultCode); + if(!ResultMarshaller::fromJSON(j, result)) + return false; + c.resultCode = static_cast<NsSmartDeviceLinkRPCV2::Result>(result); + } + if(json.isMember("info")) + { + const Json::Value& j=json["info"]; + if(!j.isString()) return false; + c.info=new std::string(j.asString()); + } + + } + catch(...) + { + return false; + } + return checkIntegrity(c); +} + diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnsubscribeButton_responseMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnsubscribeButton_responseMarshaller.h new file mode 100644 index 000000000..7d620850d --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UnsubscribeButton_responseMarshaller.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_UNSUBSCRIBEBUTTON_RESPONSEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_UNSUBSCRIBEBUTTON_RESPONSEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "../include/JSONHandler/SDLRPCObjects/V1/UnsubscribeButton_response.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + + struct UnsubscribeButton_responseMarshaller + { + static bool checkIntegrity(UnsubscribeButton_response& e); + static bool checkIntegrityConst(const UnsubscribeButton_response& e); + + static bool fromString(const std::string& s,UnsubscribeButton_response& e); + static const std::string toString(const UnsubscribeButton_response& e); + + static bool fromJSON(const Json::Value& s,UnsubscribeButton_response& e); + static Json::Value toJSON(const UnsubscribeButton_response& e); + }; +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UpdateModeMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UpdateModeMarshaller.cpp new file mode 100644 index 000000000..564b9f833 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UpdateModeMarshaller.cpp @@ -0,0 +1,110 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/UpdateMode.h" +#include "UpdateModeMarshaller.h" +#include "UpdateModeMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const UpdateMode::UpdateModeInternal UpdateModeMarshaller::getIndex(const char* s) +{ + if(!s) + return UpdateMode::INVALID_ENUM; + const struct PerfectHashTable* p=UpdateMode_intHash::getPointer(s,strlen(s)); + return p ? static_cast<UpdateMode::UpdateModeInternal>(p->idx) : UpdateMode::INVALID_ENUM; +} + + +bool UpdateModeMarshaller::fromJSON(const Json::Value& s,UpdateMode& e) +{ + e.mInternal=UpdateMode::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=UpdateMode::INVALID_ENUM); +} + + +Json::Value UpdateModeMarshaller::toJSON(const UpdateMode& e) +{ + if(e.mInternal==UpdateMode::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool UpdateModeMarshaller::fromString(const std::string& s,UpdateMode& e) +{ + e.mInternal=UpdateMode::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string UpdateModeMarshaller::toString(const UpdateMode& e) +{ + Json::FastWriter writer; + return e.mInternal==UpdateMode::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable UpdateModeMarshaller::mHashTable[4]= +{ + {"COUNTUP",0}, + {"COUNTDOWN",1}, + {"PAUSE",2}, + {"RESUME",3} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UpdateModeMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UpdateModeMarshaller.gp new file mode 100644 index 000000000..2e2a2b5b6 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UpdateModeMarshaller.gp @@ -0,0 +1,20 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name UpdateMode_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +COUNTUP,0 +COUNTDOWN,1 +PAUSE,2 +RESUME,3 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UpdateModeMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UpdateModeMarshaller.h new file mode 100644 index 000000000..4b8c39c79 --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UpdateModeMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_UPDATEMODEMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_UPDATEMODEMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/UpdateMode.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for UpdateMode + + class UpdateModeMarshaller + { + public: + + static std::string toName(const UpdateMode& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(UpdateMode& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=UpdateMode::INVALID_ENUM; + } + + static bool checkIntegrity(UpdateMode& e) { return e.mInternal!=UpdateMode::INVALID_ENUM; } + static bool checkIntegrityConst(const UpdateMode& e) { return e.mInternal!=UpdateMode::INVALID_ENUM; } + + static bool fromString(const std::string& s,UpdateMode& e); + static const std::string toString(const UpdateMode& e); + + static bool fromJSON(const Json::Value& s,UpdateMode& e); + static Json::Value toJSON(const UpdateMode& e); + + static const char* getName(UpdateMode::UpdateModeInternal e) + { + return (e>=0 && e<4) ? mHashTable[e].name : NULL; + } + + static const UpdateMode::UpdateModeInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[4]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UpdateModeMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UpdateModeMarshaller.inc new file mode 100644 index 000000000..0a329801b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UpdateModeMarshaller.inc @@ -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. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UpdateModeMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UpdateModeMarshaller.gp */ +/* Computed positions: -k'' */ + + +#define TOTAL_KEYWORDS 4 +#define MIN_WORD_LENGTH 5 +#define MAX_WORD_LENGTH 9 +#define MIN_HASH_VALUE 5 +#define MAX_HASH_VALUE 9 +/* maximum key range = 5, duplicates = 0 */ + +class UpdateMode_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline /*ARGSUSED*/ +unsigned int +UpdateMode_intHash::hash (register const char *str, register unsigned int len) +{ + return len; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +UpdateMode_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 0, 5, 6, 7, 0, 9 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, {""}, +#line 19 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UpdateModeMarshaller.gp" + {"PAUSE",2}, +#line 20 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UpdateModeMarshaller.gp" + {"RESUME",3}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UpdateModeMarshaller.gp" + {"COUNTUP",0}, + {""}, +#line 18 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/UpdateModeMarshaller.gp" + {"COUNTDOWN",1} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/VrCapabilitiesMarshaller.cpp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/VrCapabilitiesMarshaller.cpp new file mode 100644 index 000000000..46f92708b --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/VrCapabilitiesMarshaller.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 <cstring> +#include "../include/JSONHandler/SDLRPCObjects/V1/VrCapabilities.h" +#include "VrCapabilitiesMarshaller.h" +#include "VrCapabilitiesMarshaller.inc" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +using namespace NsSmartDeviceLinkRPC; + + +const VrCapabilities::VrCapabilitiesInternal VrCapabilitiesMarshaller::getIndex(const char* s) +{ + if(!s) + return VrCapabilities::INVALID_ENUM; + const struct PerfectHashTable* p=VrCapabilities_intHash::getPointer(s,strlen(s)); + return p ? static_cast<VrCapabilities::VrCapabilitiesInternal>(p->idx) : VrCapabilities::INVALID_ENUM; +} + + +bool VrCapabilitiesMarshaller::fromJSON(const Json::Value& s,VrCapabilities& e) +{ + e.mInternal=VrCapabilities::INVALID_ENUM; + if(!s.isString()) + return false; + + e.mInternal=getIndex(s.asString().c_str()); + return (e.mInternal!=VrCapabilities::INVALID_ENUM); +} + + +Json::Value VrCapabilitiesMarshaller::toJSON(const VrCapabilities& e) +{ + if(e.mInternal==VrCapabilities::INVALID_ENUM) + return Json::Value(Json::nullValue); + const char* s=getName(e.mInternal); + return s ? Json::Value(s) : Json::Value(Json::nullValue); +} + + +bool VrCapabilitiesMarshaller::fromString(const std::string& s,VrCapabilities& e) +{ + e.mInternal=VrCapabilities::INVALID_ENUM; + try + { + Json::Reader reader; + Json::Value json; + if(!reader.parse(s,json,false)) return false; + if(fromJSON(json,e)) return true; + } + catch(...) + { + return false; + } + return false; +} + +const std::string VrCapabilitiesMarshaller::toString(const VrCapabilities& e) +{ + Json::FastWriter writer; + return e.mInternal==VrCapabilities::INVALID_ENUM ? "" : writer.write(toJSON(e)); + +} + +const PerfectHashTable VrCapabilitiesMarshaller::mHashTable[1]= +{ + {"Text",0} +}; diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/VrCapabilitiesMarshaller.gp b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/VrCapabilitiesMarshaller.gp new file mode 100644 index 000000000..056f672de --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/VrCapabilitiesMarshaller.gp @@ -0,0 +1,17 @@ +%language=C++ +%struct-type +%define lookup-function-name getPointer +%define class-name VrCapabilities_intHash +%omit-struct-type +%readonly-tables +%compare-strncmp +%compare-lengths + +struct NsSmartDeviceLinkRPC::PerfectHashTable +{ + const char *name; + unsigned int idx; +}; + +%% +Text,0 diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/VrCapabilitiesMarshaller.h b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/VrCapabilitiesMarshaller.h new file mode 100644 index 000000000..a6d7d265c --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/VrCapabilitiesMarshaller.h @@ -0,0 +1,90 @@ +// +// Copyright (c) 2013, Ford Motor Company +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with the +// distribution. +// +// Neither the name of the Ford Motor Company nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (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 NSSMARTDEVICELINKRPC_VRCAPABILITIESMARSHALLER_INCLUDE +#define NSSMARTDEVICELINKRPC_VRCAPABILITIESMARSHALLER_INCLUDE + +#include <string> +#include <json/json.h> + +#include "PerfectHashTable.h" + +#include "../include/JSONHandler/SDLRPCObjects/V1/VrCapabilities.h" + + +/* + interface Ford Sync RAPI + version 1.2 + date 2011-05-17 + generated at Thu Jan 24 06:36:21 2013 + source stamp Thu Jan 24 06:35:34 2013 + author RC +*/ + +namespace NsSmartDeviceLinkRPC +{ + +//! marshalling class for VrCapabilities + + class VrCapabilitiesMarshaller + { + public: + + static std::string toName(const VrCapabilities& e) { return getName(e.mInternal) ?: ""; } + + static bool fromName(VrCapabilities& e,const std::string& s) + { + return (e.mInternal=getIndex(s.c_str()))!=VrCapabilities::INVALID_ENUM; + } + + static bool checkIntegrity(VrCapabilities& e) { return e.mInternal!=VrCapabilities::INVALID_ENUM; } + static bool checkIntegrityConst(const VrCapabilities& e) { return e.mInternal!=VrCapabilities::INVALID_ENUM; } + + static bool fromString(const std::string& s,VrCapabilities& e); + static const std::string toString(const VrCapabilities& e); + + static bool fromJSON(const Json::Value& s,VrCapabilities& e); + static Json::Value toJSON(const VrCapabilities& e); + + static const char* getName(VrCapabilities::VrCapabilitiesInternal e) + { + return (e>=0 && e<1) ? mHashTable[e].name : NULL; + } + + static const VrCapabilities::VrCapabilitiesInternal getIndex(const char* s); + + static const PerfectHashTable mHashTable[1]; + }; + +} + +#endif diff --git a/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/VrCapabilitiesMarshaller.inc b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/VrCapabilitiesMarshaller.inc new file mode 100644 index 000000000..43c3287dd --- /dev/null +++ b/SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/VrCapabilitiesMarshaller.inc @@ -0,0 +1,88 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* C++ code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file=./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/VrCapabilitiesMarshaller.inc ./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/VrCapabilitiesMarshaller.gp */ +/* Computed positions: -k'' */ + + +#define TOTAL_KEYWORDS 1 +#define MIN_WORD_LENGTH 4 +#define MAX_WORD_LENGTH 4 +#define MIN_HASH_VALUE 4 +#define MAX_HASH_VALUE 4 +/* maximum key range = 1, duplicates = 0 */ + +class VrCapabilities_intHash +{ +private: + static inline unsigned int hash (const char *str, unsigned int len); +public: + static const struct NsSmartDeviceLinkRPC::PerfectHashTable *getPointer (const char *str, unsigned int len); +}; + +inline /*ARGSUSED*/ +unsigned int +VrCapabilities_intHash::hash (register const char *str, register unsigned int len) +{ + return len; +} + +const struct NsSmartDeviceLinkRPC::PerfectHashTable * +VrCapabilities_intHash::getPointer (register const char *str, register unsigned int len) +{ + static const unsigned char lengthtable[] = + { + 0, 0, 0, 0, 4 + }; + static const struct NsSmartDeviceLinkRPC::PerfectHashTable wordlist[] = + { + {""}, {""}, {""}, {""}, +#line 17 "./src/components/JSONHandler/src/SDLRPCObjectsImpl/V1/VrCapabilitiesMarshaller.gp" + {"Text",0} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + if (len == lengthtable[key]) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) + return &wordlist[key]; + } + } + return 0; +} |