Inconsistent prob when adding listeners to serial ports for sending AT cmds

I have an app that sends and receives SMSs from two different cell phone carriers (lets say verizon and sprint by example).
For that matter i have two cell phones, exactly the same model, one from each carrier, connected to the PC serial ports, COM, COM6 and COM7 being aware that they are available.
-The application communicats with the phones through the a serial communication API and sending AT commands.
-The application can send messages correctly from both phones within the same transaction, this is, i click in send message and the message is sent from both phones.
The problem is when receiving, getting the SMS received by the phones:
-When i have ONE phone connected to the PC it work properly for both phones.
-When i have BOTH phones connected, only Carrier1 phone receives properly.
When checking, i just find out that the problem rises when i try to add the listeners (see code comments below).
When both phones connected there seems to be a problem that i cant figure out, and may be its a conceptual misunderstanding from me.
I attach the code if you can help me,
thank you,
fernando
// class fields
private static String PORT_CARRIER1;
private static String PORT_CARRIER2;
private static CommPortIdentifier portId;
private static Enumeration portsList;
private static SerialPort carrier1SP;
private static SerialPort carrier2SP;
private static InputStream carrier1_input;
private static InputStream carrier2_input;
private static OutputStream carrier1_output;
private static OutputStream carrier2_output;
// ... all the code below is from the app method where everything is initializated     
portsList = CommPortIdentifier.getPortIdentifiers();
while(portsList.hasMoreElements()){
     portId = (CommPortIdentifier) portsList.nextElement();
     if(portId.getPortType() == CommPortIdentifier.PORT_SERIAL){          
          // try to open ports
          try{
               if(portId.getName().equals(PORT_CARRIER1))
                    carrier1SP = (SerialPort) portId.open("SMS", 5000);
               else if(portId.getName().equals(PORT_CARRIER2))
                    carrier2SP = (SerialPort) portId.open("SMS", 5000);
               else System.out.println("Error " + portId.getName());
          }catch(PortInUseException piue){
               System.out.println("Exception while opening serial ports: "+piue.getMessage());
               continue;
          // try to open input streams
          try{
               if(portId.getName().equals(PORT_CARRIER1))
                    carrier1_input = carrier1SP.getInputStream();
               else if(portId.getName().equals(PORT_CARRIER2))
                    carrier2_input = carrier2SP.getInputStream();
          }catch(IOException ioe){
               System.out.println("Exception while opening input streams: "+ioe.getMessage());
               continue;
          // try to open output streams
          try{
               if(portId.getName().equals(PORT_CARRIER1))
                    carrier1_output = carrier1SP.getOutputStream();
               else if(portId.getName().equals(PORT_CARRIER2))
                    carrier2_output = carrier2SP.getOutputStream();
          }catch(IOException ioe){
               System.out.println("Exception while opening output streams: "+ioe.getMessage());
               continue;
          // adding listeners
          try{
               if(portId.getName().equals(PORT_CARRIER1))
                    carrier1SP.addEventListener(new ListenerPuerto(this, carrier1_input, "CARRIER1"));
               else if(portId.getName().equals(PORT_CARRIER2))
                    carrier2SP.addEventListener(new ListenerPuerto(this, carrier2_input, "CARRIER2"));
          }catch(TooManyListenersException tmle){
               System.out.println("Error while adding listeners: " + tmle.getMessage());
               continue;
          // Adding specific event to listeners
          if(portId.getName().equals(PORT_CARRIER1))
               carrier1SP.notifyOnDataAvailable(true);
          else if(portId.getName().equals(PORT_CARRIER2))
               carrier2SP.notifyOnDataAvailable(true);
          // Setting params to serial communication
          try{
               if(portId.getName().equals(PORT_CARRIER1)){
                    carrier1SP.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
                    carrier1 = true;
               }else if(portId.getName().equals(PORT_CARRIER2)){
                    carrier2SP.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
                    carrier2 = true;
          }catch(UnsupportedCommOperationException uscoe){
               System.out.println("Error while setting params for serial communication: " + uscoe.getMessage());
               continue;
          // ... nothing else important ...thanks in advance

Thinking of a java application as its what I am most
comfortable with, but also thinking of having an
apache server, and using jsp pages or servlets...
because I hate formatting things in a java frame..
have never quite mastered that! Any thoughts on what
I should use?I'd prefer a Swing GUI for a maximum of controls. If you have any problems regarding layout, you can post concrete questions here (or even better: the Swing forum).
And my main stumbling block would be how do I send
signals to the green light from the computer? How do
I get signals from the light beams to the computer?
How do I use a serial port (for eg) from a java app.There's an additional library for serial I/O, it's named javax.comm ... should be downloadable somewhere on the java.sun.com site.

Similar Messages

  • Connection to serial port for communication RFID

    HI,
    I have occurred problem in communication to serial port for accessing the RFID
    through Serial Port COM1 or COM2 . I got garbage values of Card .
    Please give me the code for accessing serial port and indicter the cadr is detected by RFID and read the data on card.

    EHAG microchip 13,56 MHz dual reader and Mifare 1KB contactless smartcard.
    I've succeed to retrieve the data from the transponder (card) but it just only once when i click the button from my application. My question is how do i retrieve the data continuously from the card for every few milliseconds?
    sorry for my language.

  • Serial port for console access to switch

    Just got a Netgear L2 Switch, and need to use VT100 terminal emulation to connect to the switch's serial port.
    Does anyone know how to enable the Xserve's serial port for this type of job? When running Zterm for OS X I get an "Error: 16 opening port" and I'm at a loss for how to do it. I've heard that USB to Serial adapters have been working, but it seems silly that the serial port wouldnt work.

    Thanks Camelot, your advice was spot on.
    Just to close the topic:
    Edit "/System/Library/StartupItems/SerialTerminalSupport/SerialTerminalSupport"
    and change the line:
    ENABLESERIALTERMINAL=$TRUE
    to
    ENABLESERIALTERMINAL=$FALSE
    also, may be redundant with the last step but I edited /etc/ttys and changed:
    tty.serial "/usr/libexec/getty serial.9600" vt100 on secure
    to
    tty.serial "/usr/libexec/getty serial.9600" vt100 off secure
    Finally, dont be an idiot like I am, and leave the XServe case lock on... this will prevent the port from operating, and cause you to go crazy.
    TwoNine

  • When I enter the serial number for photoshop CS6 on my second machine, I get the message - Your comp

    When I enter the serial number for Photoshop CS6 on my second machine, I get the message,  -Your computer seems to be off line -....    But it is on line.  Can you help?

    Please check your system date.
    Any mismatch can lead to the error.
    -Pragya

  • Hello Forum, you need a serial ports for software icprog to program EPROM and Pic

    Hello Forum, you need a serial ports for software icprog to program EPROM and Pic.I was wondering if this or a similar card is compatible with my Lenovo Desktop h50-50 -->  -> PCI-E 2 serial ports and 1 parallel port PCI-Controller Card 3 Port ► http://fli.zz.mu/cut/scheda-pci-e-2-porte-seriali-1-porta-parallela .
    My my Lenovo Desktop h50-50 upgrade to win 10,  If it is not compatible to win 10. I could use it too virtualizing win Xp? Thank since TIME FOR ANSWERS, I apologize for my bad English.
    THANK Joe  

    Unfortunately, no Sanyo phones are iSync compatible so you will not be able to synchronize your Contacts and Calendars with the phone.
    Also, you may have problems with the Bluetooth adapter you purchased, as the only one officially supported by Apple for use with Macs is the D-Link DBT-120.
    The Official Apple list of iSync compatible devices is here:
    http://www.apple.com/macosx/features/isync/devices.html
    It's always a good idea to check this list before purchasing a new phone.
    Other phones are supported by third party plugins from here and here. But still no Samsung, Sanyo, LG etc. who all use thier own proprietary syncing protocols rather than the industry standard SyncML. These manufacturers also don't provide Mac software with their phones like the do for Windows users.
    I'm afraid you're not going to have much luck if you stick with the Sanyo. I would seriously consider taking it back and swapping it for one of the handsets on the above linked pages. Personally I would recommend a Sony Ericsson model. I've always had excellent Mac compatibility with those.

  • Process Name when we connect via Serial Port ,Its URGENT !!!

    Hi,
    I am working with Sun Solaris 9 sparc and in my application,I have to communicate with the serial port.
    For every connection we made, in Solaris it creates a process.So Can anyone tell me the name of the process when we connect serial cable??
    like USB connection /dev/usb0 or /dev/hiddev0 process is created..
    Thanks in Adavnce ...

    Sangyesh wrote:
    Hi,
    I am working with Sun Solaris 9 sparc and in my application,I have to communicate with the serial port.Outbound to a device, or inbound to a login shell or something else...?
    For every connection we made, in Solaris it creates a process.Are you talking about 'telnet' or 'ssh'? Those work differently from serial connections.
    So Can anyone tell me the name of the process when we connect serial cable??You might have a login listener if you configure it, otherwise, nothing is running.
    You need to provide more details about how you intend to use the serial cable. I can't tell from your post.
    Darren

  • Serial port for an alarm system

    I have an alarm system set to receive inputs from LabVIEW-controlled digital I/O cards. All the digital ports are fully utilized for data input. When an alarm state is reached, we would like to use the serial port to relay the alarm condition to a global monitoring system. I don't know if the serial ports can accomplish this as the global monitoring system typically looks for a dry contact or a relay to be tripped. What are the capabilities of the serial port along these lines? Can I have it set to constantly send a 5V signal of dummy data and then drop that data transmission when the alarm condition is reached?

    RS-232 can be +-12V or more depending on how the physical drivers are configured. However, if you can handle these voltages, then you can simply assert or deassert one of the modem control lines (RTS or DTR) to indicate your alarm state. If you want to use the TX line, you can set and clear the break condition. If you hook up a multimeter to one of these signals and experiment with NI-VISA in LabVIEW, you should be able to create a signal that will work in your system.
    However, if you need +5/GND, you can use an RS-485 port which generates (well, in a way) signals between 0 and 5V (or 0 and 3.3V depending on the system). RS-485 is a differential signaling system, but you can just throw away one of the lines. In this case you'll use TX+, TX-, RTS+, or
    RTS- depending on what you need.

  • Second serial port for CompactRIO

    I would like to reiterate the question posted here.
    Is it possible to add a second serial port to a CompactRIO chassis?
    Using the FPGA seems like it would not actually be transmitting at RS-232 levels, and using an Ethernet-to-Serial Port converter sounds more promising, but that means having the drivers loaded properly.  Are these the only options, and are they even feasible?  Having a multi serial port module seems like it would be a nice addition to the CompactRIO suite.

    Hi m3nth,
    The link involving using the FPGA and digital modules has been successful in the past with many people and like the tutorial says, a big part with this is converting to voltage using a voltage translator.  With respect to the ENET option, the link below can be used to direct you to the products that we have that you may want to try to implement multiple serial ports.  I've done some research and it appears that there shouldn't be an issue using the converters with a real-time system.  When using the ENET converters, keep in mind that it may cause some more latency in your network as opposed to regular serial transmission.  If you have any more questions, please let me know.  Thanks!
    http://sine.ni.com/nips/cds/view/p/lang/en/nid/10043
    Regards
    Noah R
    Applications Engineering
    National Instruments

  • Serial Port for Palm

    Hi:
    I have a little school project and need to use a Palm device serial port. The only problem is that it seems serial port implementation is only available for MIDPv2.0 and for Palm there's just an implementation for MIDPv1.0. I wonder if anyone knows if there's a sollution to this problem or other way to get to use serial port through MIDVPv1.0.
    Thanks.
    Alex

    You can get the adaptor at just about any computer store. Its called a serial to USB adaptor. There should also include a disk or have a download of some kind for the driver of the device. Now this may or may not work due to the m100 was not designed for a USB connection. Others on this site have tried what you are doing. Here is a link after searching for serial to USB adaptor: http://forums.palm.com/palm/search?submitted=true&q=serial+to+USB+adaptor

  • Using Serial Port for Non-Serial Data Acquisiton

    I searched the forums and couldn't find anything related to this topic.
    I saw that it was possible to use the parallel port for simple digital I/O and I was hoping the serial port can be configured the same. It seems all the VISA VI's only want to use the serial port to recieve ASCII chars at a given baud rate, but is it possible to simply poll the status of the serial line at my own speed to see if it is high or low, kind of like a single pin DAQ?
    It seems it would be possible as long as the serial data is read and controlled by labview and not by Windows. Let me know if you have any ideas how to approach this problem, or any feedback as to why it is not possible.
    Thanks everyone!
    Solved!
    Go to Solution.

    Select Property>Serial Settings>Modem Line Settings. For example, the CTS State is an input to the pc.
    Using these lines is a very poor replacement for a scope or DAQ board. The only things you can get back is Asserted, Unasserted, or Unknown. The range of acceptable signals is quite large. Anything between +3 and -3 is an unknown state. Your other signals are +/3 to 15 volts. what kind of signals do you actually want to capture?
    edit: There is no such thing as VISA Status so I have no idea what you are actually using.
    Message Edited by Dennis Knutson on 07-20-2009 11:09 AM

  • Button inconsistently working when Adding dynamic rows in table

    I have a very weird situation at hand.
    I have several pages in my interactive form. 6 pages total.
    Pages 3-6 have dynamic tables wherein I used a button to add rows to my tables.
    Page 3: 2 tables working ok
    Page 4: 3 tables, 1st table working ok, the rest add button not responding
    Page 5-6: all add buttons are not responding
    I have this javascript that should run when the button is clicked.
    Table5.Data_Row5.instanceManager.addInstance(1);
    I have checked the table names and body rownames and all are correct.
    Would anyone point me what I did wrong? I tried deleting the buttons and recreating them and of course reentering the script again but still not working.

    I got it! I forgot to tick the Repeat Row for each data item on the body row for the succeeding tables.

  • HR Custom InfoTypes problem when added to custom Infoset Report for PA

    Hi, I am having an issue with the adhoc query /SAPQUERY/HR_ADM. I added the custom infotypes 9* I created to this standard infoset by using SQ02 and adding these by going into the menu path Edit--> Change InfoType selection. I regenerated this object and attached to a transport. The query runs fine in the DEV system where I made the change...I can choose fields for output or selection from the standard infotypes and custom infotypes as expected. I migrated this transport to the test system and now when I try to do the same thing I get an error when I try to click on any object in my custom infotype and some of the standard infotype. I tried regenerating and resending to the test system and still have the same issue. This is the error in the dump:
        79 * create work area                                                
        80   create data data_wa like line of data_table.                    
        81   assign data_wa->* to <data_wa>.                                 
        82   assign component fcat_wa-fieldname OF STRUCTURE <data_wa>       
        83     to <field>.                                                   
        84                                                                   
        85   loop at t_fcat into fcat_wa.                                    
        86     field_filled = 'X'.                                           
        87     assign component fcat_wa-fieldname OF STRUCTURE <data_wa>     
        88     to <field>.                                                   
        89     if sy-subrc <> 0.                                             
    >>>>>       raise internal_error.                                       
    It appears the TEXT488 is the value in the fcat_wa-fieldname and I do not see this in the data_wa.
    Does anyone know how to fix this problem or what I might try or look at to see what the difference is between the DEV system (where it works ok) the the Test system where it is giving me an error?
    Thanks in advance for any help you can provide.
    Laurie

    After further investigation I found the problem to this was in the generation of the objects. Even though I generated before attaching to a transport  and all looked ok, there is some sort of bug causing it to not generate properly so I had to sign on to each environment and generate the object in SQ02 including in Production. After I did this the custom infotypes were accessible in the Infoset.

  • Can we connect xbee to cfp2020 controller​s serial port for wireless communicat​ion

    hi,
        i wanna do data aqcuisition using ethernet as well as wireless technologies, for that i wanna use xbee with cpf 2020.   is it possible?
    thanks in advance

    You can do it fine..
    I am guessing the wireless modem is really a router as well. When you say wireless do you mean 3g internet or 4g internet or do you mean cable or adsl and a wireless modem router.?? It is just helpful to know what you are talking about by wireless modem or wireless internet.
    You have that plugged into ethernet over power (EOP) adapters .. that is great.
    Plugged into TV again that is fine.. although I am unclear what or how it is decoding.. is it IPTV??
    Now to your specific questions.
    Now, is it possible to
    a) connect the Time Capsule to the powerline, so it can act as an access point? When connected to this powerline (ethernet) I hope I won't loose speed to the wireless connection
    Yes, the TC needs to be bridged..
    Go to manual setup of the Airport utility.. click on the internet tab.. go to connection sharing on the bottom of that page.. select off bridge mode.. update the TC.
    Now you can plug the TC into the EOP adapter. And it will work as Wireless Access Point.. WAP or short AP.. and switch.
    Plug the TV into the TC as well.. that should all work fine.
    b) will I be able to connect my digital tv-decoder to the TC without any problems? So the TC is the decoder's "ethernet port"?
    Hope this is a bit clear, as English is not my mothertongue...
    IPTV can be complicated to setup and exactly how it works will depend on the main router.. sometimes IPTV is only delivered to a specific ethernet port.. in which case the above suggestion will not work.. you can use either internet or the TV.. not both..

  • Losing connection only when i use the display port to send display

    When I connect my Macbook using the mini display to DVI, DVI to HDMI adapter to my LCD TV, my download speeds pretty much fall off to nothing. When I disconnect the display adapter, the connection resumes. Any ideas?

    My TV only has one HDMI input, and my adapter is some generic one off of eBay, http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=130493628739&ssPageName=STRK: MEWNX:IT#ht_2213wt_1189.  I was uncertain whether or not it would work, but I read it also could be that my tv has an unsupported resolution.

  • Motorola Hz800 Bluetooth headset shorts out MBA Bluetooth Module when plugged into MBA USB port for charging

    This is the weiredest thing.  Everything is fine with my MBA, I have an apple bluetooth keyboard and mouse running smoothy then I plug in my Motorola HZ800 bluetooth headset using a USB to mico USB cable to my MBA to charge it and BAM! I get a the bluetooth logo with a sawtooth wave through it.  It shuts down the bluetooth module completely. I have to restart the computer to bring back the bluetooth module to life. And now my keyboard won't pair again, but that's a whole other issue.  Any reason why this would be?  Thanks.

    Yes.  USB ports are limited to a maximum of 500 ma of current.  Check the current rating on the charger for your headset.  It is probably higher than 500 ma.  It overloads the port forcing it to shut down.

Maybe you are looking for

  • Execute BEx as background job

    Hi Guys, User hit abap dump for TIME_OUT when executing query in Analyzer by selecting All data. I understand it is standard setting of 600 seconds for dialog processing. Is there anyway i can execute the query in background when user select all data

  • My Epson wp4535 all in one will no longer scan.  Where can I find an updated driver?

    I have an Epson WP-4535 Workforce Pro all in one printer, scanner, fax machine.    Since upgrading to mavericks the scanner will no longer work- an error message comes up to say that "you can't use this version of Epson Scan." I must need an uodated

  • Create your own graphics using Project ROME!

    Hi Romans, Ever want to add your own logo or graphic to your creations? Maybe you want to design a brand logo for your business or a festive turkey for your Thanksgiving cards and invitations. Learn more about creating vector graphics using Project R

  • Can numbers sort by more than one column? How?

    Can numbers sort by more than one column? How?

  • I sight camera compatibility problems.

    I have downloaded the latest aMSN Messenger clone from Source Forge and find that my camera is not working with other windows messenger users. They see a white image and I just don't see anything....and all of a sudden the image connection falls. The