Beispiel #1
0
        public HttpStatusCode GetState(out Model.StateRec rec)
        {
            ValidateIsBound();

            MoveRestClient client       = new MoveRestClient(_device, _port, _username, _password);
            string         body         = null;
            var            responseCode = client.GetState(out body);

            Trace.TraceInformation("\nRaw JSON data:  {0}", body);

            rec = JsonHelper.JsonToStateRec(body);
            return(responseCode);
        }
Beispiel #2
0
        public HttpStatusCode GetAllEvents(DateTime start, DateTime end, out EventsRec rec)
        {
            ValidateIsBound();

            var    client       = new MoveRestClient(_device, _port, _username, _password);
            string body         = null;
            var    responseCode = client.GetAllEvents(start, end, out body);
            string msg          = (body.Length > _DATA_PREVIEW_SIZE) ? body.Substring(0, _DATA_PREVIEW_SIZE) : body;

            Trace.TraceInformation("\nRaw JSON data:  {0}", msg);

            rec = JsonHelper.JsonToEventsRec(body);
            return(responseCode);
        }
Beispiel #3
0
        public HttpStatusCode AddLinesSubscription(LinesSubscription linesSubscription)
        {
            ValidateIsBound();

            string body = linesSubscription.ToJsonAsItem();
            string msg  = (body.Length > _DATA_PREVIEW_SIZE) ? body.Substring(0, _DATA_PREVIEW_SIZE) : body;

            Trace.TraceInformation("\nRaw JSON data:  {0}{1}", msg, (msg.Length < body.Length) ? "..." : "");

            var client       = new MoveRestClient(_device, _port, _username, _password);
            var responseCode = client.AddLinesSubscription(body);

            return(responseCode);
        }
Beispiel #4
0
        public HttpStatusCode TurnEngineOff()
        {
            ValidateIsBound();

            string body = "{ \"data_service\" : \"stopped\", \"engine\" : \"stopped\" }";
            string msg  = (body.Length > _DATA_PREVIEW_SIZE) ? body.Substring(0, _DATA_PREVIEW_SIZE) : body;

            Trace.TraceInformation("\nRaw JSON data:  {0}{1}", msg, (msg.Length < body.Length) ? "..." : "");

            var client       = new MoveRestClient(_device, _port, _username, _password);
            var responseCode = client.SetState(body);

            return(responseCode);
        }
Beispiel #5
0
        public HttpStatusCode GetListOfBordersDeprecated(out BorderDefinitionList rec)
        {
            ValidateIsBound();

            var    client       = new MoveRestClient(_device, _port, _username, _password);
            string body         = null;
            var    responseCode = client.GetListOfBorders(out body);
            string msg          = (body.Length > _DATA_PREVIEW_SIZE) ? body.Substring(0, _DATA_PREVIEW_SIZE) : body;

            Trace.TraceInformation("\nRaw JSON data:  {0}", msg);

            rec = JsonHelper.JsonToBorderList(body);
            return(responseCode);
        }
Beispiel #6
0
        public HttpStatusCode GetListOfHotspotsDeprecated(out HotspotDefinitionList rec)
        {
            // This method used the old MOVE API REST calls that are now deprecated.  Call, instead "GetListOfHotspots".
            ValidateIsBound();

            var    client       = new MoveRestClient(_device, _port, _username, _password);
            string body         = null;
            var    responseCode = client.GetListOfHotspots(out body);
            string msg          = (body.Length > _DATA_PREVIEW_SIZE) ? body.Substring(0, _DATA_PREVIEW_SIZE) : body;

            Trace.TraceInformation("\nRaw JSON data:  {0}", msg);

            rec = JsonHelper.JsonToHotspotList(body);
            return(responseCode);
        }
Beispiel #7
0
        public HttpStatusCode GetSVGLayoutInfo(out Model.AreaDefinitionList areasList,
                                               out Model.LineDefinitionList linesList)
        {
            ValidateIsBound();

            var    client       = new MoveRestClient(_device, _port, _username, _password);
            string body         = null;
            var    responseCode = client.GetLayout(out body);
            string msg          = (body.Length > _DATA_PREVIEW_SIZE) ? body.Substring(0, _DATA_PREVIEW_SIZE) : body;

            Trace.TraceInformation("\nRaw JSON data:  {0}{1}", msg, (msg.Length < body.Length) ? "..." : "");

            areasList = XmlHelper.XmlToAreaDefinitionsList(body);
            linesList = XmlHelper.XmlToLineDefinitionsList(body);

            return(responseCode);
        }