Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
SigningEventMonitor.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2017-2017 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef MBED_BLE_SIGNING_EVENT_MONITOR 00018 #define MBED_BLE_SIGNING_EVENT_MONITOR 00019 00020 #include "ble/common/StaticInterface.h" 00021 #include "ble/BLETypes.h" 00022 00023 namespace ble { 00024 namespace pal { 00025 00026 /** 00027 * Implemented by classes that are reacting to signing events. 00028 */ 00029 template<class Impl> 00030 class SigningMonitorEventHandler : public StaticInterface<Impl, SigningMonitorEventHandler> { 00031 00032 using StaticInterface<Impl, ble::pal::SigningMonitorEventHandler>::impl; 00033 00034 public: 00035 /** 00036 * Set new signed write peer counter. 00037 * 00038 * @param[in] connection connection handle 00039 * @param[in] sign_coutner counter received from peer 00040 */ 00041 void on_signed_write_received( 00042 connection_handle_t connection, 00043 uint32_t sign_coutner 00044 ) { 00045 impl ()->on_signed_write_received_( 00046 connection, 00047 sign_coutner 00048 ); 00049 } 00050 00051 /** 00052 * Indicate that signed data was rejected due to verification failure. This could 00053 * be due to an invalid CSRK key. 00054 * 00055 * @param[in] connection connection handle 00056 */ 00057 void on_signed_write_verification_failure( 00058 connection_handle_t connection 00059 ) { 00060 impl ()->on_signed_write_verification_failure_(connection); 00061 } 00062 00063 /** 00064 * Notify a new signed write cmd was executed. 00065 */ 00066 void on_signed_write() { 00067 impl ()->on_signed_write_(); 00068 } 00069 }; 00070 00071 00072 00073 /** 00074 * Implemented by classes that need to be notified of signing events. 00075 * Notification is done by calling functions in the passed in event handler 00076 */ 00077 template<class Impl, class EventHandler> 00078 class SigningEventMonitor { 00079 Impl* impl() { 00080 return static_cast<Impl*>(this); 00081 } 00082 00083 public: 00084 /** 00085 * Register a handler for singing events to be used internally and serviced first. 00086 * 00087 * @param[in] signing_event_handler Event handler being registered. 00088 */ 00089 void set_signing_event_handler(EventHandler *signing_event_handler) 00090 { 00091 impl()->set_signing_event_handler_(signing_event_handler); 00092 } 00093 }; 00094 00095 } // namespace pal 00096 } // namespace ble 00097 00098 #endif /* MBED_BLE_SIGNING_EVENT_MONITOR */
Generated on Tue Jul 12 2022 13:54:50 by
