Esempio n. 1
0
        public Response ConfirmationFrontDisplay([FromBody] FrontDisplay FD)
        {
            Logger.Debug("Method called.");
            var user = UserSession.GetCurrent();

            {
                // User Securities
                Logger.Info(string.Format("Called by ({0},{1})", user.Username, user.IpsUserKey));

                // Called the SQL Query
                var taskResult = KioskCheckInService.Confirmation_FrontDisplay(FD);

                if (taskResult.Result.HasFailed)
                {
                    Logger.Error(string.Format("({0},{1}) [{2}] {3} Stack: {4}", user.Username, user.IpsUserKey, taskResult.Result.Code, taskResult.Result.Message, taskResult.Result.Stack));
                    Logger.Info("200 Success response sent with failure message.");
                    return(Response.Failure(taskResult.Result.Message));
                }

                Logger.Info("200 Success response sent.");
                return(Response.Success(taskResult.Data));
            }

            Logger.Info("401 Unauthorized response sent.");
            throw new HttpResponseException(HttpStatusCode.Unauthorized);
        }
Esempio n. 2
0
        public static void Init(string path, Action flushCallback = null)
        {
            try
            {
                FlushCallback = flushCallback;

                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                IEnumerable filesEnumerator = Directory.EnumerateFiles(path);

                string fullpath;
                int    filesCount = 0;
                foreach (object file in filesEnumerator)
                {
                    filesCount++;
                }

                fullpath = path + @"\traceLog" + filesCount + ".log";
                writer   = new StreamWriter(fullpath, append: true);

                queue.Start();
            }
            catch (Exception ex)
            {
                FrontDisplay.RefreshLEDs(LedType.Red);
                Logger.Error(ex, "file logger init");
            }
        }
Esempio n. 3
0
    void Awake()
    {
        walkerComp   = GetComponent <BezierWalker>();
        headTrans    = (GetComponentInChildren(typeof(HeadTransform), true) as HeadTransform).transform;
        curveDisplay = GetComponentInChildren(typeof(CurveDisplay), true) as CurveDisplay;
        frontDisplay = GetComponentInChildren(typeof(FrontDisplay), true) as FrontDisplay;
        animator     = GetComponentInChildren(typeof(Animator), true) as Animator;

        if (isMonitor)
        {
            //regardless to whoever
            cameraTrans.gameObject.SetActive(true);
            cameraTrans.parent   = cameraParent;
            cameraTrans.position = cameraParent.position;
            cameraTrans.rotation = cameraParent.rotation;
            curveDisplay.gameObject.SetActive(true);
            frontDisplay.gameObject.SetActive(true);
        }
        else
        {
            if (id == StaticData.playerId)
            {
                cameraTrans.parent        = cameraParent;
                cameraTrans.localPosition = Vector3.zero;
                cameraTrans.localRotation = Quaternion.identity;
                curveDisplay.gameObject.SetActive(true);
                frontDisplay.gameObject.SetActive(true);
            }
            else
            {
                curveDisplay.gameObject.SetActive(false);
                frontDisplay.gameObject.SetActive(false);
            }
        }
    }
Esempio n. 4
0
        internal static void ResetBoard()
        {
            Logger.Trace("Board will reset in 2 seconds!!!");
            FrontDisplay.RefreshLEDs(LedType.RedBlinking, append: true);
            LedBlinkingQueueThreadWorker.Enqueue(new LedBlinkingItem(orangeLed, 2, 200));

            requestIgnitionStateTimer?.Dispose();

            UnmountMassStorage();
            FrontDisplay.RefreshLEDs(LedType.Empty);

#if OnBoardMonitorEmulator
            System.Windows.MessageBox.Show("Board was resetted");
#endif

#if DEBUG || DebugOnRealDeviceOverFTDI
            if (Debugger.IsAttached)
            {
                return;
            }
#endif

            if (resetPin == null)
            {
                resetPin = new OutputPort(Pin.ResetPin, false);
            }
        }
