Exemple #1
0
        void changeState()
        {
            Bitmap bmp;

            IsEmpty = !IsEmpty;
            if (IsEmpty)
            {
                if (picAvail == null)
                {
                    var temp = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.empty), GT.Picture.PictureEncoding.JPEG);
                    picAvail = temp.MakeBitmap();
                }
                bmp      = picAvail;
                txt.Text = "Available";
            }
            else
            {
                if (picNotAvail == null)
                {
                    var temp = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.full), GT.Picture.PictureEncoding.JPEG);
                    picNotAvail = temp.MakeBitmap();
                }
                bmp      = picNotAvail;
                txt.Text = "Being Used";
            }
            img.Bitmap = bmp;
            img.Invalidate();
            txt.Invalidate();
        }
Exemple #2
0
        /**
         * This method is triggered when an image is caught.
         */
        private void camera_PictureCaptured(GTM.GHIElectronics.Camera sender, GT.Picture picture)
        {
            if (throw_allarm || picture == null || !setupComplete)
            {
                return;
            }

            Int32  HeurSum = 0;
            Bitmap bitmapB = picture.MakeBitmap();

            Debug.Print("Image captured! ");
            try
            {
                if (contImage < 2)
                {
                    if (contImage == 0)
                    {
                        setupCameraTakePicture();
                    }
                    contImage++;
                    return;
                }

                if (bitmapA == null)    //per gestire la prima volta
                {
                    WindowsManager.showWindowInsertPin();
                    bitmapA         = bitmapB;
                    RGlobal         = heuristicSum(bitmapA);
                    PreviousAverage = RGlobal / 9;
                    sendPicture(picture.PictureData, true);
                    return;
                }

                Debug.Print(DateTime.Now.ToString());
                HeurSum = heuristicSum(bitmapB);
                Debug.Print(DateTime.Now.ToString());

                Debug.Print(PreviousAverage.ToString());
                Int32 average = (HeurSum / 9);
                Debug.Print(average.ToString());

                if (System.Math.Abs(PreviousAverage - average) > 45)    //SOGLIA LIMITE 40/50
                {
                    Debug.Print("Suspicious picture!");
                    sendPicture(picture.PictureData, false);
                }

                RGlobal         = HeurSum;
                PreviousAverage = average;

                //  displayT35.SimpleGraphics.DisplayImage(picture, 0, 0); //TODO eliminare alla fine
            }
            catch (SocketException e)
            {
                timer_getimage.Stop();
                timer_keepAlive.Stop();
                WindowsManager.showWindowErrorServer();
            }
        }
Exemple #3
0
        public byte[] PictureToBytes()
        {
            Bitmap bitmap    = picture.MakeBitmap();
            var    width     = bitmap.Width;
            var    height    = bitmap.Height;
            var    size      = width * height * 3 + 54;
            var    bmpBuffer = new byte[size];

            GHI.Utilities.Bitmaps.ConvertToFile(bitmap, bmpBuffer);
            return(bmpBuffer);
        }
        public override void Init(params string[] Param)
        {
            MainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.SplashForm));
            var img = (GHI.Glide.UI.Image)MainWindow.GetChildByName("ImgLogo");

            GT.Picture pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.logo), GT.Picture.PictureEncoding.JPEG);
            img.Bitmap = pic.MakeBitmap();

            Glide.MainWindow = MainWindow;
            Thread.Sleep(2000);
            CallFormRequestEvent(ScreenTypes.Prompt);
        }
 private void SavePicture(Picture picture)
 {
     if (picture == null) { return; }
     try
     {
         _imageDisplay.Background = new ImageBrush(picture.MakeBitmap());
         var filename = "picture_" + _pictureIndex + ".bmp";
         SdCard.GetStorageDevice().WriteFile(filename, picture.PictureData);
         _pictureIndex++;
         DisplayMessage("Photo Saved to: " + filename);
     }
     catch (Exception ex)
     {
         DisplayMessage("SD Card Error : " + ex.Message);
     }
 }
