Esempio n. 1
0
        public override void OnFound(string Endpoint, ScanEndpointInfo scanEndpointInfo)
        {
            Device device = MainActivity.FindDevice(Endpoint);

            if (device == null)
            {
                device = new Device(scanEndpointInfo.Name, Endpoint, false);
                MainActivity.AvaliableDevicesList.Add(device);
                Log.Debug(MainActivity.TAG, "OnFound : " + Endpoint);
                context.UpdateAvaliableDevices();
            }
        }
Esempio n. 2
0
        public override void OnDisconnected(string EndPoint)
        {
            Log.Debug(MainActivity.TAG, "OnDisconnected with Endpoint : " + EndPoint);
            Toast.MakeText(context, EndPoint + " Disconnected ", ToastLength.Long).Show();
            Device device = MainActivity.FindDevice(EndPoint);

            if (device != null)
            {
                device.Status = false;
            }
            context.UpdateAvaliableDevices();
            NearbyConnection.AvalibleDeviceslistview.CollapseGroup(MainActivity.AvaliableDevicesList.IndexOf(device));
        }
Esempio n. 3
0
        public override void OnEstablish(string EndPoint, ConnectInfo Coninfo)
        {
            Log.Debug(MainActivity.TAG, "OnEstablish with Endpoint : " + EndPoint + " ConnectInfo : Endpoint Name " + Coninfo.EndpointName);
            MainActivity.mDiscoveryEngine.AcceptConnect(EndPoint, new DataCallBackImp(context)).AddOnSuccessListener(new TaskListener(context, "Accept Connection")).AddOnFailureListener(new TaskListener(context, "Accept Connection"));;
            Log.Debug(MainActivity.TAG, "Connection Accepted with Endpoint : " + EndPoint);

            Device device = MainActivity.FindDevice(EndPoint);

            if (device == null)
            {
                device = new Device(Coninfo.EndpointName, EndPoint, true);
                MainActivity.AvaliableDevicesList.Add(device);
            }
        }
Esempio n. 4
0
        public override void OnResult(string EndPoint, ConnectResult ConnResult)
        {
            Log.Debug(MainActivity.TAG, "OnResult with Endpoint : " + EndPoint + " ConnectResult : Status: " + ConnResult.Status);
            if (ConnResult.Status.StatusCode == StatusCode.StatusSuccess)
            {
                Toast.MakeText(context, "Connection with " + EndPoint + " has been Established", ToastLength.Long).Show();

                Device device = MainActivity.FindDevice(EndPoint);
                if (device != null)
                {
                    device.Status = true;
                }
                context.UpdateAvaliableDevices();
            }
            else
            {
                Toast.MakeText(context, "Connection Failed " + ConnResult.Status.StatusMessage, ToastLength.Long).Show();
            }
        }