Support broadcast for FengTian.

This commit is contained in:
sdk-team
2023-02-10 10:58:10 +00:00
parent f798fffbdb
commit b94efe4684
8 changed files with 327 additions and 1 deletions

View File

@@ -809,6 +809,8 @@ set(iot_public_header_model
include/alibabacloud/iot/model/UpdateThingModelResult.h
include/alibabacloud/iot/model/UpdateThingScriptRequest.h
include/alibabacloud/iot/model/UpdateThingScriptResult.h
include/alibabacloud/iot/model/UpdateTopicConfigRequest.h
include/alibabacloud/iot/model/UpdateTopicConfigResult.h
include/alibabacloud/iot/model/WriteDevicesHotStorageDataRequest.h
include/alibabacloud/iot/model/WriteDevicesHotStorageDataResult.h )
@@ -1602,6 +1604,8 @@ set(iot_src
src/model/UpdateThingModelResult.cc
src/model/UpdateThingScriptRequest.cc
src/model/UpdateThingScriptResult.cc
src/model/UpdateTopicConfigRequest.cc
src/model/UpdateTopicConfigResult.cc
src/model/WriteDevicesHotStorageDataRequest.cc
src/model/WriteDevicesHotStorageDataResult.cc )

View File

@@ -810,6 +810,8 @@
#include "model/UpdateThingModelResult.h"
#include "model/UpdateThingScriptRequest.h"
#include "model/UpdateThingScriptResult.h"
#include "model/UpdateTopicConfigRequest.h"
#include "model/UpdateTopicConfigResult.h"
#include "model/WriteDevicesHotStorageDataRequest.h"
#include "model/WriteDevicesHotStorageDataResult.h"
@@ -2003,6 +2005,9 @@ namespace AlibabaCloud
typedef Outcome<Error, Model::UpdateThingScriptResult> UpdateThingScriptOutcome;
typedef std::future<UpdateThingScriptOutcome> UpdateThingScriptOutcomeCallable;
typedef std::function<void(const IotClient*, const Model::UpdateThingScriptRequest&, const UpdateThingScriptOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> UpdateThingScriptAsyncHandler;
typedef Outcome<Error, Model::UpdateTopicConfigResult> UpdateTopicConfigOutcome;
typedef std::future<UpdateTopicConfigOutcome> UpdateTopicConfigOutcomeCallable;
typedef std::function<void(const IotClient*, const Model::UpdateTopicConfigRequest&, const UpdateTopicConfigOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> UpdateTopicConfigAsyncHandler;
typedef Outcome<Error, Model::WriteDevicesHotStorageDataResult> WriteDevicesHotStorageDataOutcome;
typedef std::future<WriteDevicesHotStorageDataOutcome> WriteDevicesHotStorageDataOutcomeCallable;
typedef std::function<void(const IotClient*, const Model::WriteDevicesHotStorageDataRequest&, const WriteDevicesHotStorageDataOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> WriteDevicesHotStorageDataAsyncHandler;
@@ -3193,6 +3198,9 @@ namespace AlibabaCloud
UpdateThingScriptOutcome updateThingScript(const Model::UpdateThingScriptRequest &request)const;
void updateThingScriptAsync(const Model::UpdateThingScriptRequest& request, const UpdateThingScriptAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
UpdateThingScriptOutcomeCallable updateThingScriptCallable(const Model::UpdateThingScriptRequest& request) const;
UpdateTopicConfigOutcome updateTopicConfig(const Model::UpdateTopicConfigRequest &request)const;
void updateTopicConfigAsync(const Model::UpdateTopicConfigRequest& request, const UpdateTopicConfigAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
UpdateTopicConfigOutcomeCallable updateTopicConfigCallable(const Model::UpdateTopicConfigRequest& request) const;
WriteDevicesHotStorageDataOutcome writeDevicesHotStorageData(const Model::WriteDevicesHotStorageDataRequest &request)const;
void writeDevicesHotStorageDataAsync(const Model::WriteDevicesHotStorageDataRequest& request, const WriteDevicesHotStorageDataAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
WriteDevicesHotStorageDataOutcomeCallable writeDevicesHotStorageDataCallable(const Model::WriteDevicesHotStorageDataRequest& request) const;

View File

@@ -0,0 +1,63 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ALIBABACLOUD_IOT_MODEL_UPDATETOPICCONFIGREQUEST_H_
#define ALIBABACLOUD_IOT_MODEL_UPDATETOPICCONFIGREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/iot/IotExport.h>
namespace AlibabaCloud
{
namespace Iot
{
namespace Model
{
class ALIBABACLOUD_IOT_EXPORT UpdateTopicConfigRequest : public RpcServiceRequest
{
public:
UpdateTopicConfigRequest();
~UpdateTopicConfigRequest();
std::string getIotInstanceId()const;
void setIotInstanceId(const std::string& iotInstanceId);
std::string getTopicFullName()const;
void setTopicFullName(const std::string& topicFullName);
bool getEnableBroadcast()const;
void setEnableBroadcast(bool enableBroadcast);
std::string getProductKey()const;
void setProductKey(const std::string& productKey);
std::string getApiProduct()const;
void setApiProduct(const std::string& apiProduct);
std::string getApiRevision()const;
void setApiRevision(const std::string& apiRevision);
private:
std::string iotInstanceId_;
std::string topicFullName_;
bool enableBroadcast_;
std::string productKey_;
std::string apiProduct_;
std::string apiRevision_;
};
}
}
}
#endif // !ALIBABACLOUD_IOT_MODEL_UPDATETOPICCONFIGREQUEST_H_

View File

@@ -0,0 +1,55 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ALIBABACLOUD_IOT_MODEL_UPDATETOPICCONFIGRESULT_H_
#define ALIBABACLOUD_IOT_MODEL_UPDATETOPICCONFIGRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/iot/IotExport.h>
namespace AlibabaCloud
{
namespace Iot
{
namespace Model
{
class ALIBABACLOUD_IOT_EXPORT UpdateTopicConfigResult : public ServiceResult
{
public:
UpdateTopicConfigResult();
explicit UpdateTopicConfigResult(const std::string &payload);
~UpdateTopicConfigResult();
std::string getErrorMessage()const;
std::string getCode()const;
bool getSuccess()const;
protected:
void parse(const std::string &payload);
private:
std::string errorMessage_;
std::string code_;
bool success_;
};
}
}
}
#endif // !ALIBABACLOUD_IOT_MODEL_UPDATETOPICCONFIGRESULT_H_

View File

@@ -14235,6 +14235,42 @@ IotClient::UpdateThingScriptOutcomeCallable IotClient::updateThingScriptCallable
return task->get_future();
}
IotClient::UpdateTopicConfigOutcome IotClient::updateTopicConfig(const UpdateTopicConfigRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return UpdateTopicConfigOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return UpdateTopicConfigOutcome(UpdateTopicConfigResult(outcome.result()));
else
return UpdateTopicConfigOutcome(outcome.error());
}
void IotClient::updateTopicConfigAsync(const UpdateTopicConfigRequest& request, const UpdateTopicConfigAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, updateTopicConfig(request), context);
};
asyncExecute(new Runnable(fn));
}
IotClient::UpdateTopicConfigOutcomeCallable IotClient::updateTopicConfigCallable(const UpdateTopicConfigRequest &request) const
{
auto task = std::make_shared<std::packaged_task<UpdateTopicConfigOutcome()>>(
[this, request]()
{
return this->updateTopicConfig(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
IotClient::WriteDevicesHotStorageDataOutcome IotClient::writeDevicesHotStorageData(const WriteDevicesHotStorageDataRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -0,0 +1,95 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/iot/model/UpdateTopicConfigRequest.h>
using AlibabaCloud::Iot::Model::UpdateTopicConfigRequest;
UpdateTopicConfigRequest::UpdateTopicConfigRequest() :
RpcServiceRequest("iot", "2018-01-20", "UpdateTopicConfig")
{
setMethod(HttpRequest::Method::Post);
}
UpdateTopicConfigRequest::~UpdateTopicConfigRequest()
{}
std::string UpdateTopicConfigRequest::getIotInstanceId()const
{
return iotInstanceId_;
}
void UpdateTopicConfigRequest::setIotInstanceId(const std::string& iotInstanceId)
{
iotInstanceId_ = iotInstanceId;
setParameter("IotInstanceId", iotInstanceId);
}
std::string UpdateTopicConfigRequest::getTopicFullName()const
{
return topicFullName_;
}
void UpdateTopicConfigRequest::setTopicFullName(const std::string& topicFullName)
{
topicFullName_ = topicFullName;
setParameter("TopicFullName", topicFullName);
}
bool UpdateTopicConfigRequest::getEnableBroadcast()const
{
return enableBroadcast_;
}
void UpdateTopicConfigRequest::setEnableBroadcast(bool enableBroadcast)
{
enableBroadcast_ = enableBroadcast;
setParameter("EnableBroadcast", enableBroadcast ? "true" : "false");
}
std::string UpdateTopicConfigRequest::getProductKey()const
{
return productKey_;
}
void UpdateTopicConfigRequest::setProductKey(const std::string& productKey)
{
productKey_ = productKey;
setParameter("ProductKey", productKey);
}
std::string UpdateTopicConfigRequest::getApiProduct()const
{
return apiProduct_;
}
void UpdateTopicConfigRequest::setApiProduct(const std::string& apiProduct)
{
apiProduct_ = apiProduct;
setBodyParameter("ApiProduct", apiProduct);
}
std::string UpdateTopicConfigRequest::getApiRevision()const
{
return apiRevision_;
}
void UpdateTopicConfigRequest::setApiRevision(const std::string& apiRevision)
{
apiRevision_ = apiRevision;
setBodyParameter("ApiRevision", apiRevision);
}

View File

@@ -0,0 +1,65 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/iot/model/UpdateTopicConfigResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Iot;
using namespace AlibabaCloud::Iot::Model;
UpdateTopicConfigResult::UpdateTopicConfigResult() :
ServiceResult()
{}
UpdateTopicConfigResult::UpdateTopicConfigResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
UpdateTopicConfigResult::~UpdateTopicConfigResult()
{}
void UpdateTopicConfigResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["ErrorMessage"].isNull())
errorMessage_ = value["ErrorMessage"].asString();
}
std::string UpdateTopicConfigResult::getErrorMessage()const
{
return errorMessage_;
}
std::string UpdateTopicConfigResult::getCode()const
{
return code_;
}
bool UpdateTopicConfigResult::getSuccess()const
{
return success_;
}