static void ThreadMainWithParameters(ACI aci, Agilor.Interface.Val.Value val)
        {
            try { aci.SetValue(val); } catch { }
            string debugMsg = "ACI IP:" + aci.IP.ToString() + "; ACI PORT:" + aci.Port.ToString() + "; ACI SERVERNAME:" + aci.Name + "; VAl:" + val.Val.ToString() + "; Thread id:" + Thread.CurrentThread.ToString();

            System.Diagnostics.Debug.Write(debugMsg);
        }
        public AgilorResponseData SetTargetValue(string targetName, dynamic obj)
        {
            AgilorResponseData response = new AgilorResponseData();

            if (!checkACIObject())
            {
                response.responseMessage = "Get All Device Names And Status ERROR: ACI IS NULL, Server Need Be Restart!";
                response.responseCode    = (int)AgilorResponseData.RESPONSE_CODE.RESPONSE_AGILOR_ACI_IS_NULL;
                return(response);
            }

            try
            {
                response.responseMessage = "Set Target Value Success!";
                response.responseCode    = (int)AgilorResponseData.RESPONSE_CODE.RESPONSE_NORMAL;

                object val = null;
                try
                {
                    switch (agilorACI.GetTarget(targetName).Type)
                    {
                    case Agilor.Interface.Val.Value.Types.BOOL:
                        val = obj.targetValue.ToObject <bool>();
                        break;

                    case Agilor.Interface.Val.Value.Types.FLOAT:
                        val = obj.targetValue.ToObject <float>();
                        break;

                    case Agilor.Interface.Val.Value.Types.LONG:
                        val = obj.targetValue.ToObject <int>();
                        break;

                    case Agilor.Interface.Val.Value.Types.STRING:
                        val = obj.targetValue.ToObject <string>();
                        break;
                    }
                }
                catch (Exception ex)
                {
                    response.responseMessage = ex.ToString();
                    response.responseCode    = (int)AgilorResponseData.RESPONSE_CODE.RESPONSE_TARGET_VALUE_ERROR;
                    return(response);
                }

                agilorACI.SetValue(new Agilor.Interface.Val.Value(targetName, val));
                response.responseBody = agilorACI.QuerySnapshots(targetName);
            }
            catch (Exception ex)
            {
                response.responseMessage = ex.ToString();
                response.responseCode    = (int)AgilorResponseData.RESPONSE_CODE.RESPONSE_UNKNOWN_ERROR;
            }

            return(response);
        }