public string getSensorInfoAsJSON()
        {
            var timer      = Stopwatch.StartNew();
            var controller = new MsmServiceController();
            MsmServiceInterface monitor = controller.getMonitorForRequest(request);

            log.Debug("@Created monitor#" + monitor);
            string json = "";

            try {
                response = monitor.poll();
                timer.Stop();
                response.time_taken = timer.Elapsed;
                json = Newtonsoft.Json.JsonConvert.SerializeObject(response);
                log.Debug("@JSON#" + json);
            } catch (MsmException e) {
                if (response.exception == null)
                {
                    response.exception = e;
                }
                timer.Stop();
                response.time_taken = timer.Elapsed;
                json = Newtonsoft.Json.JsonConvert.SerializeObject(response);
            } finally {
                monitor.dispose();
            }

            if (request.debug)
            {
                log.Debug(json);
                Debug.WriteLine(json);
            }
            return(json);
        }
 public MsmServiceExample(MsmMonitorRequest request)
 {
     this.request = request;
     response     = new MsmMonitorResponse {
         source  = getRequestMapping(),
         version = "1.0"
     };
 }
 public MintySenorMonitor(MsmMonitorRequest request)
 {
     this.request  = request;
     this.response = new MsmMonitorResponse();
     log.Debug("Created new MintySensorMonitor");
 }