protected internal override void onPeerAgentUpdated(SAPeerAgent peerAgent, int result)
 {
     if (result == PEER_AGENT_AVAILABLE)
     {
         authenticatePeerAgent(peerAgent);
     }
 }
Beispiel #2
0
 protected internal override void onServiceConnectionRequested(SAPeerAgent peerAgent)
 {
     if (peerAgent != null)
     {
         acceptServiceConnectionRequest(peerAgent);
     }
 }
 protected internal override void onAuthenticationResponse(SAPeerAgent peerAgent, SAAuthenticationToken authToken, int error)
 {
     /*
      * The authenticatePeerAgent(peerAgent) API may not be working properly depending on the firmware
      * version of accessory device. Please refer to another sample application for Security.
      */
 }
 protected override void OnServiceConnectionRequested(SAPeerAgent p0)
 {
     if (p0 != null)
     {
         AcceptServiceConnectionRequest(p0);
     }
 }
Beispiel #5
0
 protected internal override void onFindPeerAgentResponse(SAPeerAgent peerAgent, int result)
 {
     if (mConnection == null)
     {
         Log.d(TAG, "onFindPeerAgentResponse : mConnection is null");
     }
 }
 protected internal override void onAuthenticationResponse(SAPeerAgent peerAgent, SAAuthenticationToken authToken, int code)
 {
     if (code == SAAgent.AUTHENTICATION_SUCCESS && authToken.AuthenticationType == SAAuthenticationToken.AUTHENTICATION_TYPE_CERTIFICATE_X509)
     {
         requestServiceConnection(peerAgent);
     }
 }
 protected internal override void onServiceConnectionRequested(SAPeerAgent peerAgent)
 {
     if (peerAgent != null)
     {
         Toast.makeText(BaseContext, [email protected], Toast.LENGTH_SHORT).show();
         acceptServiceConnectionRequest(peerAgent);
     }
 }
Beispiel #8
0
 protected internal override void onServiceConnectionRequested(SAPeerAgent peerAgent)
 {
     if (peerAgent != null)
     {
         // Toast.makeText(getBaseContext(), R.string.ConnectionAcceptedMsg, Toast.LENGTH_SHORT).show();
         authenticatePeerAgent(peerAgent);
     }
 }
 protected internal override void onServiceConnectionResponse(SAPeerAgent peerAgent, SASocket socket, int result)
 {
     if (result == CONNECTION_SUCCESS)
     {             // SERVICE_CONNECTION_RESULT_OK
         this.mConnectionHandler = socket;
         // Toast.makeText(getBaseContext(), R.string.ConnectionEstablishedMsg, Toast.LENGTH_LONG).show();
         mImageListReceiverRegistered.onServiceConnectionResponse(result);
     }
 }
 public virtual bool establishConnection(SAPeerAgent peerAgent)
 {
     if (peerAgent != null)
     {
         requestServiceConnection(peerAgent);
         return(true);
     }
     return(false);
 }
 protected internal override void onFindPeerAgentResponse(SAPeerAgent peerAgent, int result)
 {
     if (result == PEER_AGENT_FOUND)
     {
         if (mImageListReceiverRegistered != null)
         {
             mImageListReceiverRegistered.onPeerFound(peerAgent);
         }
     }
 }
Beispiel #12
0
 protected internal override void onServiceConnectionResponse(SAPeerAgent peer, SASocket socket, int result)
 {
     Log.i(TAG, "onServiceConnectionResponse: result - " + result);
     if (result == SAAgent.CONNECTION_SUCCESS)
     {
         if (socket != null)
         {
             mConnection = (ServiceConnection)socket;
             Toast.makeText(BaseContext, "Connection established for FT", Toast.LENGTH_SHORT).show();
         }
     }
 }
 protected internal override void onFindPeerAgentResponse(SAPeerAgent peerAgent, int result)
 {
     if (peerAgent != null)
     {
         mPeerAgent = peerAgent;
     }
     else
     {
         Log.e(TAG, "No peer Aget found:" + result);
         Toast.makeText(BaseContext, "No peer agent found.", Toast.LENGTH_SHORT).show();
     }
 }
