changing interface for sync handshake
authorVolker Birk <vb@pep-project.org>
Wed, 07 Dec 2016 20:53:29 +0100
changeset 2275bc3d8cb9415
parent 226 65eda155bc69
child 228 3419c95178c0
changing interface for sync handshake
CpEpEngine.cpp
CpEpEngine.h
pEpCOMServerAdapter.idl
     1.1 --- a/CpEpEngine.cpp	Tue Dec 06 14:53:54 2016 +0100
     1.2 +++ b/CpEpEngine.cpp	Wed Dec 07 20:53:29 2016 +0100
     1.3 @@ -410,7 +410,7 @@
     1.4  	// DEBUG CODE - REMOVE BEFORE RELEASE!
     1.5  	// SyncHandshakeResult handshakeResult;
     1.6  	//
     1.7 -	// HRESULT res = Fire_ShowHandshake(ident, result, &handshakeResult);
     1.8 +	// HRESULT res = Fire_NotifyHandshake(ident, result, signal, &handshakeResult);
     1.9  	// 
    1.10  	// HRESULT res2 = Fire_TestEvent(15, _bstr_t( "hallo"));
    1.11  
    1.12 @@ -619,7 +619,7 @@
    1.13  	return PEP_STATUS_OK;
    1.14  }
    1.15  
    1.16 -PEP_STATUS CpEpEngine::showHandshake(void * obj, pEp_identity *self, pEp_identity *partner)
    1.17 +PEP_STATUS CpEpEngine::notifyHandshake(void * obj, pEp_identity *self, pEp_identity *partner, sync_handshake_signal signal)
    1.18  {
    1.19  	assert(self && partner);
    1.20  	if (!(self && partner))
    1.21 @@ -631,7 +631,7 @@
    1.22  	copy_identity(&_partner, partner);
    1.23  	CpEpEngine *me = (CpEpEngine *)obj;
    1.24  	SyncHandshakeResult _result;
    1.25 -	HRESULT r = me->Fire_ShowHandshake(&_self, &_partner, &_result);
    1.26 +	HRESULT r = me->Fire_NotifyHandshake(&_self, &_partner, (SyncHandshakeSignal)(int)signal, &_result);
    1.27  	assert(r == S_OK);
    1.28  	clear_identity_s(_self);
    1.29  	clear_identity_s(_partner);
    1.30 @@ -1013,7 +1013,7 @@
    1.31  
    1.32  	// Init our keysync session
    1.33  	PEP_STATUS status = ::init(&keysync_session);
    1.34 -	::register_sync_callbacks(keysync_session, (void*)this, messageToSend, showHandshake, inject_sync_msg, retrieve_next_sync_msg);
    1.35 +	::register_sync_callbacks(keysync_session, (void*)this, messageToSend, notifyHandshake, inject_sync_msg, retrieve_next_sync_msg);
    1.36  	assert(status == PEP_STATUS_OK);
    1.37  
    1.38      attach_sync_session(get_session(), keysync_session);
    1.39 @@ -1116,7 +1116,7 @@
    1.40      return S_OK;
    1.41  }
    1.42  
    1.43 -void * CpEpEngine::retrieve_next_sync_msg(void * management)
    1.44 +void * CpEpEngine::retrieve_next_sync_msg(void * management, time_t *timeout)
    1.45  {
    1.46  	// sanity check
    1.47  	assert(management);
    1.48 @@ -1244,7 +1244,7 @@
    1.49  	return result;
    1.50  }
    1.51  
    1.52 -HRESULT CpEpEngine::Fire_ShowHandshake(pEpIdentity * self, pEpIdentity * partner, SyncHandshakeResult * result)
    1.53 +HRESULT CpEpEngine::Fire_NotifyHandshake(pEpIdentity * self, pEpIdentity * partner, SyncHandshakeSignal signal, SyncHandshakeResult * result)
    1.54  {
    1.55  	assert(self);
    1.56  	assert(partner);
    1.57 @@ -1256,7 +1256,7 @@
    1.58  	if (!this->client_callbacks_on_sync_thread)
    1.59  		return E_ILLEGAL_METHOD_CALL;
    1.60      	
    1.61 -	auto res = this->client_callbacks_on_sync_thread->ShowHandshake(self, partner, result);
    1.62 +	auto res = this->client_callbacks_on_sync_thread->NotifyHandshake(self, partner, signal, result);
    1.63  		
    1.64  	return res;	
    1.65  }
     2.1 --- a/CpEpEngine.h	Tue Dec 06 14:53:54 2016 +0100
     2.2 +++ b/CpEpEngine.h	Wed Dec 07 20:53:29 2016 +0100
     2.3 @@ -103,7 +103,7 @@
     2.4      typedef locked_queue<pEp_identity_cpp> identity_queue_t;
     2.5      static ::pEp_identity * retrieve_next_identity(void *management);
     2.6      static PEP_STATUS messageToSend(void * obj, message *msg);
     2.7 -    static PEP_STATUS showHandshake(void * obj, pEp_identity *self, pEp_identity *partner);
     2.8 +    static PEP_STATUS notifyHandshake(void * obj, pEp_identity *self, pEp_identity *partner, sync_handshake_signal signal);
     2.9  
    2.10  
    2.11      HRESULT error(_bstr_t msg);
    2.12 @@ -130,7 +130,7 @@
    2.13  
    2.14  	// Keysync members
    2.15      static int inject_sync_msg(void *msg, void* management);
    2.16 -    static void* retrieve_next_sync_msg(void* management);
    2.17 +    static void* retrieve_next_sync_msg(void* management, time_t *timeout);
    2.18      void start_keysync();
    2.19      static void do_keysync_in_thread(CpEpEngine* self, LPSTREAM marshaled_callbacks);
    2.20      void stop_keysync();
    2.21 @@ -203,9 +203,10 @@
    2.22  	HRESULT Fire_MessageToSend(
    2.23  		/* [in] */ struct TextMessage *msg);
    2.24  
    2.25 -	HRESULT Fire_ShowHandshake(
    2.26 +	HRESULT Fire_NotifyHandshake(
    2.27  		/* [in] */ struct pEpIdentity *self,
    2.28  		/* [in] */ struct pEpIdentity *partner,
    2.29 +		/* [in] */ SyncHandshakeSignal signal,
    2.30  		/* [retval][out] */ SyncHandshakeResult *result);
    2.31  };
    2.32  
     3.1 --- a/pEpCOMServerAdapter.idl	Tue Dec 06 14:53:54 2016 +0100
     3.2 +++ b/pEpCOMServerAdapter.idl	Wed Dec 07 20:53:29 2016 +0100
     3.3 @@ -15,6 +15,14 @@
     3.4      pointer_default(unique)
     3.5  ]
     3.6  interface IpEpEngineCallbacks : IUnknown {
     3.7 +	typedef [v1_enum] enum SyncHandshakeSignal {
     3.8 +		SyncHandshakeDismissDialog = 0,
     3.9 +		SyncHandshakeShowDialog = 1,
    3.10 +		SyncHandshakeSuccess = 2,
    3.11 +		SyncHandshakeFailure = 3,
    3.12 +		SyncDeviceAdded = 4,
    3.13 +		SyncGroupCreated = 5
    3.14 +	} SyncHandshakeSignal;
    3.15  
    3.16      typedef [v1_enum] enum SyncHandshakeResult {
    3.17          SyncHandshakeCancel = -1,
    3.18 @@ -23,7 +31,7 @@
    3.19      } SyncHandshakeResult;
    3.20  
    3.21      [id(1)] HRESULT MessageToSend([in] struct TextMessage * msg);
    3.22 -    [id(2)] HRESULT ShowHandshake([in] struct pEpIdentity * self, [in] struct pEpIdentity * partner, [out, retval] SyncHandshakeResult * result);
    3.23 +    [id(2)] HRESULT NotifyHandshake([in] struct pEpIdentity * self, [in] struct pEpIdentity * partner, [in] SyncHandshakeSignal signal, [out, retval] SyncHandshakeResult * result);
    3.24  };
    3.25  
    3.26