Ejemplo n.º 1
0
 protected override void handleNodeNibbleReporting(byte[] nibbleArray, int numberOfNibbles)
 {
     List<CommandNibble> nibbles = new List<CommandNibble>();
     foreach (byte nibble in nibbleArray)
     {
         byte lo = (byte)(nibble & 0x0F);
         CommandNibble nibbleLow = new CommandNibble(lo);
         nibbles.Add(nibbleLow);
         if (nibbles.Count < numberOfNibbles)
         {
             byte hi = (byte)((nibble >> 4) & 0x0F);
             CommandNibble nibbleHi = new CommandNibble(hi);
             nibbles.Add(nibbleHi);
         }
     }
     OnNewCommandNibbles(nibbles);
 }
Ejemplo n.º 2
0
 private void ViperNode_NewSingleNodeCommandNibble(CommandNibble nibble)
 {
     this.CommandNibble = nibble;
 }
Ejemplo n.º 3
0
 public CommandNibble(CommandNibble nibble)
 {
     this.CommandNibbleByte = nibble.CommandNibbleByte;
 }
Ejemplo n.º 4
0
 private void toggleLowCommandNibbleParam()
 {
     var command = new CommandNibble(this.CommandNibble);
     command.toggleLowEnable();
     this.CommandNibbleParam = command;
     setCommandNibble();
 }
Ejemplo n.º 5
0
 protected void setDefaultParamValues()
 {
     this.m_cellGainParam = CELL_GAIN_DEFAULT;
     this.m_cellOffsetParam = CELL_OFFSET_DEFAULT;
     this.m_communicationChannelParam = COMMUNICATION_CHANNEL_MIN;
     this.m_packNumberParam = PACK_NUMBER_MIN;
     this.m_serialNumberParam = SERIAL_NUMBER_DEFAULT;
     this.m_filterValueParam = FILTER_VALUE_MIN;
     this.m_masterScalerParam = MASTER_SCALER_MIN;
     this.m_partNumberParam = PART_NUMBER_DEFAULT;
     this.m_nodeNumberParam = NODE_NUMBER_MIN;
     this.m_numberOfNodesParam = NUMBER_OF_NODES_DEFAULT;
     this.m_commandNibbleParam = new CommandNibble(0);
 }
Ejemplo n.º 6
0
        public NodeViewModel(SerialInterface node)
        {
            this.ViperNode = node;
            this.User = new CalibrationUtilityUser();
            this.m_softwareRevision = new SoftwareRevision(0, 0);
            this.m_nodeNumber = NODE_NUMBER_MIN;
            this.m_partNumber = PART_NUMBER_DEFAULT;
            this.m_voltage = 0;
            this.m_commandNibble = new CommandNibble(0);
            this.m_serialNumber = SERIAL_NUMBER_DEFAULT;
            this.m_packNumber = PACK_NUMBER_MIN;
            this.m_macAddress = new MacAddress(new byte[0]);
            this.m_filterValue = FILTER_VALUE_MIN;
            this.m_communicationChannel = COMMUNICATION_CHANNEL_MIN;
            this.m_cellOffset = CELL_OFFSET_DEFAULT;
            this.m_cellGain = CELL_GAIN_DEFAULT;
            this.m_cellCalibrated = 0;
            this.m_masterScaler = MASTER_SCALER_MIN;
            this.m_status = new NodeStatus(0);

            try
            {
                setupViperNode();
            }
            catch (Exception ex)
            {
                if (this.ViperNode != null)
                {
                    this.ViperNode.Dispose();
                }
                throw ex;
            }

            setDefaultParamValues();
            configureValidationRules();
            startUpdateThread();
        }
Ejemplo n.º 7
0
        public virtual void setNodeCommandNibble(CommandNibble nibble)
        {
#if NO_CONNECTION
            OnNewSingleNodeCommandNibble(nibble);
#else
            set_IntToByte((int)nibble.CommandNibbleByte, SET_COMMAND_NIBBLE);
#endif
        }
Ejemplo n.º 8
0
 protected void OnNewSingleNodeCommandNibble(CommandNibble value)
 {
     if (this.NewSingleNodeCommandNibble != null)
     {
         Task.Factory.StartNew(new Action(() => 
             this.NewSingleNodeCommandNibble(value)
         ));
     }
 }