You Are Here:

Community: Developer Discussion Boards

#1 Old Problem: 10 Bluetooth Ports simultaneously - 2006-07-02, 23:19

Join Date: Jul 2006
Posts: 4
Alco Fresh
Offline
Registered User
Does anyone here have experiences with running 10 bluetooth devices simultaneously? I'd like to synchronize 10 videos on Nokia N70 mobile phones, and I found a solution by using the keypress / key_modifiers modules (from http://cyke64.googlepages.com/). I open 10 ports for the bluetooth console of every single cellphone, but I can't connect more that 5 or 6 devices, then I get an error message on the other devices. 5 devices run perfectly. Is there a limit for the maximal number of ports opened at the same time? Or is there a mistake in my script?
Maybe some of you know an answer...

require "serialport.so"
require "socket"

class SerialController

attr_reader :cr, :cz, :atTimeout, :sp
attr_writer :connected, :sp

@@cr = "\n\r"
@@cz = "\032"
@@atTimeout = 140
@@connected = false


@@respStack = []

def initialize
@cr = @@cr
end

def it()
return @respStack.pop
end

## clear screen, given you work with a terminal screen
def atCLS()
true ## to be defined
end

def atConnect(serlDrivrPath,baud,bit,stopBit,serlPort)
@sp = SerialPort.new(serlDrivrPath, baud,bit,stopBit,serlPort)
puts "#{serlDrivrPath} connected successfully!"
end

def atDisconnect()
@sp.close
end

def atSend(sendStr)
puts sendStr
@sp.write(sendStr)
end

def atGetLine()
t = Thread.new() {
while true do
while @@sp.gets do
resp = $_
puts resp
Thread.exit
end
end
}
if t.join(@@atTimeout) == nil then puts "Waiting for serial data a timeout occured!" end
end

def atWait(strPttrn)
ts = Time.new.to_i
t = Thread.new() {
while true do
while @sp.gets do
resp = $_[0..($_.length-3)]
if (resp.index(strPttrn) == 0) then
@@respStack.push(resp)
t.exit
end
puts resp
end
end
}
if t.join(@@atTimeout) == nil then puts "Waiting for #{strPttrn} a timeout occured!" end
end

def atWaitMux(strPttrnHead,*strPttrnTail)
t = Thread.new() {
while true do
while resp = @sp.gets do
resp = resp[0..($_.length-3)]
if (resp == strPttrnHead) || (strPttrnTail.include? resp) then
puts resp
@respStack.push(resp)
Thread.exit
end
puts resp
end
end
}
if t.join(@@atTimeout) == nil then puts "Waiting for #{strPttrn} et al a timeout occured!" end
end



def atSay(str)
true ## to be defined
end

def atAsk(title,default)
alert = NSAlert.alloc.init
alert.setMessageText("RubySMS")
alert.setAlertStyle(NSInformationalAlertStyle)
alert.setInformativeText(title)
alert.addButtonWithTitle("ok")
alert.beginSheetModalForWindow(@mainWindow,:modalDelegate, self, :didEndSelector, nil, :contextInfo,nil)
end

def atAskP(titel)
true ## to be defined
end

def atWriteln(str)
puts str
end

def atSetDevParamter()
true ## set serial parameters
end

def atDelay(secs)
sleep secs
end

def atParseValueWith(strValue,delimiter,*withParams)
array = {}
listParams = strValue.split(delimiter)
i = 0
withParams.each do |param|
array[param] = listParams[i]
i += 1
end
return array
end

end

n70_1 = SerialController.new
n70_2 = SerialController.new
n70_3 = SerialController.new
n70_4 = SerialController.new
n70_5 = SerialController.new
n70_6 = SerialController.new
n70_7 = SerialController.new
n70_8 = SerialController.new
n70_9 = SerialController.new
n70_10 = SerialController.new


