Home | History | Annotate | Download | only in pairing
      1 // Copyright 2012 Google Inc. All Rights Reserved.
      2 //
      3 // Licensed under the Apache License, Version 2.0 (the "License");
      4 // you may not use this file except in compliance with the License.
      5 // You may obtain a copy of the License at
      6 //
      7 //     http://www.apache.org/licenses/LICENSE-2.0
      8 //
      9 // Unless required by applicable law or agreed to in writing, software
     10 // distributed under the License is distributed on an "AS IS" BASIS,
     11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 // See the License for the specific language governing permissions and
     13 // limitations under the License.
     14 
     15 #ifndef POLO_PAIRING_PAIRINGLISTENER_H_
     16 #define POLO_PAIRING_PAIRINGLISTENER_H_
     17 
     18 #include <string>
     19 #include "polo/pairing/polochallengeresponse.h"
     20 #include "polo/pairing/poloerror.h"
     21 
     22 namespace polo {
     23 namespace pairing {
     24 
     25 class PairingSession;
     26 
     27 // Listener for a pairing session.
     28 class PairingListener {
     29  public:
     30   virtual ~PairingListener() {}
     31 
     32   // Invoked when a pairing session has been created.
     33   virtual void OnSessionCreated() = 0;
     34 
     35   // Invoked when a pairing session has ended.
     36   virtual void OnSessionEnded() = 0;
     37 
     38   // Invoked when the output device role should be performed. The client should
     39   // display a decoded secret based on the given gamma value.
     40   virtual void OnPerformOutputDeviceRole(const Gamma& gamma) = 0;
     41 
     42   // Invoked when the input device role should be performed. The client should
     43   // prompt the user to enter the secret displayed on the output device.
     44   virtual void OnPerformInputDeviceRole() = 0;
     45 
     46   // Invoked when pairing has completed successfully.
     47   virtual void OnPairingSuccess() = 0;
     48 
     49   // Invoked when the pairing operation has been cancelled.
     50   virtual void OnPairingCancelled() = 0;
     51 
     52   // Invoked if there was an error during the pairing process.
     53   virtual void OnError(PoloError error) = 0;
     54 };
     55 
     56 }  // namespace pairing
     57 }  // namespace polo
     58 
     59 #endif  // POLO_PAIRING_PAIRINGLISTENER_H_
     60