public void TestGetLocaleID01() { //testing -- OpcServer opcServer = new OpcServer(); Accessor opcServerAccessor = ReflectionAccessor.Wrap(opcServer); opcServerAccessor.SetField("ifServer", new OPCServerComClass()); opcServerAccessor.SetField("ifCommon", ((IOPCBrowseServerAddressSpace)opcServerAccessor.GetField("ifServer"))); int lcid; //Test Procedure Call opcServer.GetLocaleID(out lcid); //Post Condition Check }
public string conectar() { //variável auxiliar que será retornada string aux = ""; Boolean erro = false; //conexão com o Servidor OPC; Srv = new OpcServer(); int rtc = Srv.Connect("HITecnologia.SOS.DA.1"); int localeID = Srv.GetLocaleID(out localeID); if (HRESULTS.Failed(rtc)) { aux = "Erro na conexão: "; erro = true; } else { aux = "Conectado com Sucesso. LocaleId=" + localeID; } if (!erro) { srwGroup = new SyncIOGroup(Srv); OPCItemState resultadoLeitura; int auxRtc; auxRtc = srwGroup.Read(OPCDATASOURCE.OPC_DS_DEVICE, "Server_2.Driver_1000.DEV255.state", out resultadoLeitura); if (HRESULTS.Failed(auxRtc)) { aux = "Erro na Leitura: " + resultado(auxRtc); } else { aux = resultadoLeitura.DataValue.ToString(); } } return(aux); }