Exemple #1
0
 public NITag(string name, string path, bool active, NITagType type) : this()
 {
     this.name   = name;
     this.path   = path;
     this.active = active;
     this.type   = type;
 }
Exemple #2
0
        public string CreateOrGetTag(string path, NITagType type, bool permanent)
        {
            Create(path, type, permanent);
            string        tagJson = NetworkUtil.HttpGetString(GETTAGVALUE + path, NIAUTHHEADER);
            JsonNITagWrap tag     = JsonConvert.DeserializeObject <JsonNITagWrap>(tagJson);

            return(tag.GetValue());
        }
Exemple #3
0
        public void Create(string path, NITagType type, bool permanent = false)
        {
            NITag tag = new NITag(path, type);

            if (permanent)
            {
                tag.nitagRetention = NITagRetention.PERMANENT;
            }
            Create(tag);
        }
Exemple #4
0
        public void UpdateTagMultipleValues(string path, NITagType type, List <NITagValue> values)
        {
            string data = "[";

            foreach (NITagValue value in values)
            {
                data += "{ \"value\": { \"type\": \"" + type + "\", \"value\": \"" + value.value + "\" }, \"timestamp\":\"" + value.timestamp + "\"},";
            }
            data += "]";
            NetworkUtil.HttpPostString(TAGS + "/" + path + "/update-values", NIAUTHHEADER, data);
        }
Exemple #5
0
 public NITag(string path, NITagType type) : this(path, path, false, type)
 {
 }
Exemple #6
0
 public void UpdateTag(string path, string value, NITagType type)
 {
     NetworkUtil.HttpPutString(TAGS + "/" + path + "/values/current", NIAUTHHEADER, "{ \"value\": { \"type\": \"" + type + "\", \"value\": \"" + value + "\" }}");
 }
Exemple #7
0
 public void CreateOrUpdateTag(string path, string value, NITagType type, bool permanent)
 {
     Create(path, type, permanent);
     UpdateTag(path, value, type);
 }