Example

Dependencies:   FXAS21002 FXOS8700Q

Committer:
maygup01
Date:
Tue Nov 19 09:49:38 2019 +0000
Revision:
0:11cc2b7889af
Example

Who changed what in which revision?

UserRevisionLine numberNew contents of line
maygup01 0:11cc2b7889af 1 /*
maygup01 0:11cc2b7889af 2 * Copyright (c) 2015 ARM Limited. All rights reserved.
maygup01 0:11cc2b7889af 3 * SPDX-License-Identifier: Apache-2.0
maygup01 0:11cc2b7889af 4 * Licensed under the Apache License, Version 2.0 (the License); you may
maygup01 0:11cc2b7889af 5 * not use this file except in compliance with the License.
maygup01 0:11cc2b7889af 6 * You may obtain a copy of the License at
maygup01 0:11cc2b7889af 7 *
maygup01 0:11cc2b7889af 8 * http://www.apache.org/licenses/LICENSE-2.0
maygup01 0:11cc2b7889af 9 *
maygup01 0:11cc2b7889af 10 * Unless required by applicable law or agreed to in writing, software
maygup01 0:11cc2b7889af 11 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
maygup01 0:11cc2b7889af 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
maygup01 0:11cc2b7889af 13 * See the License for the specific language governing permissions and
maygup01 0:11cc2b7889af 14 * limitations under the License.
maygup01 0:11cc2b7889af 15 */
maygup01 0:11cc2b7889af 16 #include "mbed-client/m2mtimer.h"
maygup01 0:11cc2b7889af 17 #include "mbed-client/m2mtimerobserver.h"
maygup01 0:11cc2b7889af 18 #include "mbed-client-classic/m2mtimerpimpl.h"
maygup01 0:11cc2b7889af 19
maygup01 0:11cc2b7889af 20
maygup01 0:11cc2b7889af 21 M2MTimer::M2MTimer(M2MTimerObserver& observer)
maygup01 0:11cc2b7889af 22 : _observer(observer)
maygup01 0:11cc2b7889af 23 {
maygup01 0:11cc2b7889af 24 _private_impl = new M2MTimerPimpl(observer);
maygup01 0:11cc2b7889af 25 }
maygup01 0:11cc2b7889af 26
maygup01 0:11cc2b7889af 27 M2MTimer::~M2MTimer()
maygup01 0:11cc2b7889af 28 {
maygup01 0:11cc2b7889af 29 delete _private_impl;
maygup01 0:11cc2b7889af 30 //_private_impl = NULL;
maygup01 0:11cc2b7889af 31 }
maygup01 0:11cc2b7889af 32
maygup01 0:11cc2b7889af 33 void M2MTimer::start_timer( uint64_t interval,
maygup01 0:11cc2b7889af 34 M2MTimerObserver::Type type,
maygup01 0:11cc2b7889af 35 bool single_shot)
maygup01 0:11cc2b7889af 36 {
maygup01 0:11cc2b7889af 37 _private_impl->start_timer(interval,
maygup01 0:11cc2b7889af 38 type,
maygup01 0:11cc2b7889af 39 single_shot);
maygup01 0:11cc2b7889af 40 }
maygup01 0:11cc2b7889af 41
maygup01 0:11cc2b7889af 42 void M2MTimer::start_dtls_timer(uint64_t intermediate_interval, uint64_t total_interval, M2MTimerObserver::Type type){
maygup01 0:11cc2b7889af 43 _private_impl->start_dtls_timer(intermediate_interval, total_interval, type);
maygup01 0:11cc2b7889af 44 }
maygup01 0:11cc2b7889af 45
maygup01 0:11cc2b7889af 46 void M2MTimer::stop_timer()
maygup01 0:11cc2b7889af 47 {
maygup01 0:11cc2b7889af 48 _private_impl->stop_timer();
maygup01 0:11cc2b7889af 49 }
maygup01 0:11cc2b7889af 50
maygup01 0:11cc2b7889af 51 bool M2MTimer::is_intermediate_interval_passed(){
maygup01 0:11cc2b7889af 52 return _private_impl->is_intermediate_interval_passed();
maygup01 0:11cc2b7889af 53 }
maygup01 0:11cc2b7889af 54
maygup01 0:11cc2b7889af 55 bool M2MTimer::is_total_interval_passed(){
maygup01 0:11cc2b7889af 56 return _private_impl->is_total_interval_passed();
maygup01 0:11cc2b7889af 57 }