Move function definition to aul header
[platform/core/appfw/aul-1.git] / src / aul_job_scheduler.cc
1 /*
2  * Copyright (c) 2017 - 2022 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #include "include/aul_job_scheduler.h"
18
19 #include <bundle_cpp.h>
20
21 #include "app_request.h"
22 #include "aul_api.h"
23 #include "aul_util.h"
24 #include "include/aul.h"
25 #include "include/aul_sock.h"
26
27 extern "C" API int aul_job_scheduler_update_job_status(const char* job_id,
28     aul_job_status_e job_status) {
29   if (job_id == nullptr ||
30       job_status < JOB_STATUS_START ||
31       job_status > JOB_STATUS_FINISHED) {
32     _E("Invalid parameter");
33     return AUL_R_EINVAL;
34   }
35
36   tizen_base::Bundle b {
37     { AUL_K_JOB_ID, job_id },
38     { AUL_K_JOB_STATUS, std::to_string(job_status) }
39   };
40
41   return aul::internal::AppRequest(JOB_STATUS_UPDATE, getuid())
42       .With(std::move(b))
43       .SendSimply(AUL_SOCK_NOREPLY);
44 }