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

C / C++ / MFC

 
GeneralRe: CSocket threading issue Pin
Roger Stoltz3-Sep-08 23:04
Roger Stoltz3-Sep-08 23:04 
GeneralRe: CSocket threading issue Pin
tony_Udz4-Sep-08 1:43
tony_Udz4-Sep-08 1:43 
Questionsetup package creation Pin
AnithaSubramani3-Sep-08 20:30
AnithaSubramani3-Sep-08 20:30 
AnswerRe: setup package creation Pin
Cedric Moonen3-Sep-08 20:38
Cedric Moonen3-Sep-08 20:38 
GeneralRe: setup package creation Pin
AnithaSubramani3-Sep-08 20:41
AnithaSubramani3-Sep-08 20:41 
GeneralRe: setup package creation Pin
Rajesh R Subramanian3-Sep-08 20:49
professionalRajesh R Subramanian3-Sep-08 20:49 
GeneralRe: setup package creation Pin
AnithaSubramani3-Sep-08 20:58
AnithaSubramani3-Sep-08 20:58 
Questionproblem in connection to serial port Pin
manju23reddy3-Sep-08 20:07
manju23reddy3-Sep-08 20:07 
hi i have written the following code to receive data from mobile using bluetooth through serial communication.

but it is not working

<code>
#include &lt;stdio.h&gt;
#include &lt;conio.h&gt;
#include &lt;windows.h&gt;

#include "stdafx.h"
#include "bluetoothConnection.h"


bool BluetoothConnection::openPort(char *portNum)
{
if (portNum != NULL)
{
hcomm = CreateFile((LPCWSTR)portNum, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, NULL, 0);
if (hcomm == INVALID_HANDLE_VALUE)
{
return false;
}
else
{
return true;
}
}
else
{
return false;
}
}

bool BluetoothConnection::initPort()
{
dcb.fOutxCtsFlow = false;
dcb.fOutxDsrFlow = false;
dcb.fDtrControl = DTR_CONTROL_DISABLE;
dcb.fOutX = false;
dcb.fInX = false;
dcb.fRtsControl = RTS_CONTROL_DISABLE;

//time settings
timeouts.ReadIntervalTimeout = 20;
timeouts.ReadTotalTimeoutMultiplier = 10;
timeouts.ReadTotalTimeoutConstant = 100;
if (!SetCommTimeouts(hcomm, &amp;timeouts))
{
return false;
}
else
{
return true;
}
}

void BluetoothConnection::ReadPort()
{
memset(chRead, '\x91', 250);
Sleep(1000L);
ReadFile(hcomm, chRead, 250, &amp;dwRead, NULL);
}

void BluetoothConnection::display()
{
printf("%s\n", chRead);
}
int main()
{
BluetoothConnection *bth1 = new BluetoothConnection();
if (bth1 != NULL)
{
if (bth1-&gt;openPort("COM4"))
{
if (bth1-&gt;initPort())
{
bth1-&gt;ReadPort();
printf("the data from com4 is ....\n");
bth1-&gt;display();
}
else
{
printf("fail in init\n");
}
}
else
{
printf("unable to connect\n");
}

}
else
{
printf("unable to connect failed in initial state\n");
}
Sleep(1000L);
return 0;
}
</code>

its failing in CreateFile function coz its returns 0xffffff..

can this code be used for bluetooth coz i found such code for serial port comm and infrared.


is there any configurations between mobile and pc before running this application if there please provide me the steps..
AnswerRe: problem in connection to serial port Pin
Cedric Moonen3-Sep-08 20:26
Cedric Moonen3-Sep-08 20:26 
GeneralRe: problem in connection to serial port Pin
manju23reddy3-Sep-08 21:28
manju23reddy3-Sep-08 21:28 
GeneralRe: problem in connection to serial port Pin
Cedric Moonen3-Sep-08 21:37
Cedric Moonen3-Sep-08 21:37 
GeneralRe: problem in connection to serial port Pin
manju23reddy3-Sep-08 21:50
manju23reddy3-Sep-08 21:50 
QuestionCOM type name Pin
George_George3-Sep-08 19:58
George_George3-Sep-08 19:58 
QuestionStatic text as a link. Pin
Le@rner3-Sep-08 19:57
Le@rner3-Sep-08 19:57 
AnswerRe: Static text as a link. Pin
_AnsHUMAN_ 3-Sep-08 20:04
_AnsHUMAN_ 3-Sep-08 20:04 
GeneralRe: Static text as a link. Pin
Le@rner3-Sep-08 20:27
Le@rner3-Sep-08 20:27 
AnswerRe: Static text as a link. Pin
enhzflep3-Sep-08 20:12
enhzflep3-Sep-08 20:12 
GeneralRe: Static text as a link. Pin
Le@rner3-Sep-08 20:49
Le@rner3-Sep-08 20:49 
GeneralRe: Static text as a link. Pin
ThatsAlok3-Sep-08 21:09
ThatsAlok3-Sep-08 21:09 
GeneralRe: Static text as a link. Pin
Le@rner3-Sep-08 21:36
Le@rner3-Sep-08 21:36 
GeneralRe: Static text as a link. Pin
_AnsHUMAN_ 3-Sep-08 22:12
_AnsHUMAN_ 3-Sep-08 22:12 
QuestionRead and write in file Pin
polopo3-Sep-08 19:48
polopo3-Sep-08 19:48 
AnswerRe: Read and write in file Pin
santhoshv843-Sep-08 19:56
santhoshv843-Sep-08 19:56 
AnswerRe: Read and write in file Pin
_AnsHUMAN_ 3-Sep-08 20:00
_AnsHUMAN_ 3-Sep-08 20:00 
GeneralRe: Read and write in file Pin
polopo3-Sep-08 20:52
polopo3-Sep-08 20:52 

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.