private void Awake() { Instance = this; userWorldLocation = new Vector3(float.MinValue, float.MinValue, float.MinValue); rsc = gameObject.AddComponent(typeof(GoogleAltitudeController)) as GoogleAltitudeController; if (PlayerPrefs.HasKey(InternalDataController.GPSRefreshFreqSetting)) { refreshInterval = float.Parse(InternalDataController.loadValue(InternalDataController.GPSRefreshFreqSetting)); } }
static void Main(string[] args) { // The phone has been booted up and all the controllers are running GPSController gps = new GPSController(); MobileDataController data = new MobileDataController(); MusicController zune = new MusicController(); WifiController wifi = new WifiController(); ///////////// Going for Jogging ///////////////////// // 1. Turn off the wifi wifi.IsSwitchedOn = false; // 2. Switch on the Mobile Data data.IsSwitchedOn = true; // 3. Turn on the GPS gps.IsSwitchedOn = true; // 4. Turn on the Music zune.IsSwitchedOn = true; // 5. Start the Sports-Tracker SportsTrackerApp app = new SportsTrackerApp(); app.Start(); ///////////// Back from Jogging ///////////////////// Console.WriteLine(); // 0. Share Sports tracker stats on twitter and facebook app.Share(); // 1. Stop the Sports Tracker app.Stop(); // 2. Turn off the Music zune.IsSwitchedOn = false; // 3. Turn off the GPS gps.IsSwitchedOn = false; // 4. Turn off the Mobile Data data.IsSwitchedOn = false; // 5. Turn on the wifi wifi.IsSwitchedOn = true; }
void Start() { gps = reference.GetComponent <GPSController>(); }
// inputs // // jpegs from hardware devices // bitmaps from hardware devices // GPS from stored data or hardware devices // Camera name source info from stored configuration // video files on disk // still images on disk // outputs // // bitmaps to LPR, with source, time and GPS // jpegs to DVR, with source, time and GPS // // // // public FrameGenerator(APPLICATION_DATA appData, bool AsService) { try { m_AppData = appData; m_AppData.AddOnClosing(OnClose, APPLICATION_DATA.CLOSE_ORDER.MIDDLE); m_Log = (ErrorLog)m_AppData.Logger; m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_FrameCnt].Peak.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_FrameCnt].PerSecond.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_FrameCnt].RunningAverage.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_FrameCnt].Snapshot.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_MotionDetectionPendingQ].Peak.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_MotionDetectionPendingQ].PerSecond.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_MotionDetectionPendingQ].RunningAverage.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_MotionDetectionPendingQ].Snapshot.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_NonMotionFramePushQ].Peak.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_NonMotionFramePushQ].PerSecond.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_NonMotionFramePushQ].RunningAverage.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_NonMotionFramePushQ].Snapshot.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_GPSLocation].StatString.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_DroppedFrames].Accumulator.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_FrameCnt].Accumulator.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_FramesDetected].Accumulator.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_ProcessQCnt].Snapshot.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_ProcessQCnt].Peak.RegisterForUse(true); m_EabledChannelArray = new bool[m_AppData.MAX_PHYSICAL_CHANNELS];// used tell the 2255 device which of its channels are enabled m_LastJPEGReceived = new LAST_JPEG_RECEIVED[m_AppData.MAX_PHYSICAL_CHANNELS]; m_Channels = new CHANNEL[m_AppData.MAX_PHYSICAL_CHANNELS]; for (int c = 0; c < m_AppData.MAX_PHYSICAL_CHANNELS; c++) { m_LastJPEGReceived[c] = new LAST_JPEG_RECEIVED(); m_Channels[c] = new CHANNEL(c); } LoadChannelNames(); m_ConsumerIDs = new CONSUMER_ID(); m_CurrentGPSPosition = m_NoPositionAvailable; m_MotionDetectionQ = new ThreadSafeQueue <FRAME>(m_MotionDetectionQueLevel, "QueueOverruns_FG_MotionDetectionQ", m_AppData); m_AppData.MotionDetectionGettingBehind = false; ////////////////////////////////////// // // start the thread that pushes new frames to the registered consumers m_AllFramesConsumerPushQ = new ThreadSafeQueue <CONSUMER_PUSH>(240, "QueueOverruns_FG_AllFramesConsumerPushQ", m_AppData); m_MotionDetectedConsumerPushQ = new ThreadSafeQueue <CONSUMER_PUSH>(240, "QueueOverruns_FG_MotionDetectedConsumerPushQ", m_AppData); //120 PushThread = new Thread(PushLoop); PushThread.Priority = ThreadPriority.AboveNormal; PushThread.Start(); m_MotionDetectionThread = new Thread(MotionDetectionLoop); m_MotionDetectionThread.Start(); ////////////////////////////////////// // // start the S2255 controller // the 2255 controller has a polling loop that looks for 2255 devices to be added/deleted by the user plugging/unplugging the cables // as new devices are detected, the stored config data is read and the channels are assigned and start running as appropriate // the image data flows into this class via callbacks. this class then pushes the data up a layer after adding GPS and time stamps. if (AsService) { try { S2255Controller.S2255Controller.PAL_NTSC_MODE videoStandard = S2255Controller.S2255Controller.PAL_NTSC_MODE.NTSC; string NTSC_PAL = UserSettings.Get(UserSettingTags.VideoSetup_PAL_NTSC); if (NTSC_PAL != null) { if (NTSC_PAL.Equals(UserSettingTags.VideoSetup_PAL)) { videoStandard = S2255Controller.S2255Controller.PAL_NTSC_MODE.PAL; } } unsafe { m_S2255Controller = new S2255Controller.S2255Controller(videoStandard, m_AppData, m_EabledChannelArray); m_S2255Controller.OnNewFrame += new S2255Controller.S2255Controller.OnNewFrameFromDeviceEvent(OnReceiveNewImageFromS2255Device); m_S2255Controller.StartThreads(); } } catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL); } ////////////////////////////////////// // // start the GPS Controller string GPSPort = FindDevicePort.GetGPSCommPort(); m_GPSController = new GPSController(PutNewGPSData, m_AppData); if (m_S2255Controller.GetReadyStatus) { m_FrameGenReadyStatus = true; } else { m_FrameGenReadyStatus = false; } } if (!AsService) { MovieFileController = new MovieFiles(m_AppData); MovieFileController.OnNewImage += new MovieFiles.OnNewImageEvent(MovieFiles_OnNewImage); MovieFileController.Start(); } } catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL); } }
private static void JoggWithoutUsingFacade() { // The phone has been booted up and all the controllers are running var textStatus = new TextStatusController(); var gps = new GPSController(); var data = new MobileDataController(); var iTunes = new MusicController(); var wifi = new WifiController(); var heartRateMonitor = new HeartRateMontiorController(); var moodIndicator = new MoodIndicatorController(); ///////////// Going for Jogging ///////////////////// // 1. Set IM Status to Away textStatus.SetToAway = true; // 2. Turn off the wifi -- save battery wifi.IsSwitchedOn = false; // 3. Switch on the Mobile Data data.IsSwitchedOn = true; // 4. Turn on the GPS gps.IsSwitchedOn = true; // 5. Turn on Heart Rate Monitor heartRateMonitor.IsSwitchedOn = true; // 6. Turn on Mood Indicator moodIndicator.IsSwitchedOn = true; // 7. Turn on the Music iTunes.IsSwitchedOn = true; // 8. Start the Sports-Tracker var app = new SportsTrackerApp(); app.Start(); // 9. Pair Heart Rate Monitor heartRateMonitor.Pair(); // 10. Load GPS Map // 11. Load playlist iTunes.LoadPlaylist("RockOut"); // 12. Start playing music iTunes.Start(); // 13. Start Monitoring Heart Rate heartRateMonitor.Start(); ///////////// Back from Jogging ///////////////////// Console.WriteLine(); // 1. Stop heart rate monitor heartRateMonitor.Stop(); // 2. Turn off the Music iTunes.IsSwitchedOn = false; // 3. Turn off the GPS gps.IsSwitchedOn = false; // 4. Share Sports tracker stats on twitter and facebook app.Share(); // 5. Stop the Sports Tracker app.Stop(); // 6. Turn off heart rate monitor heartRateMonitor.IsSwitchedOn = false; // 7. Turn off the GPS moodIndicator.IsSwitchedOn = false; // 8. Turn off the Mobile Data data.IsSwitchedOn = false; // 9. Turn on the wifi wifi.IsSwitchedOn = true; }