n70_1.atConnect("/dev/cu.N70_1", 9600,8,1,SerialPort::NONE)
n70_2.atConnect("/dev/cu.N70_2", 9600,8,1,SerialPort::NONE)
n70_3.atConnect("/dev/cu.N70_3", 9600,8,1,SerialPort::NONE)
n70_4.atConnect("/dev/cu.N70_4", 9600,8,1,SerialPort::NONE)
n70_5.atConnect("/dev/cu.N70_5", 9600,8,1,SerialPort::NONE)
n70_6.atConnect("/dev/cu.N70_6", 9600,8,1,SerialPort::NONE)
n70_7.atConnect("/dev/cu.N70_7", 9600,8,1,SerialPort::NONE)
n70_8.atConnect("/dev/cu.N70_8", 9600,8,1,SerialPort::NONE)
n70_9.atConnect("/dev/cu.N70_9", 9600,8,1,SerialPort::NONE)
n70_10.atConnect("/dev/cu.N70_10", 9600,8,1,SerialPort::NONE)

num_connected = 0


t1 = Thread.new() {
n70_1.atWait("Connected.")
num_connected += 1
puts "N70_1 is connected: #{num_connected}"
t1.exit
}

t2 = Thread.new() {
n70_2.atWait("Connected.")
num_connected += 1
puts "N70_2 is connected: #{num_connected}"
t2.exit
}
t3 = Thread.new() {
n70_3.atWait("Connected.")
num_connected += 1
puts "N70_3 is connected: #{num_connected}"
t3.exit

}

t4 = Thread.new() {
n70_4.atWait("Connected.")
num_connected += 1
puts "N70_4 is connected: #{num_connected}"
t4.exit

}

t5 = Thread.new() {
n70_5.atWait("Connected.")
num_connected += 1
puts "N70_5 is connected: #{num_connected}"
t5.exit
}
t6 = Thread.new() {
n70_6.atWait("Connected.")
num_connected += 1
puts "N70_6 is connected: #{num_connected}"
t6.exit
}

t7 = Thread.new() {
n70_7.atWait("Connected.")
num_connected += 1
puts "N70_7 is connected: #{num_connected}"
t7.exit
}

t8 = Thread.new() {
n70_8.atWait("Connected.")
num_connected += 1
puts "N70_8 is connected: #{num_connected}"
t8.exit
}

t9 = Thread.new() {
n70_9.atWait("Connected.")
num_connected += 1
puts "N70_9 is connected: #{num_connected}"
t9.exit
}

t10 = Thread.new() {
n70_10.atWait("Connected.")
num_connected += 1
puts "N70_10 is connected: #{num_connected}"
t10.exit
}



while num_connected != 10 do
true
end
Reply With Quote

#2 Old Re: Problem: 10 Bluetooth Ports simultaneously - 2006-07-03, 13:05

Join Date: Jul 2004
Posts: 17
jkirma
Offline
Registered User
I believe there's a limit of eight (?) devices in single picocell imposed by Bluetooth protocol design. Certainly there's a limit of seven or less concurrent connections imposed by Symbian OS. You might be able to work around the problem by connecting each device separately, and scheduling task to begin after certain delay (delay being calculated for each device on the time of sending the data, of course). Some of these could run in parallel, though.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
two bluetooth connections simultaneously matrix241 Mobile Java Networking & Messaging & Security 16 2009-01-05 07:40
Bluetooth problem in Symbian C++ code vardhman Bluetooth Technology 0 2005-01-02 09:17
6230 global problems with Bluetooth asterixmlm General Discussion 1 2004-12-10 18:12
7650 + 3Com Bluetooth + PCSuite 1.2: COM ports not visible tohveli Bluetooth Technology 0 2003-03-17 17:02
7650 Bluetooth Modem with Toshiba Tecra 9000 Windows XP - RESOLVED Now! d0lph1n Bluetooth Technology 5 2003-02-07 12:25

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia