コード例 #1
0
        public async Task <ActionResult> Initialize(string connectionString, int transportType)
        {
            await Uninitialize(connectionString);

            thermostat = new Thermostat(connectionString, transportType);
            await thermostat.Initialize();

            return(Json(new { success = true }));
        }
コード例 #2
0
        public async Task <ActionResult> InitializeX509(string deviceId, string hostName, string certPath, int transportType)
        {
            try
            {
                await Uninitialize(deviceId);

                thermostat = new Thermostat(deviceId, certPath, hostName, transportType);
                await thermostat.Initialize();

                return(Json(new { success = true }));
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, error = ex.ToString(), path = System.Web.HttpRuntime.AppDomainAppPath }));
            }
        }