Ejemplo n.º 1
0
        public string PostWriteValueHttps(string sessionIP, RequestObject requestObject, string id, string new_value, string ip)
        {
            OZW772_RMU7201 obj = GetObject(sessionIP, requestObject.URLs);

            if (obj == null)
            {
                throw new Exception("Need Initialize");
            }

            Console.WriteLine("Set value: sessionIP=" + sessionIP + "; id=" + id + "; new_value=" + new_value);
            if (string.IsNullOrEmpty(new_value))
            {
                return("ok");
            }
            //obj.writeToLog("Start PostData ----------------------------------------");
            try {
                if (!obj.IsInitialized)
                {
                    return(null);
                }
                var result = obj.postWriteValueHttps(requestObject, requestObject.URL, id, new_value);
                //obj.writeToLog("End PostData ----------------------------------------");
                return(result);
            }
            catch (Exception ex)
            {
                Console.WriteLine("url=" + requestObject.URLs + ":" + ex.ToString());
            }
            return(null);
        }
Ejemplo n.º 2
0
        OZW772_RMU7201 GetObject(string sessionIP, string URLs)
        {
            OZW772_RMU7201 obj = null;

            if (objs.ContainsKey(sessionIP))
            {
                obj = objs[sessionIP];
            }
            return(obj);
        }
Ejemplo n.º 3
0
        public void StartUpdating(string sessionIP, RequestObject requestObject)
        {
            OZW772_RMU7201 obj = GetObject(sessionIP, requestObject.URLs);

            if (obj == null)
            {
                throw new Exception("Need Initialize");
            }
            obj.StartUpdating();
        }
Ejemplo n.º 4
0
        public void StopUpdating(string sessionIP, RequestObject requestObject)
        {
            if (string.IsNullOrEmpty(sessionIP))
            {
                foreach (var obj1 in objs.Values)
                {
                    obj1.StopUpdating();
                }
                return;
            }

            OZW772_RMU7201 obj = GetObject(sessionIP, requestObject.URLs);

            if (obj == null)
            {
                throw new Exception("Need Initialize");
            }
            obj.StopUpdating();
        }
Ejemplo n.º 5
0
 public SCADAObject[] GetData(string sessionIP, RequestObject requestObject)
 {
     try
     {
         OZW772_RMU7201 obj = GetObject(sessionIP, requestObject.URLs);
         if (obj == null)
         {
             throw new Exception("Need Initialize");
         }
         //obj.writeToLog("Start GetData ----------------------------------------");
         SCADAObject[] result = obj.ReadData();
         //obj.writeToLog("End GetData ----------------------------------------");
         return(result);
     }
     catch (Exception ex)
     {
         Console.WriteLine("url=" + requestObject.URLs + ":" + ex.ToString());
         throw ex;
     }
     return(null);
 }
Ejemplo n.º 6
0
        public void Init(string sessionIP, RequestObject requestObject)
        {
            //foreach (var requestObject in requestObjects)

            {
                OZW772_RMU7201 obj = null;
                if (!objs.ContainsKey(sessionIP))
                {
                    obj = new OZW772_RMU7201();
                    objs.Add(sessionIP, obj);
                }
                else
                {
                    obj = objs[sessionIP];
                }
                if (!obj.IsInitialized)
                {
                    obj.Init(sessionIP, requestObject);
                }
            }
        }