Пример #1
0
        private dynamic setRegs()
        {
            log.info("Got request for setting DSP registers");
            try {
                string         body       = this.getJsonBody();
                StringReader   memeReader = new StringReader(body);
                JsonTextReader memer      = new JsonTextReader(memeReader);
                JsonSerializer serializer = new JsonSerializer();
                RegSetRequest  r          = serializer.Deserialize <RegSetRequest>(memer);

                if (r.desc == String.Empty)
                {
                    log.info($"Got register set request with no description");
                }
                else
                {
                    log.info($"Got register set request with description: {r.desc}");
                }

                log.info($"Setting registers:");
                log.err($"WARNING: SET REGS IS CURRENTLY SET TO NO-OP");
                log.info(r.ToString());
                // var hur = controller.setRegs(r);
            }
            catch (Exception e) {
                log.err("set regs malformed request");
                Console.WriteLine(e);
                return(500);
            }
            log.ok("Registers have been set");
            return(200);
        }
Пример #2
0
        public bool writeRegRequest(RegSetRequest regs)
        {
            bool succ = true;

            for (int ii = 0; ii < regs.addresses.Length; ii++)
            {
                succ = (succ && writeReg(regs.addresses[ii], regs.values[ii]));
            }
            // S U C C
            return(succ);
        }
Пример #3
0
 public bool setRegs(RegSetRequest r)
 {
     return(this.dsp.writeRegRequest(r));
 }