Mistake on this page? Email us
m2mtimer.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 ARM Limited. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  * Licensed under the Apache License, Version 2.0 (the License); you may
5  * 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, WITHOUT
12  * 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 #ifndef M2M_TIMER_H
17 #define M2M_TIMER_H
18 
19 #include <stdint.h>
21 
22 class M2MTimerPimpl;
23 
28 class M2MTimer
29 {
30 private:
31  // Prevents the use of assignment operator
32  M2MTimer& operator=(const M2MTimer& other);
33 
34  // Prevents the use of copy constructor
35  M2MTimer(const M2MTimer& other);
36 
37 public:
38 
42  M2MTimer(M2MTimerObserver& observer);
43 
47  ~M2MTimer();
48 
54  void start_timer(uint64_t interval, M2MTimerObserver::Type type, bool single_shot = true);
55 
62  void start_dtls_timer(uint64_t intermediate_interval, uint64_t total_interval, M2MTimerObserver::Type type = M2MTimerObserver::Dtls);
63 
68  void stop_timer();
69 
75 
81 
82 private:
83 
84  M2MTimerObserver& _observer;
85  M2MTimerPimpl *_private_impl;
86  friend class Test_M2MTimerImpl_linux;
87 };
88 
89 #endif // M2M_TIMER_H
Definition: m2mtimer.h:28
Type
Definition: m2mtimerobserver.h:30
void stop_timer()
Stops the timer. This cancels the ongoing timer.
M2MTimerObserver. Observer class for indicating the timer expiry to the parent class.
bool is_total_interval_passed()
Checks if the total interval has passed.
Definition: m2mtimerobserver.h:23
void start_timer(uint64_t interval, M2MTimerObserver::Type type, bool single_shot=true)
Starts the timer.
bool is_intermediate_interval_passed()
Checks if the intermediate interval has passed.
void start_dtls_timer(uint64_t intermediate_interval, uint64_t total_interval, M2MTimerObserver::Type type=M2MTimerObserver::Dtls)
Starts the timer in DTLS manner.