コード例 #1
0
        public static HarmonyDocument SequenceDocument(int sequenceId)
        {
            var document = new HarmonyDocument();

            var element = new Element("oa");

            element.Attributes.Add("xmlns", "connect.logitech.com");
            element.Attributes.Add("mime", "vnd.logitech.harmony/vnd.logitech.harmony.engine?holdAction");

            var action = new HarmonySequenceAction {
                sequenceId = sequenceId
            };
            var json = new JavaScriptSerializer().Serialize(action);

            // At this point our valid json won't work - we need to break it so it looks like:
            // {"sequenceId"::123}
            // note double colons

            json = json.Replace(":", "::");

            element.Value = string.Format("action={0}:status=press", json);

            document.AddChild(element);

            return(document);
        }
コード例 #2
0
        public static HarmonyDocument GetCurrentActivityDocument()
        {
            var document = new HarmonyDocument();

            document.AddChild(CreateOaElement("getCurrentActivity"));
            return(document);
        }
コード例 #3
0
        public static HarmonyDocument IRCommandDocument(string deviceId, string command)
        {
            var document = new HarmonyDocument();

            var element = new Element("oa");

            element.Attributes.Add("xmlns", "connect.logitech.com");
            element.Attributes.Add("mime", "vnd.logitech.harmony/vnd.logitech.harmony.engine?holdAction");

            var action = new HarmonyIRCommandAction {
                type = "IRCommand", deviceId = deviceId, command = command
            };
            var json = new JavaScriptSerializer().Serialize(action);

            // At this point our valid json won't work - we need to break it so it looks like:
            // {"type"::"IRCommand","deviceId"::"deviceId","command"::"command"}
            // note double colons

            json = json.Replace(":", "::");

            element.Value = string.Format("action={0}:status=press", json);

            document.AddChild(element);

            return(document);
        }
コード例 #4
0
        public static HarmonyDocument ConfigDocument()
        {
            var document = new HarmonyDocument();

            document.AddChild(CreateOaElement("config"));
            return(document);
        }
コード例 #5
0
        public static HarmonyDocument StartActivityDocument(string activityId)
        {
            var document = new HarmonyDocument();

            var element = CreateOaElement("startactivity");

            element.Value = $"activityId={activityId}:timestamp=0";
            document.AddChild(element);
            return(document);
        }
コード例 #6
0
ファイル: HarmonyDocuments.cs プロジェクト: slavikko/harmony
        public static HarmonyDocument GetCurrentActivityDocument()
        {
            var document = new HarmonyDocument();

            var element = new Element("oa");
            element.Attributes.Add("xmlns", "connect.logitech.com");
            element.Attributes.Add("mime", "vnd.logitech.harmony/vnd.logitech.harmony.engine?getCurrentActivity");

            document.AddChild(element);
            return document;
        }
コード例 #7
0
        public static HarmonyDocument ConfigDocument()
        {
            var document = new HarmonyDocument();

            var element = new Element("oa");

            element.Attributes.Add("xmlns", "connect.logitech.com");
            element.Attributes.Add("mime", "vnd.logitech.harmony/vnd.logitech.harmony.engine?config");

            document.AddChild(element);
            return(document);
        }
コード例 #8
0
        public static HarmonyDocument LogitechPairDocument(string token)
        {
            var document = new HarmonyDocument();

            var element = new Element("oa");

            element.Attributes.Add("xmlns", "connect.logitech.com");
            element.Attributes.Add("mime", "vnd.logitech.connect/vnd.logitech.pair");
            element.Value = $"token={token}:name=foo#iOS6.0.1#iPhone";
            document.AddChild(element);
            return(document);
        }
コード例 #9
0
ファイル: HarmonyDocuments.cs プロジェクト: slavikko/harmony
        public static HarmonyDocument StartActivityDocument(string activityId)
        {
            var document = new HarmonyDocument();

            var element = new Element("oa");
            element.Attributes.Add("xmlns", "connect.logitech.com");
            element.Attributes.Add("mime", "vnd.logitech.harmony/vnd.logitech.harmony.engine?startactivity");
            element.Value = string.Format("activityId={0}:timestamp=0", activityId);

            document.AddChild(element);
            return document;
        }
