User may want to set various data set for launching app.
after this implementation.
user can do like below
- python
extraData1 = LaunchData()
extraData1.key = 'Key1'
extraData1.value = 'Value1'
extraData2 = LaunchData()
extraData2.key = 'Key2'
extraData2.value = 'Value2'
datas = [extraData1, extraData2]
stub.launchApp(ReqLaunchApp(packageName='org.tizen.example.NUITizenGallery', data=datas))
Change-Id: Id7756a080acb9e940d0679a4ae0ae89ccc9fb57e
#include <string>
#include "Runnable.h"
+#include <aurum.grpc.pb.h>
class LaunchAppRunnable : public Runnable {
protected:
std::string mPkg;
- std::string mKey;
- std::string mValue;
+ const google::protobuf::RepeatedPtrField<aurum::LaunchData>& mData;
public:
- LaunchAppRunnable(std::string pkg, std::string key, std::string value);
+ LaunchAppRunnable(std::string pkg, const google::protobuf::RepeatedPtrField<aurum::LaunchData>& data);
std::string getPkgName();
void run() const override;
};
::grpc::Status LaunchAppCommand::execute()
{
LOGI("LaunchApp --------------- ");
- std::unique_ptr<LaunchAppRunnable> cmd = std::make_unique<LaunchAppRunnable>(mRequest->packagename(), mRequest->key(), mRequest->value());
+ std::unique_ptr<LaunchAppRunnable> cmd = std::make_unique<LaunchAppRunnable>(mRequest->packagename(), mRequest->data());
std::shared_ptr<UiDevice> obj = UiDevice::getInstance();
obj->executeAndWaitForEvents(cmd.get(), A11yEvent::EVENT_WINDOW_ACTIVATE, WAIT_APP_LAUNCH);
#include <app_control.h>
#endif
-LaunchAppRunnable::LaunchAppRunnable(std::string pkg, std::string key, std::string value)
- : mPkg{pkg}, mKey{key}, mValue{value}
+LaunchAppRunnable::LaunchAppRunnable(std::string pkg, const google::protobuf::RepeatedPtrField<aurum::LaunchData>& data)
+ : mPkg{pkg}, mData(data)
{
}
return;
}
- if (!mKey.empty() && !mValue.empty()) {
- ret = app_control_add_extra_data(appControl, mKey.c_str(), mValue.c_str());
+ std::for_each(mData.begin(), mData.end(), [&](auto data){
+ ret = app_control_add_extra_data(appControl, data.key().c_str(),data.value().c_str());
if (ret) {
LOGE("Launch Failed(app_control_add_extra_data) Err Code : %ull", ret);
app_control_destroy(appControl);
return;
}
- }
+ });
ret = app_control_set_app_id(appControl, packageName.c_str());
if (ret) {
int32 height = 4;
}
+message LaunchData {
+ string key = 1;
+ string value = 2;
+}
+
// ------------------------------------ //
message ReqFindElement {
message ReqLaunchApp{
string packageName = 1;
- string key = 2;
- string value = 3;
+ repeated LaunchData data = 2;
}
message RspLaunchApp{
RspStatus status = 1;