コード例 #1
0
        public override bool OnStart()
        {
            DiagnosticMonitorConfiguration config = DiagnosticMonitor.GetDefaultInitialConfiguration();

            config.Logs.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
            config.DiagnosticInfrastructureLogs.ScheduledTransferPeriod         = TimeSpan.FromMinutes(1);
            config.DiagnosticInfrastructureLogs.ScheduledTransferLogLevelFilter = LogLevel.Error;
            DiagnosticMonitor.Start("DiagnosticsConnectionString", config);

            RoleEnvironment.Changing += RoleEnvironmentChanging;
            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
                RoleEnvironment.Changed += (anotherSender, arg) =>
                {
                    if (arg.Changes.OfType <RoleEnvironmentConfigurationSettingChange>()
                        .Any((change) => (change.ConfigurationSettingName == configName)))
                    {
                        if (!configSetter(RoleEnvironment.GetConfigurationSettingValue(configName)))
                        {
                            RoleEnvironment.RequestRecycle();
                        }
                    }
                };
            });

            ChirpManager.Initialize();
            AvatarManager.Initialize();
            ResizeRequestManager.Initialize();

            return(base.OnStart());
        }
コード例 #2
0
    /// <summary>
    /// Sends the specified motor speed values as Chirp audio
    /// </summary>
    public void SendMotorSpeed(sbyte speedLeft, sbyte speedRight)
    {
        // If power is zero, send motor stop instead
        if (speedLeft == 0 && speedRight == 0)
        {
            SendMotorStop();
            return;
        }

        Debug.Log($"Sending MotorSpeed({ speedLeft }, { speedRight })");
        ChirpManager.SendData(new byte[] { (byte)CommandID.MotorSpeed, (byte)speedLeft, (byte)speedRight }); // Make a byte array with type and the motor speeds, then send it as Chirp audio
    }
コード例 #3
0
 public ActionResult Create(ChirpModel cm)
 {
     try
     {
         ChirpManager.Add(User.Identity.Name, cm.Chirp);
         return(RedirectToAction("Index", "Home"));
     }
     catch
     {
         return(View());
     }
 }
コード例 #4
0
    /// <summary>
    /// Called by Unity (only once) when this script is instantiated (but after Awake) only if/when script is enabled
    /// Initializes Chirp SDK and UI components
    /// </summary>
    private void Start()
    {
        ChirpManager.InitSDK();
        ChirpManager.StartSDK();

        ChirpManager.OnStateChangedEvent = ChirpStateChanged;

        m_CancelButton.onClick.AddListener(() => TouchFieldActive = false);
        m_StopButton.onClick.AddListener(SendMotorStop);

        m_TouchFieldTopCenterPosition = new Vector2(m_TouchField.transform.position.x, m_TouchField.transform.position.y + m_TouchField.GetComponent <RectTransform>().rect.height) - (Vector2)m_TouchField.transform.position;

        TouchFieldActive = false; // Also (re)sets touch field alpha to initial value (just in case)
    }
コード例 #5
0
 /// <summary>
 /// Called by Unity when this script is about to be destroyed
 /// Cleanup, stops Chirp SDK
 /// </summary>
 private void OnDestroy()
 {
     ChirpManager.ClearCallbacks(); // Clear Chirp callbacks
     ChirpManager.StopSDK();
 }
コード例 #6
0
 /// <summary>
 /// Sends motor stop as Chirp audio
 /// </summary>
 public void SendMotorStop()
 {
     Debug.Log("Sending MotorStop");
     m_SpeedRightText.text = m_SpeedLeftText.text = "0";              // Set UI texts to display '0'
     ChirpManager.SendData(new byte[] { (byte)CommandID.MotorStop }); // Make a byte array with motor stop type, then send it as Chirp audio
 }
コード例 #7
0
 public ActionResult ListMine()
 {
     TempData["Chirps"] = ChirpManager.FindMine(User.Identity.Name);
     return(RedirectToAction("Index", "Home"));
 }
コード例 #8
0
 public ActionResult ListAll()
 {
     TempData["Chirps"] = ChirpManager.FindAll();
     return(RedirectToAction("Index", "Home"));
 }
コード例 #9
0
 public ActionResult List()
 {
     ViewData["Chirps"] = TempData["Chirps"] ?? ChirpManager.FindAll();
     return(PartialView("ChirpList"));
 }