zidoune06
10th January 2013, 15:21
Hello All,
I begin to work with Qt so sorry if the answer is easy for you.
I am working on a software which communicates with a device.
I use the QextSerialPort librairie and it is working fine.
In fact, it is working fine when I send to my device a constant frame.
/* Erasing Command */
static const char eraseCmd[] = {0x11, 0x02, 0x00, 0x00, 0x00, 0x02 };
QByteArray Command = QByteArray::fromRawData(eraseCmd, sizeof(eraseCmd));
But it is not working when I want to add in the frame a counter as an idFrame;
For example, if I send the 499th frame, I would like to send :
{beginning if the frame....,0x01, 0xF3,...end of the frame }.
I try a lot of functions, but maybe not the good one, like setNum(idFrame,16) but it returns :
Frame[X] = 3 ;
Frame[X+1] = F ;
Frame[X+2] = 1 ;
The best way for me will be to get :
Frame[X] = "0x01" ;
Frame[X+1] = "0xF3" ;
Can someone help me ?
Thank you in advance for your support.
Zidoune
I begin to work with Qt so sorry if the answer is easy for you.
I am working on a software which communicates with a device.
I use the QextSerialPort librairie and it is working fine.
In fact, it is working fine when I send to my device a constant frame.
/* Erasing Command */
static const char eraseCmd[] = {0x11, 0x02, 0x00, 0x00, 0x00, 0x02 };
QByteArray Command = QByteArray::fromRawData(eraseCmd, sizeof(eraseCmd));
But it is not working when I want to add in the frame a counter as an idFrame;
For example, if I send the 499th frame, I would like to send :
{beginning if the frame....,0x01, 0xF3,...end of the frame }.
I try a lot of functions, but maybe not the good one, like setNum(idFrame,16) but it returns :
Frame[X] = 3 ;
Frame[X+1] = F ;
Frame[X+2] = 1 ;
The best way for me will be to get :
Frame[X] = "0x01" ;
Frame[X+1] = "0xF3" ;
Can someone help me ?
Thank you in advance for your support.
Zidoune