Beispiel #14
0
 protected internal override void onServiceConnectionResponse(SAPeerAgent peerAgent, SASocket socket, int result)
 {
     if (result == SAAgent.CONNECTION_SUCCESS)
     {
         if (socket != null)
         {
             mConnectionHandler = (ServiceConnection)socket;
         }
     }
     else if (result == SAAgent.CONNECTION_ALREADY_EXIST)
     {
         Log.e(TAG, "onServiceConnectionResponse, CONNECTION_ALREADY_EXIST");
     }
 }
 protected override void OnServiceConnectionResponse(SAPeerAgent p0, SASocket socket, int result)
 {
     if ((result == SAAgent.ConnectionSuccess))
     {
         if ((socket != null))
         {
             _mSocketServiceProvider = ((ProviderServiceSocket)(socket));
             _mSocketServiceProvider.Send(CHANNEL_ID, System.Text.Encoding.ASCII.GetBytes("Connected"));
         }
     }
     else if ((result == SAAgent.ConnectionAlreadyExist))
     {
         Android.Util.Log.Debug(TAG, "onServiceConnectionResponse, CONNECTION_ALREADY_EXIST");
     }
 }
        protected override void OnServiceConnectionResponse(SAPeerAgent p0, SASocket socket, int result)
        {
            // Cache(socket);
            if ((result == SAAgent.ConnectionSuccess))
            {
                if ((socket != null))
                {
                    mSocketServiceProvider = ((ProviderServiceSocket)(socket));
                    mSocketServiceProvider.Send(CHANNEL_ID, System.Text.Encoding.ASCII.GetBytes(Message));
                }
            }
            else if ((result == SAAgent.ConnectionAlreadyExist))
            {
#if DEBUG
                Console.WriteLine("onServiceConnectionResponse, CONNECTION_ALREADY_EXIST");
#endif
            }
        }
        protected internal override void onServiceConnectionResponse(SAPeerAgent peerAgent, SASocket socket, int result)
        {
            if (result == CONNECTION_SUCCESS && socket != null)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final GalleryProviderConnection myConnection = (GalleryProviderConnection) socket;
                GalleryProviderConnection myConnection = (GalleryProviderConnection)socket;
                if (mConnectionsMap == null)
                {
                    mConnectionsMap = new SparseArray <GalleryProviderConnection>();
                }
                myConnection.mConnectionId = (int)(DateTimeHelperClass.CurrentUnixTimeMillis() & 255);
                mConnectionsMap.put(myConnection.mConnectionId, myConnection);
                mBackgroundHandler.post(() =>
                {
                    Toast.makeText(BaseContext, [email protected], Toast.LENGTH_SHORT).show();
                });
            }
        }
 protected internal override void onServiceConnectionResponse(SAPeerAgent peerAgent, SASocket socket, int result)
 {
     Log.i(TAG, "onServiceConnectionResponse: result - " + result);
     if (socket == null)
     {
         if (result == SAAgent.CONNECTION_ALREADY_EXIST)
         {
             Toast.makeText(BaseContext, "CONNECTION_ALREADY_EXIST", Toast.LENGTH_SHORT).show();
         }
         else
         {
             Toast.makeText(BaseContext, "Connection could not be made. Please try again", Toast.LENGTH_SHORT).show();
         }
     }
     else
     {
         Toast.makeText(BaseContext, "Connection established for FT", Toast.LENGTH_SHORT).show();
     }
 }
Beispiel #19
0
 protected internal override void onFindPeerAgentResponse(SAPeerAgent peerAgent, int result)
 {
     if ((result == SAAgent.PEER_AGENT_FOUND) && (peerAgent != null))
     {
         requestServiceConnection(peerAgent);
     }
     else if (result == SAAgent.FINDPEER_DEVICE_NOT_CONNECTED)
     {
         Toast.makeText(ApplicationContext, "FINDPEER_DEVICE_NOT_CONNECTED", Toast.LENGTH_LONG).show();
         updateTextView("Disconnected");
     }
     else if (result == SAAgent.FINDPEER_SERVICE_NOT_FOUND)
     {
         Toast.makeText(ApplicationContext, "FINDPEER_SERVICE_NOT_FOUND", Toast.LENGTH_LONG).show();
         updateTextView("Disconnected");
     }
     else
     {
         Toast.makeText(ApplicationContext, [email protected], Toast.LENGTH_LONG).show();
     }
 }
