takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SigningEventMonitor.h Source File

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/BLETypes.h"
00021 
00022 namespace ble {
00023 namespace pal {
00024 
00025 /**
00026  * Implemented by classes that need to be notified of signing events.
00027  * Notification is done by calling functions in the passed in event handler
00028  */
00029 class SigningEventMonitor {
00030 public:
00031     /**
00032      * Implemented by classes that are reacting to signing events.
00033      */
00034     class EventHandler {
00035     public:
00036         /**
00037          * Set new signed write peer counter.
00038          *
00039          * @param[in] connection connection handle
00040          * @param[in] sign_coutner counter received from peer
00041          */
00042         virtual void on_signed_write_received(
00043             connection_handle_t connection,
00044             uint32_t sign_coutner
00045         ) = 0;
00046 
00047         /**
00048          * Indicate that signed data was rejected due to verification failure. This could
00049          * be due to an invalid CSRK key.
00050          *
00051          * @param[in] connection connection handle
00052          */
00053         virtual void on_signed_write_verification_failure(
00054             connection_handle_t connection
00055         ) = 0;
00056 
00057         /**
00058          * Notify a new signed write cmd was executed.
00059          */
00060         virtual void on_signed_write() = 0;
00061     };
00062 
00063     /**
00064      * Register a handler for singing events to be used internally and serviced first.
00065      *
00066      * @param[in] signing_event_handler Event handler being registered.
00067      */
00068     virtual void set_signing_event_handler(EventHandler *signing_event_handler) = 0;
00069 };
00070 
00071 } // namespace pal
00072 } // namespace ble
00073 
00074 #endif /* MBED_BLE_SIGNING_EVENT_MONITOR */