Exemplo n.º 1
0
        public SEND_CMD_RET_VALUE send_cmd_to_device_async(byte cmdid, object data, List <string> product_id_keys)
        {
            SEND_CMD_RET_VALUE result;

            if (!global_static_var.is_init_ok)
            {
                result = SEND_CMD_RET_VALUE.ER_NONE_INIT;
            }
            else
            {
                foreach (string current in product_id_keys)
                {
                    if (!call.m_devList.ContainsKey(current))
                    {
                        result = SEND_CMD_RET_VALUE.ER_Product_ID_NO_EXIST;
                        return(result);
                    }
                }
                IPC_SIMPLE_REQUEST iPC_SIMPLE_REQUEST = new IPC_SIMPLE_REQUEST();
                iPC_SIMPLE_REQUEST.cmd_id     = (ushort)cmdid;
                iPC_SIMPLE_REQUEST.dev_object = data;
                iPC_SIMPLE_REQUEST.fileName   = null;
                if (product_id_keys != null)
                {
                    iPC_SIMPLE_REQUEST.product_ids = new string[product_id_keys.Count];
                    product_id_keys.CopyTo(iPC_SIMPLE_REQUEST.product_ids, 0);
                }
                for (int i = 0; i < iPC_SIMPLE_REQUEST.product_ids.Length; i++)
                {
                    bool flag = false;
                    if (!call.m_devList.ContainsKey(iPC_SIMPLE_REQUEST.product_ids[i]))
                    {
                        flag = true;
                    }
                    DEVICE_INFO dEVICE_INFO;
                    if (call.m_devList.TryGetValue(iPC_SIMPLE_REQUEST.product_ids[i], out dEVICE_INFO))
                    {
                        if (dEVICE_INFO.is_disable_flag)
                        {
                            flag = true;
                        }
                    }
                    if (flag)
                    {
                        iPC_SIMPLE_REQUEST.product_ids[i] = null;
                    }
                }
                iPC_SIMPLE_REQUEST.order = (call.cmd_order += 1L);
                if (-1 == this.CallIPCSend(iPC_SIMPLE_REQUEST))
                {
                    result = SEND_CMD_RET_VALUE.IPC_communication_FAILED;
                }
                else
                {
                    result = SEND_CMD_RET_VALUE.POST_TO_RS_SERVER_OK;
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        public SEND_CMD_RET_VALUE send_file_async(string filefullpath, List <string> product_id_keys)
        {
            SEND_CMD_RET_VALUE result;

            if (!global_static_var.is_init_ok)
            {
                result = SEND_CMD_RET_VALUE.ER_NONE_INIT;
            }
            else
            {
                foreach (string current in product_id_keys)
                {
                    if (!call.m_devList.ContainsKey(current))
                    {
                        result = SEND_CMD_RET_VALUE.ER_Product_ID_NO_EXIST;
                        return(result);
                    }
                }
                IPC_SIMPLE_REQUEST iPC_SIMPLE_REQUEST = new IPC_SIMPLE_REQUEST();
                iPC_SIMPLE_REQUEST.cmd_id     = 6;
                iPC_SIMPLE_REQUEST.dev_object = null;
                iPC_SIMPLE_REQUEST.fileName   = filefullpath;
                if (product_id_keys != null)
                {
                    iPC_SIMPLE_REQUEST.product_ids = new string[product_id_keys.Count];
                    product_id_keys.CopyTo(iPC_SIMPLE_REQUEST.product_ids, 0);
                }
                iPC_SIMPLE_REQUEST.order = (call.cmd_order += 1L);
                if (-1 == this.CallIPCSend(iPC_SIMPLE_REQUEST))
                {
                    result = SEND_CMD_RET_VALUE.IPC_communication_FAILED;
                }
                else
                {
                    result = SEND_CMD_RET_VALUE.POST_TO_RS_SERVER_OK;
                }
            }
            return(result);
        }