Exemple #6
0
        void PictureCaptured(Camera sender, GT.Picture picture)
        {
            //Debug.Print("Picture captured");

            /* Display captured photo on screen */
            imgPhoto.Bitmap = picture.MakeBitmap();
            imgPhoto.Alpha  = 255;
            imgPhoto.Invalidate();

            if (authInProgress)
            {
                displayMessage("Picture captured, connecting to server..", false);
                sendAuthRequest(scannedRFID, picture);
            }
            else
            {
                //Debug.Print("Picture captured but no authentication in progress");
            }
        }
Exemple #7
0
 void camera_PictureCaptured(Camera sender, GT.Picture picture)
 {
     imageDisplay.Background = new ImageBrush(picture.MakeBitmap());
     lastPicture             = picture;
 }
Exemple #8
0
 void camera_PictureCaptured(Camera sender, GT.Picture picture)
 {
     imageDisplay.Background = new ImageBrush(picture.MakeBitmap());
     DisplayMessage("Photo Taken");
 }
Exemple #9
0
        void setup()
        {
            /*
             * //7" Displays
             * Display.Width = 800;
             * Display.Height = 480;
             * Display.OutputEnableIsFixed = false;
             * Display.OutputEnablePolarity = true;
             * Display.PixelPolarity = false;
             * Display.PixelClockRateKHz = 30000;
             * Display.HorizontalSyncPolarity = false;
             * Display.HorizontalSyncPulseWidth = 48;
             * Display.HorizontalBackPorch = 88;
             * Display.HorizontalFrontPorch = 40;
             * Display.VerticalSyncPolarity = false;
             * Display.VerticalSyncPulseWidth = 3;
             * Display.VerticalBackPorch = 32;
             * Display.VerticalFrontPorch = 13;
             * Display.Type = Display.DisplayType.Lcd;
             * if (Display.Save())      // Reboot required?
             * {
             *  PowerState.RebootDevice(false);
             * }*/
            Display.Width = 800;

            Display.Height = 480;

            Display.HorizontalSyncPulseWidth = 1;

            Display.HorizontalBackPorch = 88;

            Display.HorizontalFrontPorch = 40;

            Display.VerticalSyncPulseWidth = 3;

            Display.VerticalBackPorch = 32;

            Display.VerticalFrontPorch = 13;

            Display.PixelClockRateKHz = 25000;

            Display.OutputEnableIsFixed = true;

            Display.OutputEnablePolarity = true;

            Display.HorizontalSyncPolarity = false;

            Display.VerticalSyncPolarity = false;

            Display.PixelPolarity = true;

            Display.Type = Display.DisplayType.Lcd;



            if (Display.Save())      // Reboot required?
            {
                PowerState.RebootDevice(false);
            }

            //init touch

            i2cDevice = new I2CDevice(new I2CDevice.Configuration(0x38, 400));

            CapDriver = new CapTouchDriver(i2cDevice);

            CapDriver.SetBacklightTime(0);

            CapDriver.ResetBacklight();



            //CapacitiveTouchController.Initialize(GHI.Pins.G120.P2_21);

            //CapacitiveTouchController.Initialize(GHI.Pins.FEZCobraII.Socket4.Pin3);
            GlideTouch.Initialize();

            MainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Form1));
            img        = (GHI.Glide.UI.Image)MainWindow.GetChildByName("img");
            btn        = (GHI.Glide.UI.Button)MainWindow.GetChildByName("BtnChange");
            txt        = (GHI.Glide.UI.TextBlock)MainWindow.GetChildByName("txtStatus");
            GT.Picture pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.empty), GT.Picture.PictureEncoding.JPEG);
            img.Bitmap        = pic.MakeBitmap();
            Glide.MainWindow  = MainWindow;
            btn.ReleaseEvent += btn_ReleaseEvent;
            Glide.FitToScreen = true;
            //Thread th1 = new Thread(new ThreadStart(LoopButton));
            //th1.Start();
        }