2 * Copyright (c) 2023 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "launchpad-common/hydra_request.hh"
23 HydraRequest::HydraRequest(int cmd, int priority)
24 : cmd_(cmd), priority_(priority) {}
26 HydraRequest::HydraRequest(int cmd, int priority, int argc, char** argv)
27 : cmd_(cmd), priority_(priority), argc_(argc), argv_(argv) {}
29 int HydraRequest::GetCommand() const {
33 int HydraRequest::GetPriority() const {
37 int HydraRequest::GetArgc() const {
41 char** HydraRequest::GetArgv() const {
45 void HydraRequest::WriteToParcel(tizen_base::Parcel* parcel) const {
46 parcel->WriteInt32(cmd_);
47 parcel->WriteInt32(priority_);
48 parcel->WriteInt32(argc_);
49 for (int i = 0; i < argc_; ++i)
50 parcel->WriteCString(argv_[i]);
53 void HydraRequest::ReadFromParcel(tizen_base::Parcel* parcel) {
54 for (int i = 0; i < argc_; ++i)
60 parcel->ReadInt32(&cmd_);
61 parcel->ReadInt32(&priority_);
62 parcel->ReadInt32(&argc_);
66 argv_ = static_cast<char**>(calloc(argc_ + 1, sizeof(char*)));
70 for (int i = 0; i < argc_; ++i)
71 parcel->ReadCString(&argv_[i]);
74 } // namespace launchpad