Ejemplo n.º 1
0
        public void WriteItems(List <string> p_ItemsId, string p_Value)
        {
            m_ItemAccessMutex.WaitOne();

            try
            {
                int l_ItemsToWriteCount = p_ItemsId.Count;

                int[]    l_ServerHandleArray = new int[l_ItemsToWriteCount];
                object[] l_ValueArray        = new object[l_ItemsToWriteCount];
                int[]    l_ErrorArray;

                for (int i = 0; i < l_ItemsToWriteCount; ++i)
                {
                    l_ServerHandleArray[i] = m_ServerModel.GetServerHandleFromItemId(p_ItemsId[i]);

                    int      l_ClientHandle = m_ServerModel.GetClientHandleFromServerHandle(l_ServerHandleArray[i]);
                    IOPCItem l_Item         = m_ServerModel.GetItemFromClientHandle(l_ClientHandle);
                    l_ValueArray[i] = OPCUtility.StringToValue(l_Item.Type, p_Value);
                }
                m_Group.Write(l_ServerHandleArray, l_ValueArray, out l_ErrorArray);

                // TODO Check the error
            }
            catch (Exception l_Ex)
            {
                throw l_Ex;
            }
            finally
            {
                m_ItemAccessMutex.ReleaseMutex();
            }
        }