Beispiel #20
0
 protected internal override void onServiceConnectionResponse(SAPeerAgent peerAgent, SASocket socket, int result)
 {
     if (result == SAAgent.CONNECTION_SUCCESS)
     {
         this.mConnectionHandler = (ServiceConnection)socket;
         updateTextView("Connected");
     }
     else if (result == SAAgent.CONNECTION_ALREADY_EXIST)
     {
         updateTextView("Connected");
         Toast.makeText(BaseContext, "CONNECTION_ALREADY_EXIST", Toast.LENGTH_LONG).show();
     }
     else if (result == SAAgent.CONNECTION_DUPLICATE_REQUEST)
     {
         Toast.makeText(BaseContext, "CONNECTION_DUPLICATE_REQUEST", Toast.LENGTH_LONG).show();
     }
     else
     {
         Toast.makeText(BaseContext, [email protected], Toast.LENGTH_LONG).show();
     }
 }
 protected internal override void onPeerAgentUpdated(SAPeerAgent peerAgent, int result)
 {
     Log.d(TAG, "Peer agent updated- result: " + result + " trId: " + trId);
     mPeerAgent = peerAgent;
     if (result == SAAgent.PEER_AGENT_UNAVAILABLE)
     {
         if (errCode != SAFileTransfer.ERROR_CONNECTION_LOST)
         {
             try
             {
                 cancelFileTransfer(trId);
             }
             catch (System.ArgumentException e)
             {
                 Console.WriteLine(e.ToString());
                 Console.Write(e.StackTrace);
                 Toast.makeText(BaseContext, "IllegalArgumentException", Toast.LENGTH_SHORT).show();
             }
         }
     }
 }
Beispiel #22
0
 protected internal override void onAuthenticationResponse(SAPeerAgent peerAgent, SAAuthenticationToken authToken, int code)
 {
     if (authToken.AuthenticationType == SAAuthenticationToken.AUTHENTICATION_TYPE_CERTIFICATE_X509)
     {
         mContext = ApplicationContext;
         sbyte[] myAppKey = getApplicationCertificate(mContext);
         if (authToken.Key != null)
         {
             bool matched = true;
             if (authToken.Key.length != myAppKey.Length)
             {
                 matched = false;
             }
             else
             {
                 for (int i = 0; i < authToken.Key.length; i++)
                 {
                     if (authToken.Key[i] != myAppKey[i])
                     {
                         matched = false;
                     }
                 }
             }
             if (matched)
             {
                 Log.d(TAG, "onAuthenticationResponse : authentication is matched");
                 acceptServiceConnectionRequest(peerAgent);
                 mHandler.post(() =>
                 {
                     Toast.makeText(BaseContext, [email protected], Toast.LENGTH_SHORT).show();
                 });
             }
         }
     }
     else if (authToken.AuthenticationType == SAAuthenticationToken.AUTHENTICATION_TYPE_NONE)
     {
         Log.e(TAG, "onAuthenticationResponse : CERT_TYPE(NONE)");
     }
 }