Esempio n. 5
0
        private void UpdateDisplays()
        {
            Hull displayHull = myHull.CopyToFullHull();

            displayHull.Rotate(0, 0, 180);
            FrontDisplay.SetHull(displayHull);
            Debug.WriteLine("Front size: ({0})", displayHull.GetSize());

            displayHull = myHull.CopyToFullHull();
            displayHull.Rotate(0, 90, 90);
            TopDisplay.SetHull(displayHull);

            displayHull = myHull.CopyToFullHull();
            displayHull.Rotate(0, 90, 180);
            SideDisplay.SetHull(displayHull);

            if (PerspectiveManip.perspective == HullManip.PerspectiveType.FRONT)
            {
                displayHull = myHull.CopyToFullHull();
                displayHull.Rotate(0, 0, 180);
                Debug.WriteLine("Perspective Front size: ({0})", displayHull.GetSize());
                PerspectiveDisplay.SetHull(displayHull);
                Debug.WriteLine("Perspective Front size: ({0})", displayHull.GetSize());
                PerspectiveManip.perspective = HullManip.PerspectiveType.FRONT;
                PerspectiveManip.IsEditable  = true;
            }
            else if (PerspectiveManip.perspective == HullManip.PerspectiveType.TOP)
            {
                displayHull = myHull.CopyToFullHull();
                displayHull.Rotate(0, 90, 90);
                PerspectiveDisplay.SetHull(displayHull);
                PerspectiveManip.perspective = HullManip.PerspectiveType.TOP;
                PerspectiveManip.IsEditable  = true;
            }
            else if (PerspectiveManip.perspective == HullManip.PerspectiveType.SIDE)
            {
                displayHull = myHull.CopyToFullHull();
                displayHull.Rotate(0, 90, 180);
                PerspectiveDisplay.SetHull(displayHull);
                PerspectiveManip.perspective = HullManip.PerspectiveType.SIDE;
                PerspectiveManip.IsEditable  = true;
            }
            else // must be PERSPECTIVE
            {
                displayHull = myHull.CopyToFullHull();
                displayHull.Rotate(10, 30, 190);
                PerspectiveDisplay.SetHull(displayHull);
            }
            FrontManip.Draw();
            TopManip.Draw();
            SideManip.Draw();
            PerspectiveManip.Draw();
        }
Esempio n. 6
0
 public static void CheckStatus()
 {
     while (true)
     {
         try
         {
             Execute("ping");
             Logger.Trace("CheckStatus: Volumio READY!");
             FrontDisplay.RefreshLEDs(LedType.Green);
             CheckStatusThread.Suspend();
         }
         catch (Exception ex)
         {
             FrontDisplay.RefreshLEDs(LedType.OrangeBlinking, append: true);
             Logger.Trace("CheckStatus: Volumio isn't ready yet.");
             Thread.Sleep(1000);
         }
     }
 }
Esempio n. 7
0
        public static void Init()
        {
            //player = new iPodViaHeadset(Cpu.Pin.GPIO_NONE);
            //player = new BluetoothOVC3860(Serial.COM2/*, sd != null ? sd + @"\contacts.vcf" : null*/);
            Logger.Debug("Creating VolumioRestApiPlayer.");
            Cpu.Pin chipSelect_RT        = FEZPandaIII.Gpio.D27;
            Cpu.Pin externalInterrupt_WS = FEZPandaIII.Gpio.D24;
            Cpu.Pin reset_BR             = FEZPandaIII.Gpio.D26;
            Player = new VolumioRestApiPlayer(chipSelect_RT, externalInterrupt_WS, reset_BR);
            Logger.Debug("VolumioRestApiPlayer created.");
            FrontDisplay.RefreshLEDs(LedType.GreenBlinking);
            if (settings.MenuMode != Tools.MenuMode.RadioCDC /* || Manager.FindDevice(DeviceAddress.OnBoardMonitor, 10000)*/)
            {
                //if (player is BluetoothWT32)
                //{
                //    ((BluetoothWT32)player).NowPlayingTagsSeparatedRows = true;
                //}
                if (settings.MenuMode == MenuMode.BordmonitorCDC)
                {
                    Emulator = new CDChanger(Player);
                    Logger.Debug("CDChanger media emulator created");
                    if (settings.NaviVersion == NaviVersion.MK2)
                    {
                        Localization.Current = new RadioLocalization();
                        SettingsScreen.Instance.CanChangeLanguage = false;
                    }
                    Bordmonitor.NaviVersion = settings.NaviVersion;
                    //BordmonitorMenu.FastMenuDrawing = settings.NaviVersion == NaviVersion.MK4;
                    BordmonitorMenu.Init(Emulator);
                    Logger.Debug("BordmonitorMenu inited");
                }
                else
                {
                    //emulator = new BordmonitorAUX(player);
                }
            }
            else
            {
                //Localization.Current = new RadioLocalization();
                //SettingsScreen.Instance.CanChangeLanguage = false;
                //MultiFunctionSteeringWheel.EmulatePhone = true;
                //Radio.HasMID = Manager.FindDevice(DeviceAddress.MultiInfoDisplay);
                //var menu = RadioMenu.Init(new CDChanger(player));
                //menu.TelephoneModeForNavigation = settings.MenuMFLControl;
                //Logger.Info("Radio menu inited" + (Radio.HasMID ? " with MID" : ""));
            }

            Thread.Sleep(200);
            FrontDisplay.RefreshLEDs(LedType.Green);

            greenLed.Write(true);

            //nextButton = new InterruptPort((Cpu.Pin)FEZPandaIII.Gpio.Ldr1, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeHigh);
            //nextButton.OnInterrupt += (p, s, t) =>
            //{
            //    Emulator.Player.Next();
            //};
            //prevButton = new InterruptPort((Cpu.Pin)FEZPandaIII.Gpio.Ldr0, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeHigh);
            //prevButton.OnInterrupt += (p, s, t) =>
            //{
            //    if (!Emulator.IsEnabled)
            //    {
            //        Emulator.IsEnabled = true;
            //        return;
            //    }

            //    if (Emulator.Player.IsPlaying)
            //    {
            //        Emulator.Pause();
            //    }
            //    else
            //    {
            //        Emulator.Play();
            //    }
            //};
        }
