I am getting an error
'Cannot implicitly convert type 'bool' to 'int' '
while using BitVector.CreateSection to get integers from odd numbers of bits.
I used this in the same way in another section and it worked fine. I
can't see why I get the error now. Does anyone see what I am doing
wrong
Here is my code:
public class ReadDopFixAlt
{
private BitVector32.Section sectAlt1;
private BitVector32.Section sectAlt2;
private BitVector32.Section sectFix;
private BitVector32.Section sectDGPS;
private BitVector32.Section sectHDOP;
public ReadDopFixAlt()
{
sectAlt1 = BitVector32.CreateSection(32767);
sectAlt2 = BitVector32.CreateSection(15, sectAlt1);
sectFix = BitVector32.CreateSection(3, sectAlt2);
sectDGPS = BitVector32.CreateSection(1, sectFix);
sectHDOP = BitVector32.CreateSection(1023,
sectDGPS);
}
public string ParseDopFixAlt(int data)
{
// Create an instance of BitVector32 using
// the data passed to this method.
BitVector32 word = new BitVector32(data);
int Alt1 = word[Alt1];
int Alt2 = word[Alt2];
int Fix = word[Fix];
int DGPS = word[DGPS];
int HDOP = word[HDOP];
StringBuilder tb = new StringBuilder();
tb.Append(Fix.ToString() + ',' + ' ');
tb.Append(DGPS.ToString() + ',' + ' ');
tb.Append(HDOP.ToString() + ',' + '
');
tb.Append(Alt1.ToString());
return tb.ToString();
}
}

BitVector32.Section should be int not bool
JodyC
int Alt1 = word[Alt1];
should be: (and so on for the next four lines)
int Alt1 = word[sectAlt1];
Stephane T.
Paola80
I get the error on the 5 lines starting with
int Alt1 = word[Alt1];
MBMSMichael