/// <summary> /// Terminates a connection to the scale. /// </summary> public void Close() { if (this.oposScale != null) { this.oposScale.ReleaseDevice(); this.oposScale.Close(); this.oposScale = null; } }
/// <summary> /// Establishes a connection to the specified scale. /// </summary> /// <param name="peripheralName">Name of scale device to open.</param> /// <param name="peripheralConfig">Configuration parameters of the peripheral.</param> public void Open(string peripheralName, PeripheralConfiguration peripheralConfig) { this.oposScale = new OPOSScale(); // Open this.oposScale.Open(peripheralName); OposHelper.CheckResultCode(this, this.oposScale.ResultCode); // Claim this.oposScale.ClaimDevice(OposHelper.ClaimTimeOut); OposHelper.CheckResultCode(this, this.oposScale.ResultCode); // Enable/Configure this.oposScale.DeviceEnabled = true; this.oposScale.PowerNotify = (int)OPOS_Constants.OPOS_PN_ENABLED; }