Esempio n. 1
0
        public IHttpActionResult Ctrl_Post(string vehicleId, [FromBody] VehicleCtrl ctrl)
        {
            if (string.IsNullOrEmpty(ctrl.Key) || !string.Equals(ConfigurationManager.AppSettings["Key"], ctrl.Key))
            {
                return(Unauthorized());
            }

            if (vehicleCtrl.ContainsKey(vehicleId))
            {
                vehicleCtrl.Remove(vehicleId);
            }

            ctrl.Key = string.Empty; // Not to shout our pwd all around the world...
            vehicleCtrl.Add(vehicleId, ctrl);

            LogsController.Log("Vehicle '" + vehicleId + "' will go to path '" + ctrl.Path + "'");

            return(Ok());
        } // Ctrl_Post
Esempio n. 2
0
        //[Authorize]
        //[RequireHttps]
        public IHttpActionResult Ctrl_Post(string semId, [FromBody] SemaphoreCtrl ctrl)
        {
            if (string.IsNullOrEmpty(ctrl.Key) || !string.Equals(ConfigurationManager.AppSettings["Key"], ctrl.Key))
            {
                return(Unauthorized());
            }

            lock (semCtrl)
            {
                if (semCtrl.ContainsKey(semId))
                {
                    semCtrl.Remove(semId);
                }
            }

            ctrl.Key = string.Empty; // Not to shout our pwd all around the world...
            semCtrl.Add(semId, ctrl);

            LogsController.Log("Semaphore '" + semId + "' programmed");

            return(Ok());
        } // Ctrl_Post
Esempio n. 3
0
 //[Authorize]
 public IHttpActionResult Parking_Delete(string vehicleId, [FromUri] Position position)
 {
     LogsController.Log("Vehicle '" + vehicleId + "' released parking at { Lat: " + position.Latitude + " - Lng: " + position.Longitude + " }");
     return(Ok());
 }