Click here to Skip to main content
15,889,877 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: progid Pin
User 2155975-Sep-08 0:55
User 2155975-Sep-08 0:55 
GeneralRe: progid Pin
George_George5-Sep-08 1:06
George_George5-Sep-08 1:06 
GeneralRe: progid Pin
User 2155975-Sep-08 1:24
User 2155975-Sep-08 1:24 
GeneralRe: progid Pin
George_George5-Sep-08 1:43
George_George5-Sep-08 1:43 
Questionproblem in reading data from com port Pin
manju23reddy4-Sep-08 20:22
manju23reddy4-Sep-08 20:22 
QuestionRe: problem in reading data from com port Pin
Roger Stoltz4-Sep-08 22:19
Roger Stoltz4-Sep-08 22:19 
AnswerRe: problem in reading data from com port Pin
manju23reddy5-Sep-08 8:05
manju23reddy5-Sep-08 8:05 
AnswerRe: problem in reading data from com port Pin
Roger Stoltz7-Sep-08 22:43
Roger Stoltz7-Sep-08 22:43 
When using the "Bluetooth Serial Port Profile" there are three main issues to overcome:
1. Setting up the Bluetooth connection to make it behave like a serial device and
2. Setting up the serial device
3. Read and write from/to the port

When you say you have tried to open the serial device, but it presents itself as "PIM" instead of a serial device, you probably have a problem with the first issue above. To verify this you can try using the Hyperterminal to send and receive the exact same data with the same port settings as you're trying to do in your code.
If that test succeeds you can start worrying about your code.

Regarding programming for serial communication I have done it quite a lot, but I've never used ::SetCommMask() or ::WaitCommEvent().
I use overlapped mode and I have one worker thread that reads data and another worker thread that sends data. The data to be sent is put in a queue from which the sending thread reads it and calls ::WriteFile(). A semaphore that the sending thread is waiting on with ::WaitForMultipleObjects() is released when a new block of data is added to the send queue.
The reading thread issues a read request with a call to ::ReadFile(). Since overlapped mode is used the call will return immediately and the reading thread can wait on the event in the OVERLAPPED struct that will get signalled when data arrives on the port. The read data will be put in a queue and a user defined windows message gets posted to the main thread in order to inform it about the newly received data so it can take proper action.
Of course the queues are protected with critical sections.

Joseph Newcomer has written a good article about serial port programming here[^].
He uses a slightly different approach than I've described above, but the mind set is very much the same.


"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown


Questionstring trim and toupper/tolower Pin
George_George4-Sep-08 19:47
George_George4-Sep-08 19:47 
AnswerRe: string trim and toupper/tolower Pin
Nibu babu thomas4-Sep-08 19:59
Nibu babu thomas4-Sep-08 19:59 
GeneralRe: string trim and toupper/tolower Pin
George_George4-Sep-08 20:04
George_George4-Sep-08 20:04 
GeneralRe: string trim and toupper/tolower Pin
Nibu babu thomas4-Sep-08 21:03
Nibu babu thomas4-Sep-08 21:03 
GeneralRe: string trim and toupper/tolower Pin
George_George4-Sep-08 21:40
George_George4-Sep-08 21:40 
GeneralRe: string trim and toupper/tolower Pin
Nibu babu thomas4-Sep-08 21:48
Nibu babu thomas4-Sep-08 21:48 
GeneralRe: string trim and toupper/tolower Pin
George_George4-Sep-08 21:58
George_George4-Sep-08 21:58 
GeneralRe: string trim and toupper/tolower Pin
Nibu babu thomas4-Sep-08 22:19
Nibu babu thomas4-Sep-08 22:19 
GeneralRe: string trim and toupper/tolower Pin
George_George4-Sep-08 22:47
George_George4-Sep-08 22:47 
AnswerRe: string trim and toupper/tolower Pin
Naveen4-Sep-08 20:10
Naveen4-Sep-08 20:10 
GeneralRe: string trim and toupper/tolower Pin
George_George4-Sep-08 20:11
George_George4-Sep-08 20:11 
AnswerRe: string trim and toupper/tolower Pin
Rajesh R Subramanian4-Sep-08 20:41
professionalRajesh R Subramanian4-Sep-08 20:41 
GeneralRe: string trim and toupper/tolower Pin
George_George4-Sep-08 21:39
George_George4-Sep-08 21:39 
QuestionClass initialization and memory allocation Pin
Christian Flutcher4-Sep-08 19:11
Christian Flutcher4-Sep-08 19:11 
AnswerRe: Class initialization and memory allocation [modified] Pin
_AnsHUMAN_ 4-Sep-08 19:27
_AnsHUMAN_ 4-Sep-08 19:27 
GeneralRe: Class initialization and memory allocation Pin
Christian Flutcher4-Sep-08 19:40
Christian Flutcher4-Sep-08 19:40 
GeneralRe: Class initialization and memory allocation Pin
Cedric Moonen4-Sep-08 19:57
Cedric Moonen4-Sep-08 19:57 

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.