protected void GetStatusCallback(CallbackArgs callArgs) { acPowerAvailable = callArgs.GetDataFromReadBuffer <bool> (0); if (!acPowerAvailable) { Alarm.Post(powerLossAlarmIndex); } else { Alarm.Clear(powerLossAlarmIndex); } byte stateMask = callArgs.GetDataFromReadBuffer <byte> (1); for (var i = 0; i < channels.Length; ++i) { channels[i].SetValue(Utils.MaskToBoolean(stateMask, i)); } #if INCLUDE_POWER_STRIP_CURRENT var currentMask = callArgs.GetDataFromReadBuffer <byte> (2); for (var i = 0; i < channels.Length; ++i) { if (Utils.MaskToBoolean(currentMask, i)) { ReadOutletCurrentCommunication(i); } } #endif }
protected void GetValueCommunicationCallback(CallbackArgs args) { var ch = args.GetDataFromReadBuffer <byte> (0); var value = args.GetDataFromReadBuffer <short> (1); channels[ch].SetValue(value); }
protected void ReadOutletCurrentCallback(CallbackArgs callArgs) { var outletIndex = callArgs.GetDataFromReadBuffer <byte> (0); var outlet = channels[outletIndex] as PowerOutlet; outlet.SetAmperage(callArgs.GetDataFromReadBuffer <float> (1)); }
protected void GetInputCallback(CallbackArgs args) { var ch = args.GetDataFromReadBuffer <byte> (0); var value = args.GetDataFromReadBuffer <bool> (1); channels[ch].SetValue(value); }
protected void GetValueCommunicationCallback(CallbackArgs args) { byte ch = args.GetDataFromReadBuffer <byte> (0); short value = args.GetDataFromReadBuffer <short> (1); if (channels[ch].mode == Mode.Auto) { channels[ch].SetValue(value); } }
protected void GetInputsCallback(CallbackArgs args) { byte stateMask; stateMask = args.GetDataFromReadBuffer <byte> (0); for (int i = 0; i < channelCount; ++i) { if (channels[i].mode == Mode.Auto) { channels[i].SetValue(Utils.MaskToBoolean(stateMask, i)); } } }
protected void GetAllValuesCommunicationCallback(CallbackArgs args) { var values = new float[4]; for (int i = 0; i < values.Length; ++i) { values[i] = args.GetDataFromReadBuffer <float> (i * 4); } for (int i = 0; i < channels.Length; ++i) { channels[i].SetValue(values[i]); } }
protected void GetAllValuesCommunicationCallback(CallbackArgs args) { var values = new short[4]; for (int i = 0; i < values.Length; ++i) { values[i] = args.GetDataFromReadBuffer <short> (i * 2); } for (int i = 0; i < channels.Length; ++i) { if (channels[i].mode == Mode.Auto) { channels[i].SetValue(values[i]); } } }