Esempio n. 1
0
        public string Process(string json)
        {
            Response resultInfo = new Response();

            try
            {
                //string citFilePath, int fs, int upperFreq, int lowerFreq, int windowLen, List<double> upperChannelFreq, List<double> lowerChannelFreq, int segmentLen, out string filePath

                BatRequest request = JsonConvert.DeserializeObject <BatRequest>(json);

                string idfFilePath = "";

                var avgList = batProcess.BatProcessAll(request.path, request.fs, request.upperFreq, request.lowerFreq, request.windowLen,
                                                       request.upperChannelFreq, request.lowerChannelFreq, request.segmentLen, request.idfFilePath, out idfFilePath);

                string result = JsonConvert.SerializeObject(avgList);

                BatResult br = new BatResult();
                br.IdfFilePath = idfFilePath;
                br.AvgResult   = result;

                string data = JsonConvert.SerializeObject(br);

                resultInfo.flag = 1;
                resultInfo.msg  = "Success";
                resultInfo.data = data;
            }
            catch (Exception ex)
            {
                resultInfo.flag = 0;
                resultInfo.msg  = ex.Message;
            }

            return(JsonConvert.SerializeObject(resultInfo));
        }
Esempio n. 2
0
 public ValuesController(BatRequest batRequest)
 {
     _batRequest = batRequest;
 }