Hello ChrisW thank you so much for taking time and helping me out with my problem.
I have a doubt i actually wanted Each byte in the QByteArray to be of 16-bits size.?
I think now each byte is QByteArray is of 8-bits. So i am loosing the data,
only the first 8 bits are taken so i am loosing the other 8 bits. I am getting only "b7" . If i have a 16-bit size for each byte then i will get the right data.
ORed = 0000 0011 1011 0111
0 3 b 7
ORed = 0000 0011 1011 0111
0 3 b 7
To copy to clipboard, switch view to plain text mode
This is how i tried your code but i din't get any value appended to the Text Browser.
Is this the right way to do it.
ba[0] = 0x1d;
ba[1] = 0x17;
ba[2] = 0x11;
ba[3] = 0x00;
for (int i = 0; i < ba.size(); i+=2)
{
//result.append(((ba.at(i) << 5)|(ba.at(i+1))));
quint16 result=((static_cast<unsigned int>(ba.at(i) << 5))|(static_cast<unsigned int>(ba.at(i+1))));
}
da.append(result.toHex());
textBrowser->append(da);
QByteArray result;
QByteArray ba;
QByteArray da;
ba[0] = 0x1d;
ba[1] = 0x17;
ba[2] = 0x11;
ba[3] = 0x00;
for (int i = 0; i < ba.size(); i+=2)
{
//result.append(((ba.at(i) << 5)|(ba.at(i+1))));
quint16 result=((static_cast<unsigned int>(ba.at(i) << 5))|(static_cast<unsigned int>(ba.at(i+1))));
}
da.append(result.toHex());
textBrowser->append(da);
To copy to clipboard, switch view to plain text mode
If i have each byte in QByteArray ba; as 16-Bits size. i think my problem will be solved.How do you think i should do it Chris. ?
regards
Bookmarks