Problem with Win32-SerialPort over bluetooth @ windows + active perl

C

ctloh

Hello guys,

I encounter some problems with Wini32-SerialPort module. Not sure is
this is the correct place to ask....

Anyway...

What I want is to setup my mobile phone as a GSM modem and connect from
my laption using either IR or bluetooth.

In order to do that, I need to create a "config" file for different
comm port. However, setup the config which utilise IR did not give me
any problem. But the bluetooth is complaining about the Baud Rate.

Have anyone encounter this before ?

Here is the program that actually generate the config file.

__Start__
use Win32::SerialPort 0.14;

if (@ARGV ne 2) {
print "\n\nUsage : $0 <COMM PORT> <outputfile>\nE.g $0 COM1
abc.cfg\n";
exit(0);
}


my $PortObj = new Win32::SerialPort ("$ARGV[0]" )
|| die "$0: Can't open COMM Port $ARGV[0] !\n$0: $!\n"; #
$quiet is optional

print "$0: Connected to $ARGV[0]...\n";
$PortObj->user_msg(ON);

$PortObj->databits(8);
$PortObj->baudrate(9600);
$PortObj->parity("none");
$PortObj->stopbits(1);
$PortObj->handshake("rts");
$PortObj->buffers(4096, 4096);

$PortObj->write_settings || undef $PortObj;


$PortObj->save("./$ARGV[1]");


$PortObj->baudrate(300);
$PortObj->restart("./$ARGV[1]"); # back to 9600 baud


$PortObj->close || die "$0: Failed to close !";
undef $PortObj; # frees memory back to
perl

print "\n\n$0: Config file created in $ARGV[1].\n";

exit(0);

__Stop__

Here is the error message with I try to setup a bluetooth config.

D:\MyPerl\>perl createCommPortCfg.pl COM9 z1010-bluetooth-com9.cfg

- Connected to COM9...
Could not set baudrate on COM9 at createCommPortCfg.pl line 17
Missing REQUIRED setting for BAUD at createCommPortCfg.pl line 23
write_settings failed, closing port at createCommPortCfg.pl line 23
Can't call method "save" on an undefined value at createCommPortCfg.pl
line 26.


Appreciate if anyone can help.

Best Regards
Chi Tsung
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top