Exemple #1
0
        public async Task Test(MusicEndpoint endpoint)
        {
            string     userFeedback = null;
            RemoteBase session      = null;

            try {
                switch (endpoint.EndpointType)
                {
                case EndpointTypes.Local:
                    break;

                case EndpointTypes.MusicPimp:
                    session = ProviderService.Instance.NewPimpSession(endpoint);
                    break;

                case EndpointTypes.PimpCloud:
                    session = new CloudSession(endpoint);
                    break;

                case EndpointTypes.Subsonic:
                    session = new SubsonicSession(endpoint);
                    break;
                }
                if (session != null)
                {
                    try {
                        FeedbackMessage = String.Empty;
                        IsLoading       = true;
                        await session.TestConnectivity();

                        userFeedback = "Connection successfully established.";
                    } finally {
                        IsLoading = false;
                    }
                }
            } catch (UnauthorizedException) {
                userFeedback = "Check your credentials.";
            } catch (ConnectivityException) {
                userFeedback = GetFeedback(endpoint, session);
            } catch (NotFoundException) {
                userFeedback = GetFeedback(endpoint, session);
            } catch (PimpException pe) {
                userFeedback = pe.Message;
            } catch (ServerResponseException sre) {
                userFeedback = sre.Message;
            } catch (HttpRequestException) {
                userFeedback = GetFeedback(endpoint, session);
            } catch (Exception) {
                userFeedback = "Something went wrong. Please check that all the fields are filled in properly.";
            }

            if (userFeedback != null)
            {
                OnFeedback(userFeedback);
            }
        }
Exemple #2
0
        private string GetFeedback(MusicEndpoint e, RemoteBase s)
        {
            string userFeedback = s != null && e.EndpointType != EndpointTypes.PimpCloud ? "Unable to connect to " + s.BaseUri + "." : "Unable to connect.";
            var    extraInfo    = "";

            if (e.Protocol == Protocols.https && e.EndpointType != EndpointTypes.PimpCloud)
            {
                extraInfo = " Perhaps the certificate validation failed? Untrusted SSL certificates are not accepted.";
            }
            userFeedback += extraInfo;
            return(userFeedback);
        }
    public bool init()
    {
        controller = RemoteManager.Instance.connectedRemote;


        if (controller != null)
        {
            Debug.Log("Controller Initialized");
            return(true);
        }
        else
        {
            Debug.Log("Controller Initialization Failed");
            return(false);
        }
    }
    public bool InitVirtual()
    {
        if (controller == null)
        {
            _virtualRemote = new VirtualRemote();
            controller     = _virtualRemote;
            // Initialize with zero values to avoid nulls
            _virtualRemote.UpdateVirtualMotion(new Utils.serializableBTRemote(Vector3.zero, Vector3.zero, Vector3.zero));
            _virtualRemote.UpdateVirtualButtons(new Utils.serializableBTRemoteButtons(false, false, false));
            _virtualRemote.UpdateVirtualTouchpad(new Utils.serializableBTRemoteTouchPad(false, false, Vector2.zero, false, false, false, false));

            return(true);
        }
        else
        {
            Debug.Log("Controller already initialized");
            return(false);
        }
    }
Exemple #5
0
 public static string Touch()
 {
     return(RemoteBase.UseIProtected(new DirectImpl()));
 }
Exemple #6
0
 /// <summary>Creates service definition that can be registered with a server</summary>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static grpc::ServerServiceDefinition BindService(RemoteBase serviceImpl)
 {
     return(grpc::ServerServiceDefinition.CreateBuilder()
            .AddMethod(__Method_Call, serviceImpl.Call).Build());
 }