Beispiel #23
0
        protected internal override void onPeerAgentUpdated(SAPeerAgent peerAgent, int result)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final SAPeerAgent peer = peerAgent;
            SAPeerAgent peer = peerAgent;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int status = result;
            int status = result;

            mHandler.post(() =>
            {
                if (peer != null)
                {
                    if (status == SAAgent.PEER_AGENT_AVAILABLE)
                    {
                        Toast.makeText(ApplicationContext, "PEER_AGENT_AVAILABLE", Toast.LENGTH_LONG).show();
                    }
                    else
                    {
                        Toast.makeText(ApplicationContext, "PEER_AGENT_UNAVAILABLE", Toast.LENGTH_LONG).show();
                    }
                }
            });
        }
		protected internal override void onAuthenticationResponse(SAPeerAgent peerAgent, SAAuthenticationToken authToken, int error)
		{
			/*
			 * The authenticatePeerAgent(peerAgent) API may not be working properly depending on the firmware
			 * version of accessory device. Please refer to another sample application for Security.
			 */
		}
 protected internal override void onFindPeerAgentResponse(SAPeerAgent peerAgent, int result)
 {
 }
		protected internal override void onServiceConnectionResponse(SAPeerAgent peerAgent, SASocket socket, int result)
		{
			if (result == CONNECTION_SUCCESS && socket != null)
			{
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final GalleryProviderConnection myConnection = (GalleryProviderConnection) socket;
				GalleryProviderConnection myConnection = (GalleryProviderConnection) socket;
				if (mConnectionsMap == null)
				{
					mConnectionsMap = new SparseArray<GalleryProviderConnection>();
				}
				myConnection.mConnectionId = (int)(DateTimeHelperClass.CurrentUnixTimeMillis() & 255);
				mConnectionsMap.put(myConnection.mConnectionId, myConnection);
				mBackgroundHandler.post(() =>
				{
					Toast.makeText(BaseContext, [email protected], Toast.LENGTH_SHORT).show();
				});
			}
		}
		protected internal override void onFindPeerAgentResponse(SAPeerAgent peerAgent, int result)
		{
			if (peerAgent != null)
			{
				mPeerAgent = peerAgent;
			}
			else
			{
				Log.e(TAG, "No peer Aget found:" + result);
				Toast.makeText(BaseContext, "No peer agent found.", Toast.LENGTH_SHORT).show();
			}
		}
 protected internal override void onError(SAPeerAgent peerAgent, string error, int errorCode)
 {
 }
