Click here to Skip to main content
15,885,309 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: case sensitive sort of chars/strings...including numbers, symbols etc.. Pin
Aescleal18-Jan-11 19:57
Aescleal18-Jan-11 19:57 
GeneralRe: case sensitive sort of chars/strings...including numbers, symbols etc.. [modified] Pin
tukbriz22-Jan-11 11:52
tukbriz22-Jan-11 11:52 
Questionbest way to avoid calling virtual methods (directly or indirectly) from a constructor Pin
bob1697218-Jan-11 9:00
bob1697218-Jan-11 9:00 
AnswerRe: best way to avoid calling virtual methods (directly or indirectly) from a constructor Pin
Aescleal18-Jan-11 9:28
Aescleal18-Jan-11 9:28 
AnswerRe: best way to avoid calling virtual methods (directly or indirectly) from a constructor Pin
TheGreatAndPowerfulOz18-Jan-11 11:26
TheGreatAndPowerfulOz18-Jan-11 11:26 
AnswerRe: best way to avoid calling virtual methods (directly or indirectly) from a constructor Pin
Emilio Garavaglia18-Jan-11 22:37
Emilio Garavaglia18-Jan-11 22:37 
GeneralRe: best way to avoid calling virtual methods (directly or indirectly) from a constructor Pin
bob1697219-Jan-11 3:39
bob1697219-Jan-11 3:39 
QuestionBluetooth - COM port reading Pin
tnt00017-Jan-11 21:48
tnt00017-Jan-11 21:48 
Hi everybody,
I have some problems reading the COM ports. In particular I have used WaitForMultipleObjects and ReadFile, that permit me
listen the COM port selected.
I use this code for reading the COM port while I was trasfering a file with Bluetooth from the phone to the computer.
I can open the right COM port (they are 4, one for the input, one for the output and two for some remote control, i think)
but in any of them I can see nothing in the buffer, because everytime the ::WaitForMultipleObjects switch
in the default case, exiting from the cycle.

My question is:
Is this the correct way to read the bluetooth packets arriving in the COM ports?
If, yes, why during the data transfert is like if no package where transfering in the port?

I have used also CSerial class present in this site with the same result.

Thank,
Anne

//[...]

HANDLE hevtOverlapped = ::CreateEvent(0,TRUE,FALSE,0);;
if (hevtOverlapped == 0)
{
cout << "Unable to create manual-reset event for overlapped I/O.\n";
return -1;
}

// Setup the overlapped structure
OVERLAPPED ov = {0};
ov.hEvent = hevtOverlapped;

// Open the "STOP" handle
string name1 = "Overlapped_Stop_Event";
HANDLE hevtStop = ::CreateEvent(0,TRUE,FALSE, name1.c_str());

// Keep reading data, until an EOF (CTRL-Z) has been received
bool fContinue = true;
do
{
// Wait for an event
lLastError = serial.WaitEvent(&ov);
if (lLastError != ERROR_SUCCESS)
{
cout << "Unable to wait for a COM-port event.\n";
return -1;
}

// Setup array of handles in which we are interested
HANDLE ahWait[2];
ahWait[0] = hevtOverlapped;
ahWait[1] = hevtStop;

// Wait until something happens
switch (::WaitForMultipleObjects(sizeof(ahWait)/sizeof(*ahWait),ahWait,FALSE,500))
{
case WAIT_OBJECT_0:
{
// Read data from the COM-port (ReadFile)
[...]
}
break;

case WAIT_OBJECT_0+1:
{
// Set the continue bit to false, so we'll exit
fContinue = false;
}
break;

default:
{
// Something went wrong
// exit
[...]
}
break;
}
}
while (fContinue);

//[...]
AnswerRe: Bluetooth - COM port reading Pin
CPallini17-Jan-11 21:55
mveCPallini17-Jan-11 21:55 
AnswerRe: Bluetooth - COM port reading Pin
Andrew Brock17-Jan-11 22:31
Andrew Brock17-Jan-11 22:31 
GeneralRe: Bluetooth - COM port reading Pin
tnt00017-Jan-11 23:48
tnt00017-Jan-11 23:48 
GeneralRe: Bluetooth - COM port reading Pin
Andrew Brock18-Jan-11 0:40
Andrew Brock18-Jan-11 0:40 
GeneralRe: Bluetooth - COM port reading Pin
tnt00018-Jan-11 2:43
tnt00018-Jan-11 2:43 
GeneralRe: Bluetooth - COM port reading Pin
Andrew Brock18-Jan-11 3:40
Andrew Brock18-Jan-11 3:40 
GeneralRe: Bluetooth - COM port reading Pin
tnt00018-Jan-11 5:27
tnt00018-Jan-11 5:27 
GeneralRe: Bluetooth - COM port reading Pin
Andrew Brock18-Jan-11 14:07
Andrew Brock18-Jan-11 14:07 
QuestionDifference between _stat() and _fstat() Pin
gomathylakshmanan17-Jan-11 19:47
gomathylakshmanan17-Jan-11 19:47 
AnswerRe: Difference between _stat() and _fstat() Pin
Andrew Brock17-Jan-11 19:53
Andrew Brock17-Jan-11 19:53 
QuestionCTypedPtrArray & CStringArray Pin
mesajflaviu17-Jan-11 9:10
mesajflaviu17-Jan-11 9:10 
AnswerRe: CTypedPtrArray & CStringArray Pin
Chris Meech17-Jan-11 10:01
Chris Meech17-Jan-11 10:01 
GeneralRe: CTypedPtrArray & CStringArray Pin
mesajflaviu17-Jan-11 19:06
mesajflaviu17-Jan-11 19:06 
AnswerRe: CTypedPtrArray & CStringArray Pin
Andrew Brock17-Jan-11 16:04
Andrew Brock17-Jan-11 16:04 
GeneralRe: CTypedPtrArray & CStringArray Pin
mesajflaviu17-Jan-11 19:38
mesajflaviu17-Jan-11 19:38 
GeneralRe: CTypedPtrArray & CStringArray Pin
Andrew Brock17-Jan-11 19:51
Andrew Brock17-Jan-11 19:51 
AnswerRe: CTypedPtrArray & CStringArray Pin
mesajflaviu17-Jan-11 22:11
mesajflaviu17-Jan-11 22:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.