Esempio n. 8
0
        public static void Launch(LaunchMode launchMode = LaunchMode.MicroFramework)
        {
            try
            {
                Comfort.Init();
                IntegratedHeatingAndAirConditioning.Init();

                _resetCause = GHI.Processor.Watchdog.LastResetCause;

                blueLed   = new OutputPort(FEZPandaIII.Gpio.Led1, false);
                greenLed  = new OutputPort(FEZPandaIII.Gpio.Led2, false);
                orangeLed = new OutputPort(FEZPandaIII.Gpio.Led3, _resetCause == GHI.Processor.Watchdog.ResetCause.Watchdog);
                redLed    = new OutputPort(FEZPandaIII.Gpio.Led4, false);

#if (NETMF && RELEASE) || (OnBoardMonitorEmulator && !DebugOnRealDeviceOverFTDI)
                _useWatchdog = true;
#endif
                if (_useWatchdog)
                {
                    GHI.Processor.Watchdog.Enable(watchDogTimeoutInMilliseconds);
                }

                settings = Settings.Instance;

                FileLogger.Create();
                InitManagers();

                InstrumentClusterElectronics.DateTimeChanged += DateTimeChanged;

                Logger.Debug("Watchdog.ResetCause: " + (_resetCause == GHI.Processor.Watchdog.ResetCause.Normal ? "Normal" : "Watchdog"));
                if (_useWatchdog)
                {
                    Logger.Debug("Watchdog enabled with timeout: " + watchDogTimeoutInMilliseconds);
                }

                //SettingsScreen.Instance.Status = version.Length > 11 ? version.Replace(" ", "") : version;
                //Localization.SetCurrent(RussianLocalization.SystemName); //Localization.SetCurrent(settings.Language);
                //Comfort.AutoLockDoors = settings.AutoLockDoors;
                //Comfort.AutoUnlockDoors = settings.AutoUnlockDoors;
                //Comfort.AutoCloseWindows = settings.AutoCloseWindows;
                //Comfort.AutoCloseSunroof = settings.AutoCloseSunroof;

                #region MassStorage
                //Controller.DeviceConnectFailed += (sss, eee) =>
                //{
                //    Logger.Error("DeviceConnectFailed!");
                //    LedBlinkingQueueThreadWorker.Enqueue(new LedBlinkingItem(redLed, 1, 100));

                //    ControllerState = UsbMountState.DeviceConnectFailed;
                //    _removableMediaInsertedSync.Set();
                //};
                //Controller.UnknownDeviceConnected += (ss, ee) =>
                //{
                //    Logger.Error("UnknownDeviceConnected!");
                //    LedBlinkingQueueThreadWorker.Enqueue(new LedBlinkingItem(redLed, 2, 100));

                //    ControllerState = UsbMountState.UnknownDeviceConnected;
                //    _removableMediaInsertedSync.Set();
                //};
                //Controller.MassStorageConnected += (sender, massStorage) =>
                //{
                //    Logger.Debug("Controller MassStorageConnected!");
                //    LedBlinkingQueueThreadWorker.Enqueue(new LedBlinkingItem(orangeLed, 2, 100));
                //    ControllerState = UsbMountState.MassStorageConnected;

                RemovableMedia.Insert += (s, e) =>
                {
                    LedBlinkingQueueThreadWorker.Enqueue(new LedBlinkingItem(orangeLed, 3, 100));

                    string rootDirectory = VolumeInfo.GetVolumes()[0].RootDirectory;
                    settings = Settings.Init(rootDirectory + "\\imBMW.ini");
                    FileLogger.Init(rootDirectory + "\\logs", () => VolumeInfo.GetVolumes()[0].FlushAll());
                    Logger.Debug("Logger initialized.");

                    MassStorageMountState = MassStorageMountState.Mounted;
                    _removableMediaInsertedSync.Set();
                };

                RemovableMedia.Eject += (s, e) =>
                {
                    FileLogger.Eject();
                    Logger.Print("RemovableMedia Ejected!");
                    LedBlinkingQueueThreadWorker.Enqueue(new LedBlinkingItem(greenLed, 3, 100));
                    MassStorageMountState = MassStorageMountState.Unmounted;
                };

                //_massStorage = massStorage;
                _massStorage = new SDCard(SDCard.SDInterface.SPI);
                _massStorage.Mount();
                //};
#if RELEASE
                //Controller.Start();
#else
#if NETMF
                // WARNING! Be aware, without this line you can get 'Controller -> DeviceConnectFailed' each time when you start debugging...
                if (Debugger.IsAttached)
#endif
                {
                    //Controller.Start();
                }
#endif
                #endregion

                LedBlinkingQueueThreadWorker.Enqueue(new LedBlinkingItem(orangeLed, 1, 200));
                bool isSignalled = _removableMediaInsertedSync.WaitOne(Debugger.IsAttached ? 10000 : 10000, true);
                if (!isSignalled) // No Storage inserted
                {
                    InstrumentClusterElectronics.ShowNormalTextWithGong(MassStorageMountState.ToStringValue());
                    FrontDisplay.RefreshLEDs(LedType.RedBlinking, append: true);
                    LedBlinkingQueueThreadWorker.Enqueue(new LedBlinkingItem(redLed, 3, 100));
                }
                else
                {
                    if (MassStorageMountState == MassStorageMountState.DeviceConnectFailed || MassStorageMountState == MassStorageMountState.UnknownDeviceConnected)
                    {
                        InstrumentClusterElectronics.ShowNormalTextWithGong(MassStorageMountState.ToStringValue());
                        FrontDisplay.RefreshLEDs(LedType.Red, append: true);
                        LedBlinkingQueueThreadWorker.Enqueue(new LedBlinkingItem(redLed, 4, 100));
                        ResetBoard();
                    }
                }
                Logger.Debug("MassStorage state: " + MassStorageMountState.ToStringValue());

                InstrumentClusterElectronics.RequestDateTime();

                Init();

                Logger.Debug("Started!");

                BordmonitorMenu.MenuButtonHold += () =>
                {
                    FrontDisplay.RefreshLEDs(LedType.Empty);

                    if (Emulator.IsEnabled)
                    {
                        Emulator.PlayerIsPlayingChanged += (s, isPlayingChangedValue) =>
                        {
                            if (!isPlayingChangedValue)
                            {
                                ResetBoard();
                            }
                        };
                        Radio.PressOnOffToggle();
                        //Emulator.IsEnabled = false;
                    }
                    else
                    {
                        ResetBoard();
                    }
                };
                BordmonitorMenu.PhoneButtonHold += () =>
                {
                    VolumioRestApiPlayer.Reboot();
                    Logger.Warning("Reboot request sent.");
                };
                BordmonitorMenu.EjectButtonHold += () =>
                {
                    UnmountMassStorage();
                    _massStorage = null;
                    Logger.Warning("UNMOUNTED!");
                };

                Manager.Instance.AddMessageReceiverForSourceDevice(DeviceAddress.InstrumentClusterElectronics, m =>
                {
                    if (m.Data[0] == 0x11 && m.Data.Length == 2) // Ignition status
                    {
                        GHI.Processor.Watchdog.ResetCounter();
                    }
                });
                requestIgnitionStateTimer = new Timer(RequestIgnitionStateTimerHandler, null, 0, requestIgnitionStateTimerPeriod);

                imBMWTest();

                Logger.Debug("Actions inited!");

                if (launchMode == LaunchMode.MicroFramework)
                {
                    Thread.Sleep(Timeout.Infinite);
                }
            }
            catch (Exception ex)
            {
                LedBlinking(new LedBlinkingItem(redLed, 5, 200));
                Thread.Sleep(200);
                redLed.Write(true);
                Logger.Error(ex, "while modules initialization");
                ResetBoard();
            }
        }