[dali_2.3.24] Merge branch 'devel/master'
[platform/core/uifw/dali-adaptor.git] / dali / internal / system / windows / trigger-event.h
1 #ifndef DALI_INTERNAL_TRIGGER_EVENT_IMPL_H
2 #define DALI_INTERNAL_TRIGGER_EVENT_IMPL_H
3
4 /*
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/signals/callback.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/integration-api/adaptor-framework/trigger-event-interface.h>
26 #include <dali/public-api/dali-adaptor-common.h>
27
28 namespace Dali
29 {
30 namespace Internal
31 {
32 namespace Adaptor
33 {
34 class TriggerEvent : public TriggerEventInterface
35 {
36 public:
37   /**
38    * Constructor
39    * Creates an event file descriptor and starts a GSource which reads from the file
40    * descriptor when there is data.
41    *
42    * @param[in] callback The callback to call
43    * @param[in] options Trigger event options.
44    * @note The ownership of callback is taken by this class.
45    */
46   TriggerEvent(CallbackBase* callback, TriggerEventInterface::Options options);
47
48   /**
49    * Destructor
50    */
51   ~TriggerEvent();
52
53 public:
54   /**
55    * Triggers the event.
56    *
57    * This can be called from one thread in order to wake up another thread.
58    */
59   void Trigger();
60
61 private:
62   /**
63    * @brief Called when our event file descriptor has been written to.
64    * @param[in] eventBitMask bit mask of events that occured on the file descriptor
65    */
66   void Triggered();
67
68 private:
69   CallbackBase*                  mCallback;
70   CallbackBase*                  mSelfCallback;
71   int32_t                        mThreadID;
72   TriggerEventInterface::Options mOptions;
73 };
74
75 } // namespace Adaptor
76
77 } // namespace Internal
78
79 } // namespace Dali
80
81 #endif // DALI_INTERNAL_TRIGGER_EVENT_IMPL_H