Separate device manager related code
[platform/core/api/camera.git] / test / camera_test_headless.c
1 /*
2  * camera_test_headless
3  *
4  * Copyright (c) 2022 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jeongmo Yang <jm80.yang@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License f(r the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 #include "camera_test.h"
22
23
24 static GMainLoop *g_mainloop_camera_test;
25
26
27 void set_display(cam_handle_t *hcamcorder)
28 {
29         g_print("Display type : NULL for headless\n");
30         camera_set_display(hcamcorder->camera, CAMERA_DISPLAY_TYPE_NONE, NULL);
31 }
32
33
34 void quit_test(void)
35 {
36         g_main_loop_quit(g_mainloop_camera_test);
37 }
38
39
40 int main(int argc, char **argv)
41 {
42         cam_handle_t *handle = init_handle();
43         GIOChannel *stdin_channel = g_io_channel_unix_new(fileno(stdin));/* read from stdin */
44
45         g_io_add_watch(stdin_channel, G_IO_IN, (GIOFunc)cmd_input, NULL);
46
47         init_handle();
48
49         print_menu();
50
51         g_mainloop_camera_test = g_main_loop_new(NULL, FALSE);
52
53         g_main_loop_run(g_mainloop_camera_test);
54
55         g_print("\n\treturn main loop\n\n");
56
57         g_main_loop_unref(g_mainloop_camera_test);
58
59         g_free(handle);
60         g_io_channel_unref(stdin_channel);
61
62         return 0;
63 }