コード例 #10
0
ファイル: HarmonyDocuments.cs プロジェクト: slavikko/harmony
        public static HarmonyDocument LogitechPairDocument(string token)
        {
            var document = new HarmonyDocument();

            var element = new Element("oa");
            element.Attributes.Add("xmlns", "connect.logitech.com");
            element.Attributes.Add("mime", "vnd.logitech.connect/vnd.logitech.pair");
            element.Value = string.Format("token={0}:name={1}#{2}", token, "foo", "iOS6.0.1#iPhone");

            document.AddChild(element);
            return document;
        }
コード例 #11
0
        public static HarmonyDocument StartActivityDocument(string activityId)
        {
            var document = new HarmonyDocument();

            var element = new Element("oa");

            element.Attributes.Add("xmlns", "connect.logitech.com");
            element.Attributes.Add("mime", "vnd.logitech.harmony/vnd.logitech.harmony.engine?startactivity");
            element.Value = string.Format("activityId={0}:timestamp=0", activityId);

            document.AddChild(element);
            return(document);
        }
コード例 #12
0
        public static HarmonyDocument LogitechPairDocument(string token)
        {
            var document = new HarmonyDocument();

            var element = new Element("oa");

            element.Attributes.Add("xmlns", "connect.logitech.com");
            element.Attributes.Add("mime", "vnd.logitech.connect/vnd.logitech.pair");
            element.Value = string.Format("token={0}:name={1}#{2}", token, "foo", "iOS6.0.1#iPhone");

            document.AddChild(element);
            return(document);
        }
コード例 #13
0
        public static HarmonyDocument IrCommandDocument(string deviceId, string command)
        {
            var document = new HarmonyDocument();

            var action = new HarmonyAction {
                type = "IRCommand", deviceId = deviceId, command = command
            };
            var json = new JavaScriptSerializer().Serialize(action);

            // At this point our valid json won't work - we need to break it so it looks like:
            // {"type"::"IRCommand","deviceId"::"deviceId","command"::"command"}
            // note double colons

            json = json.Replace(":", "::");
            var element = CreateOaElement("holdAction");

            element.Value = $"action={json}:status=press";

            document.AddChild(element);

            return(document);
        }
コード例 #14
0
ファイル: HarmonyDocuments.cs プロジェクト: slavikko/harmony
        public static HarmonyDocument IRCommandDocument(string deviceId, string command)
        {
            var document = new HarmonyDocument();

            var element = new Element("oa");
            element.Attributes.Add("xmlns", "connect.logitech.com");
            element.Attributes.Add("mime", "vnd.logitech.harmony/vnd.logitech.harmony.engine?holdAction");

            var action = new HarmonyAction { type = "IRCommand", deviceId = deviceId, command = command };
            var json = new JavaScriptSerializer().Serialize(action);

            // At this point our valid json won't work - we need to break it so it looks like:
            // {"type"::"IRCommand","deviceId"::"deviceId","command"::"command"}
            // note double colons

            json = json.Replace(":", "::");

            element.Value = string.Format("action={0}:status=press", json);

            document.AddChild(element);

            return document;
        }
コード例 #15
0
        public static HarmonyDocument SequenceDocument(int sequenceId)
        {
            var document = new HarmonyDocument();

            var element = new Element("oa");
            element.Attributes.Add("xmlns", "connect.logitech.com");
            element.Attributes.Add("mime", "vnd.logitech.harmony/vnd.logitech.harmony.engine?holdAction");

            var action = new HarmonySequenceAction { sequenceId = sequenceId };
            var json = new JavaScriptSerializer().Serialize(action);

            // At this point our valid json won't work - we need to break it so it looks like:
            // {"sequenceId"::123}
            // note double colons

            json = json.Replace(":", "::");

            element.Value = string.Format("action={0}:status=press", json);

            document.AddChild(element);

            return document;
        }