Example #1
0
        public async Task<bool> GetPlateNumberAsync()
        {
            var plateRecognizer = new PlateRecognizer();

            using (var stream = new InMemoryRandomAccessStream())
            {
                await _camera.TakePhotoToStreamAsync(stream);

                var plateImage =  await plateRecognizer.RecognizePlateAsync(stream);

                if (plateImage == null)
                {
                    return false;
                }

                var base64Image = await plateImage.ToBase64StringAsync();

                if (base64Image == null)
                {
                    return false;
                }

                var request = new AuthRequest
                {
                    CarPlate = base64Image,
                    ParkingCNPJ = "46.451.585/0001-67"
                };

                await SendAuthRequestAsync(request);
            }

            return true;
        }
Example #2
0
        /// <summary>
        /// Starts listening for present tags.
        /// </summary>
        private async void StartTagListener()
        {
            await Task.Run(async () =>
            {
                while (true)
                {
                    while (!_mfrc522.IsTagPresent())
                    {
                        await Task.Delay(50);
                    }

                    var tagUid = _mfrc522.ReadUid();
                    var request = new AuthRequest();

                    request.TagId = tagUid.ToString();
                    RaiseNewTagEvent(tagUid);
                }
            });
        }