static Services() { Messages = new MessagesService(); Config = Config.FromFile; if (Config == null) { Messages.Error("Unable to load config.json file", MessageCategory.App); Config = Config.Default; } Store = new Store(); Signals = new Signals(); PlcConnection = new PlcConnection(); CheckingsService = new CheckingsService(); }
private bool OpenConnection() { try { Client = new SiemensDevice(IPEndPoint, SiemensDeviceType.S71500); Licenser.LicenseKey = "lgAAAA29d9Q/xtEBlgFDb21wYW55TmFtZT1Mb2dvVGVrICBHbWJIIEdlc2VsbHNjaGFmdCBmw7xyIEluZm9ybWF0aW9uc3RlY2hub2xvZ2llO0ZpcnN0TmFtZT1DaHJpc3RvcGhlcjtMYXN0TmFtZT1Lw7ZtcGVsO0VtYWlsPWNocmlzdG9waGVyLmtvZW1wZWxAbG9nb3Rlay1nbWJoLmRlO0NvdW50cnlOYW1lPUQ7Q2l0eU5hbWU9TWFya3RoZWlkZW5mZWxkO1ppcENvZGU9OTc4Mjg7U3RyZWV0TmFtZT1BbiBkZXIgS8O2aGxlcmVpIDc7U3RyZWV0TnVtYmVyPTtSZXRhaWxlck5hbWU9VHJhZWdlciBJbmR1c3RyeSBDb21wb25lbnRzO1ZvbHVtZT0xO1NlcmlhbE51bWJlcj0xMDAxO1N1cHBvcnRFeHBpcnlEYXRlPTA2LzE0LzIwMTcgMDA6MDA6MDA7VXNlTm9CcmFuZGluZz1GYWxzZTtDb250YWN0Rmlyc3ROYW1lPTtDb250YWN0TGFzdE5hbWU9GQwP4pqjgIkqQ3rkHBitUvrSkZA87Wf+QGXIW7F54n+Fnqh7gR8rfZy/oUnKKTGz"; PlcConnection = Client.CreateConnection(); PlcConnection.Open(); return(true); } catch (Exception ex) { LogFiler.Log(Category.Error, MethodBase.GetCurrentMethod().DeclaringType.Name + "_" + MethodBase.GetCurrentMethod().Name + ": " + ex.Message); return(false); } }
public void BindToPlc(PlcConnection plc, int index) { this.plc = plc; this.indexAtPlc = index; }
// Use this for initialization void Start() { plc = GetComponent <PlcConnection>(); }