public void Post([FromBody]string remoteName, string commandName)
        {
            LircSharpAPI.DAL.DAL dal = new DAL.DAL();
            RemoteCode code = new RemoteCode();

            code.RemoteName = remoteName;
            code.Name = commandName;

            dal.SendRemoteCode(code);
        }
Beispiel #2
0
        public List<RemoteCode> GetRemoteCodes(Remote remote)
        {
            List<RemoteCode> remoteCodeList = new List<RemoteCode>();

            /* Build process info to call LIRC */
            ProcessStartInfo procInfo = new ProcessStartInfo();
            procInfo.FileName = "irsend";
            procInfo.UseShellExecute = false;
            procInfo.RedirectStandardOutput = true;

            /* Ask LIRC for a list of remotes */
            procInfo.Arguments = "list " + remote.Name + " \"\"";
            Process proc = Process.Start(procInfo);
            string strOut = proc.StandardOutput.ReadToEnd();
            proc.WaitForExit();

            /* Extract the remote names from the LIRC return*/
            using (StringReader reader = new StringReader(strOut))
            {
                string line = string.Empty;
                RemoteCode code;
                do
                {
                    line = reader.ReadLine();
                    if (line != null && line.StartsWith("irsend: ")) {
                        code = new RemoteCode();
                        code.Name = line.Split(' ')[2];
                        code.Command = line.Split(' ')[1];
                        code.RemoteName = remote.Name;

                    }
                } while (line != null);
            }

            return remoteCodeList;
        }
Beispiel #3
0
 public void AddCode(RemoteCode code)
 {
     _remoteCodes.Add(code);
 }
Beispiel #4
0
        public void SendRemoteCode(RemoteCode code)
        {
            /* Build process info to call LIRC */
            ProcessStartInfo procInfo = new ProcessStartInfo();
            procInfo.FileName = "irsend";
            procInfo.UseShellExecute = false;
            procInfo.RedirectStandardOutput = true;

            /* Ask LIRC for a list of remotes */
            procInfo.Arguments = "SEND_ONCE " + code.RemoteName + " " + code.Name;
            Process proc = Process.Start(procInfo);
        }