Managing the Bit Switches Decoding
MC_SwitchDecode
CommandCode | TableName | FieldName | ByteOrder | UniqueID | |
FC | This is not | Status | 1 | 1 | |
FC | Needed | Future | 1 | 1 | |
This table gives the FC is being interrupted. The MC_Server will check if the HeartbeatATG record has a value of NOT zero for this Fieldnames. I don’t think we need the Tablename column in here as we already know it from the CommandDecodeTable

The ByteOrder tell the MC_Server to take the first byte and decode it, this will work if there is more than one byte to decode.
The data will go into this table;
MC_BitSwitchInfo –with the first record of HeartbeatATG decoded
RecordID | FieldName | Byte Order | Switch1 | Switch2 | Switch3 | Switch4 | Switch5 | Switch6 | Switch7 | Switch8 | UniqueID |
8873 | Status | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
| Future | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
The RecordID = the UniqueID of HeartbeatATG

MC_BitSwitchLookup
FieldName | ByteOrder | Switch1 | Switch2 | Switch3 | Switch4 | Switch5 | Switch6 | Switch7 | Switch8 | UniqueID |
Status | 1 | | | | | | | | | |
Future | 1 | Generator | | | | | | | | |
CREATE TABLE `MC_BitSwitchLookUp` (
`FieldName` varchar(50) NOT NULL,
`ByteOrder` tinyint(2) NOT NULL,
`Switch1` varchar(50) NOT NULL,
`Switch2` varchar(50) NOT NULL,
`Switch3` varchar(50) NOT NULL,
`Switch4` varchar(50) NOT NULL,
`Switch5` varchar(50) NOT NULL,
`Switch6` varchar(50) NOT NULL,
`Switch7` varchar(50) NOT NULL,
`Switch8` varchar(50) NOT NULL,
`UniqueId` int(10) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`UniqueId`),
UNIQUE KEY `UniqueId_UNIQUE` (`UniqueId`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
CREATE TABLE `MC_BitSwitchDecode` (
`CommandCode` varchar(2) NOT NULL,
`FieldName` varchar(50) NOT NULL,
`ByteOrder` tinyint(2) NOT NULL,
`Description` varchar(100) NOT NULL DEFAULT 'Description',
`UniqueId` int(10) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`UniqueId`),
UNIQUE KEY `UniqueId_UNIQUE` (`UniqueId`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
CREATE TABLE `MC_BitSwitchInfo` (
`RecordID` int(10) NOT NULL,
`FieldName` varchar(50) NOT NULL,
`ByteOrder` tinyint(2) NOT NULL,
`Switch1` tinyint(2) NOT NULL,
`Switch2` tinyint(2) NOT NULL,
`Switch3` tinyint(2) NOT NULL,
`Switch4` tinyint(2) NOT NULL,
`Switch5` tinyint(2) NOT NULL,
`Switch6` tinyint(2) NOT NULL,
`Switch7` tinyint(2) NOT NULL,
`Switch8` tinyint(2) NOT NULL,
`UniqueId` int(10) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`UniqueId`),
UNIQUE KEY `UniqueId_UNIQUE` (`UniqueId`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;


