xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/aiq_core/MessageBus.cpp (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * rkisp_aiq_core.h
3  *
4  *  Copyright (c) 2019 Rockchip Corporation
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19 #include "MessageBus.h"
20 #include "RkAiqCore.h"
21 
22 namespace RkCam {
23 
24 bool
loop()25 MessageThread::loop()
26 {
27     const static int32_t msg_time_out = -1; //wait until wakeup
28     SmartPtr<XCamMessage> msg = mMsgQueue.pop (msg_time_out);
29 
30     if (!msg.ptr ()) {
31         LOGW_ANALYZER("MessageThread got empty message, stop thread");
32         return  false;
33     }
34 
35     XCamReturn ret = mRkAiqCore->handle_message (msg);
36     if (ret == XCAM_RETURN_NO_ERROR || ret == XCAM_RETURN_ERROR_TIMEOUT)
37         return true;
38 
39     return false;
40 }
41 
42 }
43