Beispiel #29
0
 protected internal override void onFindPeerAgentResponse(SAPeerAgent peerAgent, int result)
 {
     Log.d(TAG, "onFindPeerAgentResponse : result =" + result);
 }
		protected internal override void onAuthenticationResponse(SAPeerAgent peerAgent, SAAuthenticationToken authToken, int code)
		{
			if (code == SAAgent.AUTHENTICATION_SUCCESS && authToken.AuthenticationType == SAAuthenticationToken.AUTHENTICATION_TYPE_CERTIFICATE_X509)
			{
				requestServiceConnection(peerAgent);
			}
		}
		protected internal override void onServiceConnectionResponse(SAPeerAgent peerAgent, SASocket socket, int result)
		{
			if (result == SAAgent.CONNECTION_SUCCESS)
			{
				this.mConnectionHandler = (ServiceConnection) socket;
				updateTextView("Connected");
			}
			else if (result == SAAgent.CONNECTION_ALREADY_EXIST)
			{
				updateTextView("Connected");
				Toast.makeText(BaseContext, "CONNECTION_ALREADY_EXIST", Toast.LENGTH_LONG).show();
			}
			else if (result == SAAgent.CONNECTION_DUPLICATE_REQUEST)
			{
				Toast.makeText(BaseContext, "CONNECTION_DUPLICATE_REQUEST", Toast.LENGTH_LONG).show();
			}
			else
			{
				Toast.makeText(BaseContext, [email protected], Toast.LENGTH_LONG).show();
			}
		}
		protected internal override void onServiceConnectionRequested(SAPeerAgent peerAgent)
		{
			if (peerAgent != null)
			{
				acceptServiceConnectionRequest(peerAgent);
			}
		}
		protected internal override void onAuthenticationResponse(SAPeerAgent peerAgent, SAAuthenticationToken authToken, int code)
		{
			if (authToken.AuthenticationType == SAAuthenticationToken.AUTHENTICATION_TYPE_CERTIFICATE_X509)
			{
				mContext = ApplicationContext;
				sbyte[] myAppKey = getApplicationCertificate(mContext);
				if (authToken.Key != null)
				{
					bool matched = true;
					if (authToken.Key.length != myAppKey.Length)
					{
						matched = false;
					}
					else
					{
						for (int i = 0; i < authToken.Key.length; i++)
						{
							if (authToken.Key[i] != myAppKey[i])
							{
								matched = false;
							}
						}
					}
					if (matched)
					{
						Log.d(TAG, "onAuthenticationResponse : authentication is matched");
						acceptServiceConnectionRequest(peerAgent);
						mHandler.post(() =>
						{
							Toast.makeText(BaseContext, [email protected], Toast.LENGTH_SHORT).show();
						});
					}
				}
			}
			else if (authToken.AuthenticationType == SAAuthenticationToken.AUTHENTICATION_TYPE_NONE)
			{
				Log.e(TAG, "onAuthenticationResponse : CERT_TYPE(NONE)");
			}
		}
 protected internal override void onPeerAgentUpdated(SAPeerAgent peerAgent, int result)
 {
 }
		protected internal override void onPeerAgentUpdated(SAPeerAgent peerAgent, int result)
		{
			Log.d(TAG, "Peer agent updated- result: " + result + " trId: " + trId);
			mPeerAgent = peerAgent;
			if (result == SAAgent.PEER_AGENT_UNAVAILABLE)
			{
				if (errCode != SAFileTransfer.ERROR_CONNECTION_LOST)
				{
					try
					{
						cancelFileTransfer(trId);
					}
					catch (System.ArgumentException e)
					{
						Console.WriteLine(e.ToString());
						Console.Write(e.StackTrace);
						Toast.makeText(BaseContext, "IllegalArgumentException", Toast.LENGTH_SHORT).show();
					}
				}
			}
		}
		protected internal override void onError(SAPeerAgent peerAgent, string errorMessage, int errorCode)
		{
			base.onError(peerAgent, errorMessage, errorCode);
		}
		protected internal override void onPeerAgentUpdated(SAPeerAgent peerAgent, int result)
		{
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final SAPeerAgent peer = peerAgent;
			SAPeerAgent peer = peerAgent;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int status = result;
			int status = result;
			mHandler.post(() =>
			{
				if (peer != null)
				{
					if (status == SAAgent.PEER_AGENT_AVAILABLE)
					{
						Toast.makeText(ApplicationContext, "PEER_AGENT_AVAILABLE", Toast.LENGTH_LONG).show();
					}
					else
					{
						Toast.makeText(ApplicationContext, "PEER_AGENT_UNAVAILABLE", Toast.LENGTH_LONG).show();
					}
				}
			});
		}
		protected internal override void onFindPeerAgentResponse(SAPeerAgent peerAgent, int result)
		{
			Log.d(TAG, "onFindPeerAgentResponse : result =" + result);
		}
		protected internal override void onFindPeerAgentResponse(SAPeerAgent peerAgent, int result)
		{
			if ((result == SAAgent.PEER_AGENT_FOUND) && (peerAgent != null))
			{
				requestServiceConnection(peerAgent);
			}
			else if (result == SAAgent.FINDPEER_DEVICE_NOT_CONNECTED)
			{
				Toast.makeText(ApplicationContext, "FINDPEER_DEVICE_NOT_CONNECTED", Toast.LENGTH_LONG).show();
				updateTextView("Disconnected");
			}
			else if (result == SAAgent.FINDPEER_SERVICE_NOT_FOUND)
			{
				Toast.makeText(ApplicationContext, "FINDPEER_SERVICE_NOT_FOUND", Toast.LENGTH_LONG).show();
				updateTextView("Disconnected");
			}
			else
			{
				Toast.makeText(ApplicationContext, [email protected], Toast.LENGTH_LONG).show();
			}
		}
		protected internal override void onFindPeerAgentResponse(SAPeerAgent peerAgent, int result)
		{
			if (result == PEER_AGENT_FOUND)
			{
				if (mImageListReceiverRegistered != null)
				{
					mImageListReceiverRegistered.onPeerFound(peerAgent);
				}
			}
		}
		protected internal override void onError(SAPeerAgent peerAgent, string error, int errorCode)
		{
			Log.e(TAG, "ERROR: " + errorCode + ": " + error);
		}
		public virtual bool establishConnection(SAPeerAgent peerAgent)
		{
			if (peerAgent != null)
			{
				requestServiceConnection(peerAgent);
				return true;
			}
			return false;
		}
		protected internal override void onFindPeerAgentResponse(SAPeerAgent peerAgent, int result)
		{
		}
		protected internal override void onServiceConnectionResponse(SAPeerAgent peerAgent, SASocket socket, int result)
		{
			if (result == CONNECTION_SUCCESS)
			{ // SERVICE_CONNECTION_RESULT_OK
				this.mConnectionHandler = socket;
				// Toast.makeText(getBaseContext(), R.string.ConnectionEstablishedMsg, Toast.LENGTH_LONG).show();
				mImageListReceiverRegistered.onServiceConnectionResponse(result);
			}
		}
 protected internal override void onError(SAPeerAgent peerAgent, string error, int errorCode)
 {
     Log.e(TAG, "ERROR: " + errorCode + ": " + error);
 }
		protected internal override void onPeerAgentUpdated(SAPeerAgent peerAgent, int result)
		{
		}
		protected internal override void onPeerAgentUpdated(SAPeerAgent peerAgent, int result)
		{
			if (result == PEER_AGENT_AVAILABLE)
			{
				authenticatePeerAgent(peerAgent);
			}
		}
		protected internal override void onServiceConnectionRequested(SAPeerAgent peerAgent)
		{
			if (peerAgent != null)
			{
				Toast.makeText(BaseContext, [email protected], Toast.LENGTH_SHORT).show();
				acceptServiceConnectionRequest(peerAgent);
			}
		}
		protected internal override void onServiceConnectionResponse(SAPeerAgent peerAgent, SASocket socket, int result)
		{
			if (result == SAAgent.CONNECTION_SUCCESS)
			{
				if (socket != null)
				{
					mConnectionHandler = (ServiceConnection) socket;
				}
			}
			else if (result == SAAgent.CONNECTION_ALREADY_EXIST)
			{
				Log.e(TAG, "onServiceConnectionResponse, CONNECTION_ALREADY_EXIST");
			}
		}
		protected internal override void onServiceConnectionResponse(SAPeerAgent peerAgent, SASocket socket, int result)
		{
			Log.i(TAG, "onServiceConnectionResponse: result - " + result);
			if (socket == null)
			{
				if (result == SAAgent.CONNECTION_ALREADY_EXIST)
				{
					Toast.makeText(BaseContext, "CONNECTION_ALREADY_EXIST", Toast.LENGTH_SHORT).show();
				}
				else
				{
					Toast.makeText(BaseContext, "Connection could not be made. Please try again", Toast.LENGTH_SHORT).show();
				}
			}
			else
			{
				Toast.makeText(BaseContext, "Connection established for FT", Toast.LENGTH_SHORT).show();
			}
		}
		protected internal override void onError(SAPeerAgent peerAgent, string error, int errorCode)
		{
		}
Beispiel #52
0
 protected internal override void onError(SAPeerAgent peerAgent, string errorMessage, int errorCode)
 {
     base.onError(peerAgent, errorMessage, errorCode);
 }
		protected internal override void onFindPeerAgentResponse(SAPeerAgent peerAgent, int result)
		{
			if (mConnection == null)
			{
				Log.d(TAG, "onFindPeerAgentResponse : mConnection is null");
			}
		}
		protected internal override void onServiceConnectionResponse(SAPeerAgent peer, SASocket socket, int result)
		{
			Log.i(TAG, "onServiceConnectionResponse: result - " + result);
			if (result == SAAgent.CONNECTION_SUCCESS)
			{
				if (socket != null)
				{
					mConnection = (ServiceConnection) socket;
					Toast.makeText(BaseContext, "Connection established for FT", Toast.LENGTH_SHORT).show();
				}
			}
		}
		protected internal override void onServiceConnectionRequested(SAPeerAgent peerAgent)
		{
			if (peerAgent != null)
			{
				// Toast.makeText(getBaseContext(), R.string.ConnectionAcceptedMsg, Toast.LENGTH_SHORT).show();
				authenticatePeerAgent(peerAgent);
			}
		}