1e41f4b71Sopenharmony_ci# Photographing<a name="EN-US_TOPIC_0000001054915940"></a>
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## When to Use<a name="en-us_topic_0000001052170554_section1963312376119"></a>
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ciUse the camera module APIs to capture frames \(photographing\).
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ci## Available APIs<a name="en-us_topic_0000001052170554_section56549532016"></a>
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci**Table 1**  APIs for photographing
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci<a name="en-us_topic_0000001052170554_table2069447114914"></a>
12e41f4b71Sopenharmony_ci<table><thead align="left"><tr id="en-us_topic_0000001052170554_row4903852104914"><th class="cellrowborder" valign="top" width="18.811881188118814%" id="mcps1.2.4.1.1"><p id="en-us_topic_0000001052170554_p2903252174918"><a name="en-us_topic_0000001052170554_p2903252174918"></a><a name="en-us_topic_0000001052170554_p2903252174918"></a>Class</p>
13e41f4b71Sopenharmony_ci</th>
14e41f4b71Sopenharmony_ci<th class="cellrowborder" valign="top" width="46.534653465346544%" id="mcps1.2.4.1.2"><p id="en-us_topic_0000001052170554_p1595113912507"><a name="en-us_topic_0000001052170554_p1595113912507"></a><a name="en-us_topic_0000001052170554_p1595113912507"></a>Function</p>
15e41f4b71Sopenharmony_ci</th>
16e41f4b71Sopenharmony_ci<th class="cellrowborder" valign="top" width="34.65346534653466%" id="mcps1.2.4.1.3"><p id="en-us_topic_0000001052170554_p15951597508"><a name="en-us_topic_0000001052170554_p15951597508"></a><a name="en-us_topic_0000001052170554_p15951597508"></a>Description</p>
17e41f4b71Sopenharmony_ci</th>
18e41f4b71Sopenharmony_ci</tr>
19e41f4b71Sopenharmony_ci</thead>
20e41f4b71Sopenharmony_ci<tbody><tr id="en-us_topic_0000001052170554_row492815717494"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p1592812716495"><a name="en-us_topic_0000001052170554_p1592812716495"></a><a name="en-us_topic_0000001052170554_p1592812716495"></a>CameraKit</p>
21e41f4b71Sopenharmony_ci</td>
22e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p1492837144919"><a name="en-us_topic_0000001052170554_p1492837144919"></a><a name="en-us_topic_0000001052170554_p1492837144919"></a>int32_t GetCameraIds(std::list&lt;string&gt; cameraList)</p>
23e41f4b71Sopenharmony_ci</td>
24e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p2092807134919"><a name="en-us_topic_0000001052170554_p2092807134919"></a><a name="en-us_topic_0000001052170554_p2092807134919"></a>Obtains IDs of cameras that are currently available.</p>
25e41f4b71Sopenharmony_ci</td>
26e41f4b71Sopenharmony_ci</tr>
27e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row11928157114912"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p139287774911"><a name="en-us_topic_0000001052170554_p139287774911"></a><a name="en-us_topic_0000001052170554_p139287774911"></a>CameraKit</p>
28e41f4b71Sopenharmony_ci</td>
29e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p9928107174915"><a name="en-us_topic_0000001052170554_p9928107174915"></a><a name="en-us_topic_0000001052170554_p9928107174915"></a>CameraAbility&amp; GetCameraAbility(string cameraId)</p>
30e41f4b71Sopenharmony_ci</td>
31e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p139281171494"><a name="en-us_topic_0000001052170554_p139281171494"></a><a name="en-us_topic_0000001052170554_p139281171494"></a>Obtains the camera capability</p>
32e41f4b71Sopenharmony_ci</td>
33e41f4b71Sopenharmony_ci</tr>
34e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row119282719496"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p159288734914"><a name="en-us_topic_0000001052170554_p159288734914"></a><a name="en-us_topic_0000001052170554_p159288734914"></a>CameraKit</p>
35e41f4b71Sopenharmony_ci</td>
36e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p99280794913"><a name="en-us_topic_0000001052170554_p99280794913"></a><a name="en-us_topic_0000001052170554_p99280794913"></a>void RegisterCameraDeviceCallback(CameraDeviceCallback* callback, EventHandler* handler)</p>
37e41f4b71Sopenharmony_ci</td>
38e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p8928197134910"><a name="en-us_topic_0000001052170554_p8928197134910"></a><a name="en-us_topic_0000001052170554_p8928197134910"></a>Registers a camera callback for camera status changes.</p>
39e41f4b71Sopenharmony_ci</td>
40e41f4b71Sopenharmony_ci</tr>
41e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row4928673496"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p14928770497"><a name="en-us_topic_0000001052170554_p14928770497"></a><a name="en-us_topic_0000001052170554_p14928770497"></a>CameraKit</p>
42e41f4b71Sopenharmony_ci</td>
43e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p14928197194915"><a name="en-us_topic_0000001052170554_p14928197194915"></a><a name="en-us_topic_0000001052170554_p14928197194915"></a>void UnregisterCameraDeviceCallback(CameraDeviceCallback* callback)</p>
44e41f4b71Sopenharmony_ci</td>
45e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p17929197134913"><a name="en-us_topic_0000001052170554_p17929197134913"></a><a name="en-us_topic_0000001052170554_p17929197134913"></a>Unregisters a camera callback.</p>
46e41f4b71Sopenharmony_ci</td>
47e41f4b71Sopenharmony_ci</tr>
48e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row16929187104912"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p6929157184911"><a name="en-us_topic_0000001052170554_p6929157184911"></a><a name="en-us_topic_0000001052170554_p6929157184911"></a>CameraKit</p>
49e41f4b71Sopenharmony_ci</td>
50e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p1192910704914"><a name="en-us_topic_0000001052170554_p1192910704914"></a><a name="en-us_topic_0000001052170554_p1192910704914"></a>void CreateCamera(string cameraId, CameraStateCallback* callback, EventHandler* handler)</p>
51e41f4b71Sopenharmony_ci</td>
52e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p12929167154912"><a name="en-us_topic_0000001052170554_p12929167154912"></a><a name="en-us_topic_0000001052170554_p12929167154912"></a>Creates a <strong id="en-us_topic_0000001052170554_b1512582132318"><a name="en-us_topic_0000001052170554_b1512582132318"></a><a name="en-us_topic_0000001052170554_b1512582132318"></a>Camera</strong> instance.</p>
53e41f4b71Sopenharmony_ci</td>
54e41f4b71Sopenharmony_ci</tr>
55e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row592967184912"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p9929127134915"><a name="en-us_topic_0000001052170554_p9929127134915"></a><a name="en-us_topic_0000001052170554_p9929127134915"></a>Camera</p>
56e41f4b71Sopenharmony_ci</td>
57e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p0929107204913"><a name="en-us_topic_0000001052170554_p0929107204913"></a><a name="en-us_topic_0000001052170554_p0929107204913"></a>string GetCameraId()</p>
58e41f4b71Sopenharmony_ci</td>
59e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p1592914710490"><a name="en-us_topic_0000001052170554_p1592914710490"></a><a name="en-us_topic_0000001052170554_p1592914710490"></a>Obtains the camera ID.</p>
60e41f4b71Sopenharmony_ci</td>
61e41f4b71Sopenharmony_ci</tr>
62e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row13929197104913"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p16929167134913"><a name="en-us_topic_0000001052170554_p16929167134913"></a><a name="en-us_topic_0000001052170554_p16929167134913"></a>Camera</p>
63e41f4b71Sopenharmony_ci</td>
64e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p15929175491"><a name="en-us_topic_0000001052170554_p15929175491"></a><a name="en-us_topic_0000001052170554_p15929175491"></a>CameraConfig&amp; GetCameraConfig()</p>
65e41f4b71Sopenharmony_ci</td>
66e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p19298714917"><a name="en-us_topic_0000001052170554_p19298714917"></a><a name="en-us_topic_0000001052170554_p19298714917"></a>Obtains the camera configuration.</p>
67e41f4b71Sopenharmony_ci</td>
68e41f4b71Sopenharmony_ci</tr>
69e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row1892918764915"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p69291072495"><a name="en-us_topic_0000001052170554_p69291072495"></a><a name="en-us_topic_0000001052170554_p69291072495"></a>Camera</p>
70e41f4b71Sopenharmony_ci</td>
71e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p5930172494"><a name="en-us_topic_0000001052170554_p5930172494"></a><a name="en-us_topic_0000001052170554_p5930172494"></a>FrameConfig&amp; GetFrameConfig(int32_t type)</p>
72e41f4b71Sopenharmony_ci</td>
73e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p19301176495"><a name="en-us_topic_0000001052170554_p19301176495"></a><a name="en-us_topic_0000001052170554_p19301176495"></a>Obtains the frame configuration.</p>
74e41f4b71Sopenharmony_ci</td>
75e41f4b71Sopenharmony_ci</tr>
76e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row893019794915"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p893016714919"><a name="en-us_topic_0000001052170554_p893016714919"></a><a name="en-us_topic_0000001052170554_p893016714919"></a>Camera</p>
77e41f4b71Sopenharmony_ci</td>
78e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p1093067134915"><a name="en-us_topic_0000001052170554_p1093067134915"></a><a name="en-us_topic_0000001052170554_p1093067134915"></a>void Configure(CameraConfig&amp; config)</p>
79e41f4b71Sopenharmony_ci</td>
80e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p1493037114912"><a name="en-us_topic_0000001052170554_p1493037114912"></a><a name="en-us_topic_0000001052170554_p1493037114912"></a>Configures the camera using the <strong id="en-us_topic_0000001052170554_b1158653521815"><a name="en-us_topic_0000001052170554_b1158653521815"></a><a name="en-us_topic_0000001052170554_b1158653521815"></a>CameraConfig</strong> object.</p>
81e41f4b71Sopenharmony_ci</td>
82e41f4b71Sopenharmony_ci</tr>
83e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row11930197174917"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p4930197184914"><a name="en-us_topic_0000001052170554_p4930197184914"></a><a name="en-us_topic_0000001052170554_p4930197184914"></a>Camera</p>
84e41f4b71Sopenharmony_ci</td>
85e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p19304717492"><a name="en-us_topic_0000001052170554_p19304717492"></a><a name="en-us_topic_0000001052170554_p19304717492"></a>void Release()</p>
86e41f4b71Sopenharmony_ci</td>
87e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p189301479494"><a name="en-us_topic_0000001052170554_p189301479494"></a><a name="en-us_topic_0000001052170554_p189301479494"></a>Releases the <strong id="en-us_topic_0000001052170554_b12391143101812"><a name="en-us_topic_0000001052170554_b12391143101812"></a><a name="en-us_topic_0000001052170554_b12391143101812"></a>Camera</strong> object and associated resources.</p>
88e41f4b71Sopenharmony_ci</td>
89e41f4b71Sopenharmony_ci</tr>
90e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row109304717499"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p4930873496"><a name="en-us_topic_0000001052170554_p4930873496"></a><a name="en-us_topic_0000001052170554_p4930873496"></a>Camera</p>
91e41f4b71Sopenharmony_ci</td>
92e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p1893017720490"><a name="en-us_topic_0000001052170554_p1893017720490"></a><a name="en-us_topic_0000001052170554_p1893017720490"></a>int TriggerLoopingCapture(FrameConfig&amp; frameConfig)</p>
93e41f4b71Sopenharmony_ci</td>
94e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p149307754918"><a name="en-us_topic_0000001052170554_p149307754918"></a><a name="en-us_topic_0000001052170554_p149307754918"></a>Starts looping-frame capture.</p>
95e41f4b71Sopenharmony_ci</td>
96e41f4b71Sopenharmony_ci</tr>
97e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row19306794915"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p6930167194910"><a name="en-us_topic_0000001052170554_p6930167194910"></a><a name="en-us_topic_0000001052170554_p6930167194910"></a>Camera</p>
98e41f4b71Sopenharmony_ci</td>
99e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p139311577499"><a name="en-us_topic_0000001052170554_p139311577499"></a><a name="en-us_topic_0000001052170554_p139311577499"></a>void StopLoopingCapture()</p>
100e41f4b71Sopenharmony_ci</td>
101e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p693115764914"><a name="en-us_topic_0000001052170554_p693115764914"></a><a name="en-us_topic_0000001052170554_p693115764914"></a>Stops looping-frame capture.</p>
102e41f4b71Sopenharmony_ci</td>
103e41f4b71Sopenharmony_ci</tr>
104e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row593116713492"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p1193187174913"><a name="en-us_topic_0000001052170554_p1193187174913"></a><a name="en-us_topic_0000001052170554_p1193187174913"></a>Camera</p>
105e41f4b71Sopenharmony_ci</td>
106e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p1493111713496"><a name="en-us_topic_0000001052170554_p1493111713496"></a><a name="en-us_topic_0000001052170554_p1493111713496"></a>int32_t TriggerSingleCapture(FrameConfig&amp; frameConfig)</p>
107e41f4b71Sopenharmony_ci</td>
108e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p1193137104919"><a name="en-us_topic_0000001052170554_p1193137104919"></a><a name="en-us_topic_0000001052170554_p1193137104919"></a>Starts single-frame capture.</p>
109e41f4b71Sopenharmony_ci</td>
110e41f4b71Sopenharmony_ci</tr>
111e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row1693112711491"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p89312716494"><a name="en-us_topic_0000001052170554_p89312716494"></a><a name="en-us_topic_0000001052170554_p89312716494"></a>CameraConfig</p>
112e41f4b71Sopenharmony_ci</td>
113e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p199312784912"><a name="en-us_topic_0000001052170554_p199312784912"></a><a name="en-us_topic_0000001052170554_p199312784912"></a>void SetFrameStateCallback(FrameStateCallback* callback, EventHandler* handler);</p>
114e41f4b71Sopenharmony_ci</td>
115e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p49312714495"><a name="en-us_topic_0000001052170554_p49312714495"></a><a name="en-us_topic_0000001052170554_p49312714495"></a>Sets a frame state callback to respond to state changes.</p>
116e41f4b71Sopenharmony_ci</td>
117e41f4b71Sopenharmony_ci</tr>
118e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row9931076492"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p59317784917"><a name="en-us_topic_0000001052170554_p59317784917"></a><a name="en-us_topic_0000001052170554_p59317784917"></a>CameraConfig</p>
119e41f4b71Sopenharmony_ci</td>
120e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p17931197124912"><a name="en-us_topic_0000001052170554_p17931197124912"></a><a name="en-us_topic_0000001052170554_p17931197124912"></a>static CameraConfig* CreateCameraConfig()</p>
121e41f4b71Sopenharmony_ci</td>
122e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p5931177164912"><a name="en-us_topic_0000001052170554_p5931177164912"></a><a name="en-us_topic_0000001052170554_p5931177164912"></a>Creates a <strong id="en-us_topic_0000001052170554_b101608165182"><a name="en-us_topic_0000001052170554_b101608165182"></a><a name="en-us_topic_0000001052170554_b101608165182"></a>CameraConfig</strong> instance.</p>
123e41f4b71Sopenharmony_ci</td>
124e41f4b71Sopenharmony_ci</tr>
125e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row29321744917"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p1093219716492"><a name="en-us_topic_0000001052170554_p1093219716492"></a><a name="en-us_topic_0000001052170554_p1093219716492"></a>CameraAbility</p>
126e41f4b71Sopenharmony_ci</td>
127e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p12932979493"><a name="en-us_topic_0000001052170554_p12932979493"></a><a name="en-us_topic_0000001052170554_p12932979493"></a>std::list&lt;Size&gt; GetSupportedSizes(int format)</p>
128e41f4b71Sopenharmony_ci</td>
129e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p1493210764918"><a name="en-us_topic_0000001052170554_p1493210764918"></a><a name="en-us_topic_0000001052170554_p1493210764918"></a>Obtains the supported image sizes for a specified image format.</p>
130e41f4b71Sopenharmony_ci</td>
131e41f4b71Sopenharmony_ci</tr>
132e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row1193267184910"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p1393214717492"><a name="en-us_topic_0000001052170554_p1393214717492"></a><a name="en-us_topic_0000001052170554_p1393214717492"></a>CameraAbility</p>
133e41f4b71Sopenharmony_ci</td>
134e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p119321477495"><a name="en-us_topic_0000001052170554_p119321477495"></a><a name="en-us_topic_0000001052170554_p119321477495"></a>std::list&lt;T&gt; GetParameterRange(uint32_t key)</p>
135e41f4b71Sopenharmony_ci</td>
136e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p139331079491"><a name="en-us_topic_0000001052170554_p139331079491"></a><a name="en-us_topic_0000001052170554_p139331079491"></a>Obtains the parameter value range based on a specified parameter key.</p>
137e41f4b71Sopenharmony_ci</td>
138e41f4b71Sopenharmony_ci</tr>
139e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row0933197134920"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p1493310764917"><a name="en-us_topic_0000001052170554_p1493310764917"></a><a name="en-us_topic_0000001052170554_p1493310764917"></a>CameraDevice</p>
140e41f4b71Sopenharmony_ci</td>
141e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p493313724915"><a name="en-us_topic_0000001052170554_p493313724915"></a><a name="en-us_topic_0000001052170554_p493313724915"></a>CameraDeviceCallback()</p>
142e41f4b71Sopenharmony_ci</td>
143e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p993416724915"><a name="en-us_topic_0000001052170554_p993416724915"></a><a name="en-us_topic_0000001052170554_p993416724915"></a>A constructor used to create a <strong id="en-us_topic_0000001052170554_b99481043111719"><a name="en-us_topic_0000001052170554_b99481043111719"></a><a name="en-us_topic_0000001052170554_b99481043111719"></a>CameraDeviceCallback</strong> instance.</p>
144e41f4b71Sopenharmony_ci</td>
145e41f4b71Sopenharmony_ci</tr>
146e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row093418712498"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p159341779492"><a name="en-us_topic_0000001052170554_p159341779492"></a><a name="en-us_topic_0000001052170554_p159341779492"></a>CameraDevice</p>
147e41f4b71Sopenharmony_ci</td>
148e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p1493411774912"><a name="en-us_topic_0000001052170554_p1493411774912"></a><a name="en-us_topic_0000001052170554_p1493411774912"></a>void OnCameraStatus​(std::string cameraId, int32_t status)</p>
149e41f4b71Sopenharmony_ci</td>
150e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p1393419715491"><a name="en-us_topic_0000001052170554_p1393419715491"></a><a name="en-us_topic_0000001052170554_p1393419715491"></a>Called when the camera device status changes.</p>
151e41f4b71Sopenharmony_ci</td>
152e41f4b71Sopenharmony_ci</tr>
153e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row109348711497"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p993419724914"><a name="en-us_topic_0000001052170554_p993419724914"></a><a name="en-us_topic_0000001052170554_p993419724914"></a>CameraStateCallback</p>
154e41f4b71Sopenharmony_ci</td>
155e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p993418720497"><a name="en-us_topic_0000001052170554_p993418720497"></a><a name="en-us_topic_0000001052170554_p993418720497"></a>CameraStateCallback​()</p>
156e41f4b71Sopenharmony_ci</td>
157e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p693511794919"><a name="en-us_topic_0000001052170554_p693511794919"></a><a name="en-us_topic_0000001052170554_p693511794919"></a>A constructor used to create a <strong id="en-us_topic_0000001052170554_b10634201491717"><a name="en-us_topic_0000001052170554_b10634201491717"></a><a name="en-us_topic_0000001052170554_b10634201491717"></a>CameraStateCallback</strong> instance.</p>
158e41f4b71Sopenharmony_ci</td>
159e41f4b71Sopenharmony_ci</tr>
160e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row159358717497"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p1992012253527"><a name="en-us_topic_0000001052170554_p1992012253527"></a><a name="en-us_topic_0000001052170554_p1992012253527"></a>CameraStateCallback</p>
161e41f4b71Sopenharmony_ci</td>
162e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p29351077497"><a name="en-us_topic_0000001052170554_p29351077497"></a><a name="en-us_topic_0000001052170554_p29351077497"></a>void OnConfigured​(Camera&amp; camera)</p>
163e41f4b71Sopenharmony_ci</td>
164e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p093515774914"><a name="en-us_topic_0000001052170554_p093515774914"></a><a name="en-us_topic_0000001052170554_p093515774914"></a>Called when the camera is configured.</p>
165e41f4b71Sopenharmony_ci</td>
166e41f4b71Sopenharmony_ci</tr>
167e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row9935147184918"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p117291328135211"><a name="en-us_topic_0000001052170554_p117291328135211"></a><a name="en-us_topic_0000001052170554_p117291328135211"></a>CameraStateCallback</p>
168e41f4b71Sopenharmony_ci</td>
169e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p19935174496"><a name="en-us_topic_0000001052170554_p19935174496"></a><a name="en-us_topic_0000001052170554_p19935174496"></a>void OnConfigureFailed​(Camera&amp; camera,int32_t errorCode)</p>
170e41f4b71Sopenharmony_ci</td>
171e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p159352077495"><a name="en-us_topic_0000001052170554_p159352077495"></a><a name="en-us_topic_0000001052170554_p159352077495"></a>Called when the camera fails to be configured.</p>
172e41f4b71Sopenharmony_ci</td>
173e41f4b71Sopenharmony_ci</tr>
174e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row1935279498"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p1514619311525"><a name="en-us_topic_0000001052170554_p1514619311525"></a><a name="en-us_topic_0000001052170554_p1514619311525"></a>CameraStateCallback</p>
175e41f4b71Sopenharmony_ci</td>
176e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p493512744915"><a name="en-us_topic_0000001052170554_p493512744915"></a><a name="en-us_topic_0000001052170554_p493512744915"></a>void OnCreated​(Camera&amp; camera)</p>
177e41f4b71Sopenharmony_ci</td>
178e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p1493511784914"><a name="en-us_topic_0000001052170554_p1493511784914"></a><a name="en-us_topic_0000001052170554_p1493511784914"></a>Called when the camera is successfully created.</p>
179e41f4b71Sopenharmony_ci</td>
180e41f4b71Sopenharmony_ci</tr>
181e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row189351877493"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p172071933175218"><a name="en-us_topic_0000001052170554_p172071933175218"></a><a name="en-us_topic_0000001052170554_p172071933175218"></a>CameraStateCallback</p>
182e41f4b71Sopenharmony_ci</td>
183e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p129361977498"><a name="en-us_topic_0000001052170554_p129361977498"></a><a name="en-us_topic_0000001052170554_p129361977498"></a>void OnCreateFailed​(std::string cameraId,int32_t errorCode)</p>
184e41f4b71Sopenharmony_ci</td>
185e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p2936197114919"><a name="en-us_topic_0000001052170554_p2936197114919"></a><a name="en-us_topic_0000001052170554_p2936197114919"></a>Called when the camera fails to be created.</p>
186e41f4b71Sopenharmony_ci</td>
187e41f4b71Sopenharmony_ci</tr>
188e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row20936472491"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p61213391523"><a name="en-us_topic_0000001052170554_p61213391523"></a><a name="en-us_topic_0000001052170554_p61213391523"></a>CameraStateCallback</p>
189e41f4b71Sopenharmony_ci</td>
190e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p793697174919"><a name="en-us_topic_0000001052170554_p793697174919"></a><a name="en-us_topic_0000001052170554_p793697174919"></a>void OnReleased​(Camera&amp; camera)</p>
191e41f4b71Sopenharmony_ci</td>
192e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p49361719495"><a name="en-us_topic_0000001052170554_p49361719495"></a><a name="en-us_topic_0000001052170554_p49361719495"></a>Called when the camera is released.</p>
193e41f4b71Sopenharmony_ci</td>
194e41f4b71Sopenharmony_ci</tr>
195e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row159361179493"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p10936147194918"><a name="en-us_topic_0000001052170554_p10936147194918"></a><a name="en-us_topic_0000001052170554_p10936147194918"></a>FrameStateCallback</p>
196e41f4b71Sopenharmony_ci</td>
197e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p9936279496"><a name="en-us_topic_0000001052170554_p9936279496"></a><a name="en-us_topic_0000001052170554_p9936279496"></a>FrameStateCallback​()</p>
198e41f4b71Sopenharmony_ci</td>
199e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p49367718499"><a name="en-us_topic_0000001052170554_p49367718499"></a><a name="en-us_topic_0000001052170554_p49367718499"></a>A constructor used to create a <strong id="en-us_topic_0000001052170554_b225612012172"><a name="en-us_topic_0000001052170554_b225612012172"></a><a name="en-us_topic_0000001052170554_b225612012172"></a>FrameStateCallback</strong> instance.</p>
200e41f4b71Sopenharmony_ci</td>
201e41f4b71Sopenharmony_ci</tr>
202e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row1893617744916"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p136968511524"><a name="en-us_topic_0000001052170554_p136968511524"></a><a name="en-us_topic_0000001052170554_p136968511524"></a>FrameStateCallback</p>
203e41f4b71Sopenharmony_ci</td>
204e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p209379744911"><a name="en-us_topic_0000001052170554_p209379744911"></a><a name="en-us_topic_0000001052170554_p209379744911"></a>void OnFrameFinished(Camera&amp; camera, FrameConfig&amp; frameConfig, FrameResult&amp; frameResult)</p>
205e41f4b71Sopenharmony_ci</td>
206e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p19374724913"><a name="en-us_topic_0000001052170554_p19374724913"></a><a name="en-us_topic_0000001052170554_p19374724913"></a>Called when the frame capture is completed.</p>
207e41f4b71Sopenharmony_ci</td>
208e41f4b71Sopenharmony_ci</tr>
209e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row093719718495"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p772975317527"><a name="en-us_topic_0000001052170554_p772975317527"></a><a name="en-us_topic_0000001052170554_p772975317527"></a>FrameStateCallback</p>
210e41f4b71Sopenharmony_ci</td>
211e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p189371471498"><a name="en-us_topic_0000001052170554_p189371471498"></a><a name="en-us_topic_0000001052170554_p189371471498"></a>void OnFrameError​(Camera&amp; camera, FrameConfig&amp; frameConfig, int32_t errorCode, FrameResult&amp; frameResult)</p>
212e41f4b71Sopenharmony_ci</td>
213e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p109371778497"><a name="en-us_topic_0000001052170554_p109371778497"></a><a name="en-us_topic_0000001052170554_p109371778497"></a>Called when the frame capture fails.</p>
214e41f4b71Sopenharmony_ci</td>
215e41f4b71Sopenharmony_ci</tr>
216e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row179381979499"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p169381975499"><a name="en-us_topic_0000001052170554_p169381975499"></a><a name="en-us_topic_0000001052170554_p169381975499"></a>FrameConfig</p>
217e41f4b71Sopenharmony_ci</td>
218e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p1793867124910"><a name="en-us_topic_0000001052170554_p1793867124910"></a><a name="en-us_topic_0000001052170554_p1793867124910"></a>int32_t GetFrameConfigType()</p>
219e41f4b71Sopenharmony_ci</td>
220e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p1993817744915"><a name="en-us_topic_0000001052170554_p1993817744915"></a><a name="en-us_topic_0000001052170554_p1993817744915"></a>Obtains the frame configuration type.</p>
221e41f4b71Sopenharmony_ci</td>
222e41f4b71Sopenharmony_ci</tr>
223e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row793817784912"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p69381724914"><a name="en-us_topic_0000001052170554_p69381724914"></a><a name="en-us_topic_0000001052170554_p69381724914"></a>FrameConfig</p>
224e41f4b71Sopenharmony_ci</td>
225e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p149382077496"><a name="en-us_topic_0000001052170554_p149382077496"></a><a name="en-us_topic_0000001052170554_p149382077496"></a>std::list&lt;OHOS::Surface&gt; GetSurfaces()</p>
226e41f4b71Sopenharmony_ci</td>
227e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p893867114919"><a name="en-us_topic_0000001052170554_p893867114919"></a><a name="en-us_topic_0000001052170554_p893867114919"></a>Obtains a list of surface objects (shared memories).</p>
228e41f4b71Sopenharmony_ci</td>
229e41f4b71Sopenharmony_ci</tr>
230e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row109401570498"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p294019712492"><a name="en-us_topic_0000001052170554_p294019712492"></a><a name="en-us_topic_0000001052170554_p294019712492"></a>FrameConfig</p>
231e41f4b71Sopenharmony_ci</td>
232e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p19940170499"><a name="en-us_topic_0000001052170554_p19940170499"></a><a name="en-us_topic_0000001052170554_p19940170499"></a>void AddSurface(OHOS::AGP::UISurface&amp; surface);</p>
233e41f4b71Sopenharmony_ci</td>
234e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p11940197144915"><a name="en-us_topic_0000001052170554_p11940197144915"></a><a name="en-us_topic_0000001052170554_p11940197144915"></a>Adds a surface.</p>
235e41f4b71Sopenharmony_ci</td>
236e41f4b71Sopenharmony_ci</tr>
237e41f4b71Sopenharmony_ci<tr id="en-us_topic_0000001052170554_row994018711492"><td class="cellrowborder" valign="top" width="18.811881188118814%" headers="mcps1.2.4.1.1 "><p id="en-us_topic_0000001052170554_p1094016718493"><a name="en-us_topic_0000001052170554_p1094016718493"></a><a name="en-us_topic_0000001052170554_p1094016718493"></a>FrameConfig</p>
238e41f4b71Sopenharmony_ci</td>
239e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="46.534653465346544%" headers="mcps1.2.4.1.2 "><p id="en-us_topic_0000001052170554_p139411279498"><a name="en-us_topic_0000001052170554_p139411279498"></a><a name="en-us_topic_0000001052170554_p139411279498"></a>void RemoveSurface(OHOS::AGP::UISurface&amp; surface);</p>
240e41f4b71Sopenharmony_ci</td>
241e41f4b71Sopenharmony_ci<td class="cellrowborder" valign="top" width="34.65346534653466%" headers="mcps1.2.4.1.3 "><p id="en-us_topic_0000001052170554_p39415717494"><a name="en-us_topic_0000001052170554_p39415717494"></a><a name="en-us_topic_0000001052170554_p39415717494"></a>Removes a surface.</p>
242e41f4b71Sopenharmony_ci</td>
243e41f4b71Sopenharmony_ci</tr>
244e41f4b71Sopenharmony_ci</tbody>
245e41f4b71Sopenharmony_ci</table>
246e41f4b71Sopenharmony_ci
247e41f4b71Sopenharmony_ci## Limitations and Constraints<a name="en-us_topic_0000001052170554_section1165911177314"></a>
248e41f4b71Sopenharmony_ci
249e41f4b71Sopenharmony_ciNone
250e41f4b71Sopenharmony_ci
251e41f4b71Sopenharmony_ci## How to Develop<a name="en-us_topic_0000001052170554_section138543918214"></a>
252e41f4b71Sopenharmony_ci
253e41f4b71Sopenharmony_ci1.  Extend the  **CameraDeviceCallback**  class and call  **OnCameraStatus**  to customize operations when the camera device changes, for example, when a camera becomes available or unavailable.
254e41f4b71Sopenharmony_ci
255e41f4b71Sopenharmony_ci    ```
256e41f4b71Sopenharmony_ci    class SampleCameraDeviceCallback : public CameraDeviceCallback {
257e41f4b71Sopenharmony_ci        void OnCameraStatus(std::string cameraId, int32_t status) override
258e41f4b71Sopenharmony_ci        {
259e41f4b71Sopenharmony_ci            // Do something when camera is available or unavailable.
260e41f4b71Sopenharmony_ci        }
261e41f4b71Sopenharmony_ci    };
262e41f4b71Sopenharmony_ci    ```
263e41f4b71Sopenharmony_ci
264e41f4b71Sopenharmony_ci2.  Extend the  **FrameStateCallback**  class. After obtaining the frame data, save the data as a file.
265e41f4b71Sopenharmony_ci
266e41f4b71Sopenharmony_ci    ```
267e41f4b71Sopenharmony_ci    static void SampleSaveCapture(const char *p, uint32_t size)
268e41f4b71Sopenharmony_ci    {
269e41f4b71Sopenharmony_ci        cout << "Start saving picture" << endl;
270e41f4b71Sopenharmony_ci        struct timeval tv;
271e41f4b71Sopenharmony_ci        gettimeofday(&tv, NULL);
272e41f4b71Sopenharmony_ci        struct tm *ltm = localtime(&tv.tv_sec);
273e41f4b71Sopenharmony_ci        if (ltm != nullptr) {
274e41f4b71Sopenharmony_ci            ostringstream ss("Capture_");
275e41f4b71Sopenharmony_ci            ss << "Capture" << ltm->tm_hour << "-" << ltm->tm_min << "-" << ltm->tm_sec << ".jpg";
276e41f4b71Sopenharmony_ci    
277e41f4b71Sopenharmony_ci            ofstream pic("/sdcard/" + ss.str(), ofstream::out | ofstream::trunc);
278e41f4b71Sopenharmony_ci            cout << "write " << size << " bytes" << endl;
279e41f4b71Sopenharmony_ci            pic.write(p, size);
280e41f4b71Sopenharmony_ci            cout << "Saving picture end" << endl;
281e41f4b71Sopenharmony_ci        }
282e41f4b71Sopenharmony_ci    }
283e41f4b71Sopenharmony_ci    
284e41f4b71Sopenharmony_ci    class TestFrameStateCallback : public FrameStateCallback {
285e41f4b71Sopenharmony_ci        void OnFrameFinished(Camera &camera, FrameConfig &fc, FrameResult &result) override
286e41f4b71Sopenharmony_ci        {
287e41f4b71Sopenharmony_ci            cout << "Receive frame complete inform." << endl;
288e41f4b71Sopenharmony_ci            if (fc.GetFrameConfigType() == FRAME_CONFIG_CAPTURE) {
289e41f4b71Sopenharmony_ci                cout << "Capture frame received." << endl;
290e41f4b71Sopenharmony_ci                list<Surface *> surfaceList = fc.GetSurfaces();
291e41f4b71Sopenharmony_ci                for (Surface *surface : surfaceList) {
292e41f4b71Sopenharmony_ci                    SurfaceBuffer *buffer = surface->AcquireBuffer();
293e41f4b71Sopenharmony_ci                    if (buffer != nullptr) {
294e41f4b71Sopenharmony_ci                        char *virtAddr = static_cast<char *>(buffer->GetVirAddr());
295e41f4b71Sopenharmony_ci                        if (virtAddr != nullptr) {
296e41f4b71Sopenharmony_ci                            SampleSaveCapture(virtAddr, buffer->GetSize());
297e41f4b71Sopenharmony_ci                        }
298e41f4b71Sopenharmony_ci                        surface->ReleaseBuffer(buffer);
299e41f4b71Sopenharmony_ci                    }
300e41f4b71Sopenharmony_ci                    delete surface;
301e41f4b71Sopenharmony_ci                }
302e41f4b71Sopenharmony_ci                delete &fc;
303e41f4b71Sopenharmony_ci            }
304e41f4b71Sopenharmony_ci        }
305e41f4b71Sopenharmony_ci    };
306e41f4b71Sopenharmony_ci    ```
307e41f4b71Sopenharmony_ci
308e41f4b71Sopenharmony_ci3.  Extend the  **CameraStateCallback**  class and customize operations when the camera state changes \(configuration successful or failed, and creation successful or failed\).
309e41f4b71Sopenharmony_ci
310e41f4b71Sopenharmony_ci    ```
311e41f4b71Sopenharmony_ci    class SampleCameraStateMng : public CameraStateCallback {
312e41f4b71Sopenharmony_ci    public:
313e41f4b71Sopenharmony_ci        SampleCameraStateMng() = delete;
314e41f4b71Sopenharmony_ci        SampleCameraStateMng(EventHandler &eventHdlr) : eventHdlr_(eventHdlr) {}
315e41f4b71Sopenharmony_ci        ~SampleCameraStateMng()
316e41f4b71Sopenharmony_ci        {
317e41f4b71Sopenharmony_ci            if (recordFd_ != -1) {
318e41f4b71Sopenharmony_ci                close(recordFd_);
319e41f4b71Sopenharmony_ci            }
320e41f4b71Sopenharmony_ci        }
321e41f4b71Sopenharmony_ci        void OnCreated(Camera &c) override
322e41f4b71Sopenharmony_ci        {
323e41f4b71Sopenharmony_ci            cout << "Sample recv OnCreate camera." << endl;
324e41f4b71Sopenharmony_ci            auto config = CameraConfig::CreateCameraConfig();
325e41f4b71Sopenharmony_ci            config->SetFrameStateCallback(&fsCb_, &eventHdlr_);
326e41f4b71Sopenharmony_ci            c.Configure(*config);
327e41f4b71Sopenharmony_ci            cam_ = &c;
328e41f4b71Sopenharmony_ci        }
329e41f4b71Sopenharmony_ci        void OnCreateFailed(const std::string cameraId, int32_t errorCode) override {}
330e41f4b71Sopenharmony_ci        void OnReleased(Camera &c) override {}
331e41f4b71Sopenharmony_ci    };
332e41f4b71Sopenharmony_ci    ```
333e41f4b71Sopenharmony_ci
334e41f4b71Sopenharmony_ci4.  Create a  **CameraKit**  instance to set and obtain camera information.
335e41f4b71Sopenharmony_ci
336e41f4b71Sopenharmony_ci    ```
337e41f4b71Sopenharmony_ci    CameraKit *camKit = CameraKit::GetInstance();
338e41f4b71Sopenharmony_ci    list<string> camList = camKit->GetCameraIds();
339e41f4b71Sopenharmony_ci    string camId;
340e41f4b71Sopenharmony_ci    for (auto &cam : camList) {
341e41f4b71Sopenharmony_ci        cout << "camera name:" << cam << endl;
342e41f4b71Sopenharmony_ci        const CameraAbility *ability = camKit->GetCameraAbility(cam);
343e41f4b71Sopenharmony_ci        /* Find the camera that fits your ability. */
344e41f4b71Sopenharmony_ci        list<CameraPicSize> sizeList = ability->GetSupportedSizes(0);
345e41f4b71Sopenharmony_ci        if (find(sizeList.begin(), sizeList.end(), CAM_PIC_1080P) != sizeList.end()) {
346e41f4b71Sopenharmony_ci            camId = cam;
347e41f4b71Sopenharmony_ci            break;
348e41f4b71Sopenharmony_ci        }
349e41f4b71Sopenharmony_ci    }
350e41f4b71Sopenharmony_ci    ```
351e41f4b71Sopenharmony_ci
352e41f4b71Sopenharmony_ci5.  Create a  **Camera**  instance.
353e41f4b71Sopenharmony_ci
354e41f4b71Sopenharmony_ci    ```
355e41f4b71Sopenharmony_ci    EventHandler eventHdlr; // Create a thread to handle callback events.
356e41f4b71Sopenharmony_ci    SampleCameraStateMng CamStateMng(eventHdlr);
357e41f4b71Sopenharmony_ci    
358e41f4b71Sopenharmony_ci    camKit->CreateCamera(camId, CamStateMng, eventHdlr);
359e41f4b71Sopenharmony_ci    ```
360e41f4b71Sopenharmony_ci
361e41f4b71Sopenharmony_ci6.  Based on the callback design in steps 1 to 3, perform related operations until the  **OnCreated**  callback obtains  **cam\_**.
362e41f4b71Sopenharmony_ci
363e41f4b71Sopenharmony_ci    ```
364e41f4b71Sopenharmony_ci    void OnCreated(Camera &c) override
365e41f4b71Sopenharmony_ci    {
366e41f4b71Sopenharmony_ci        cout << "Sample recv OnCreate camera." << endl;
367e41f4b71Sopenharmony_ci        auto config = CameraConfig::CreateCameraConfig();
368e41f4b71Sopenharmony_ci        config->SetFrameStateCallback(&fsCb_, &eventHdlr_);
369e41f4b71Sopenharmony_ci        c.Configure(*config);
370e41f4b71Sopenharmony_ci        cam_ = &c;
371e41f4b71Sopenharmony_ci    }
372e41f4b71Sopenharmony_ci    
373e41f4b71Sopenharmony_ci    void Capture()
374e41f4b71Sopenharmony_ci    {
375e41f4b71Sopenharmony_ci        if (cam_ == nullptr) {
376e41f4b71Sopenharmony_ci            cout << "Camera is not ready." << endl;
377e41f4b71Sopenharmony_ci            return;
378e41f4b71Sopenharmony_ci        }
379e41f4b71Sopenharmony_ci        FrameConfig *fc = new FrameConfig(FRAME_CONFIG_CAPTURE);
380e41f4b71Sopenharmony_ci        Surface *surface = Surface::CreateSurface();
381e41f4b71Sopenharmony_ci        if (surface == nullptr) {
382e41f4b71Sopenharmony_ci            delete fc;
383e41f4b71Sopenharmony_ci            return;
384e41f4b71Sopenharmony_ci        }
385e41f4b71Sopenharmony_ci        surface->SetWidthAndHeight(1920, 1080); /* 1920:width,1080:height */
386e41f4b71Sopenharmony_ci        fc->AddSurface(*surface);
387e41f4b71Sopenharmony_ci        cam_->TriggerSingleCapture(*fc);
388e41f4b71Sopenharmony_ci    }
389e41f4b71Sopenharmony_ci    ```
390e41f4b71Sopenharmony_ci
391e41f4b71Sopenharmony_ci
392