I'm unable to access Serial Port

I have written following code but I m getting NullPointerException on line 13 of this code, please solve my problem and identify error.
In this code I have used chaeron api which is available at www.chaeron.com
import com.chaeron.GPS.NMEA.*;
import com.chaeron.GPS.*;
import com.chaeron.platform.SerialPort;
public class MyGPS1 //extends NMEAGPSImpl
     public static void main(String st[]) throws Exception
          SerialPort sp = null;
          NMEAGPSImpl gps = new NMEAGPSImpl();
          sp = gps.getSerialPort();//returning null
          if(sp.isOpen())
               gps.setSerialPort(2);
               gps.connect();
          System.out.println(sp.isOpen());//error on this line

generally serial port problems stem from incorrect installation of the javax.comm package: does the serial demo work? It's hard to say what the problem is without knowing anything about the gps object.

Similar Messages

  • Can air for html/ajax accessing serial port or usb?

    I just have made use of Adobe AIR .I want to use printer with
    air . Do air have some poperties to accessing serial port or usb?
    I look up that on the Adobe AIR documents.I only found
    'Adobe® AIR™ provides the eans to check for changes to
    the network connectivity of the computer on which an AIR
    application is installed'.
    Do you have some demo with Adobe AIR accessing serial port or
    usb ?
    Or has another poperties to do that!
    thank you!!

    There is no API for accessing the serial port. USB devices
    can only be accessed through the file system (and only if they are
    storage devices).

  • Pse help. K7T66Pro2 cannot access serial ports in DOS window

    My K7T266Pro2 won't access serial ports in a DOS window under Windows 98SE.
    Windows programs can access the ports but no DOS programs - including my modem program, banking program, Tapcis Compuserve program and MDMDR a serial port diagnostic program.
    I have tried both setting the ports in BIOS to AUTO
    and forcing the standard values for com1 and 2
    and I have verified that the serial ports are set for:
    com1 irq 4 i/o 3f8
    com2 irq 3 i/o 2f8
    I know my way around serial ports.
    Every other motherboard I have used under Windows 98SE has had no problems accessing the serial ports
    under DOS.
    I asked my dealer to try another K7T motherboard.  He loaded Windows 98SE and could not access the serial
    port in a DOS window either.
    Is this something funny about K7T boards?
    Do others have this problem?
    This is a quite urgent problem.  Please help.
    Larry Alkoff

    Larry,
    You posted in the nVidia/AMD/SiS Forum instead of the Via Forum. I have moved you to the correct forum.
    Good Luck,
    Richard

  • Help - K7T266Pro2 won't access serial ports in DOS window

    My K7T266Pro2 won't access serial ports in a DOS window under Windows 98SE.
    Windows programs can access the ports but no DOS programs - including my modem program, banking program, Tapcis Compuserve program and MDMDR a serial port diagnostic program.
    I have tried both setting the ports in BIOS to AUTO
    and forcing the standard values for com1 and 2
    and I have verified that the serial ports are set for:
    com1 irq 4 i/o 3f8
    com2 irq 3 i/o 2f8
    I know my way around serial ports.
    Every other motherboard I have used under Windows 98SE has had no problems accessing the serial ports
    under DOS.
    I asked my dealer to try another K7T motherboard.  He loaded Windows 98SE and could not access the serial
    port in a DOS window either.
    Is this something funny about K7T boards?
    Do others have this problem?
    This is a quite urgent problem.  Please help.
    Larry Alkoff

    Larry,
    You posted in the nVidia/AMD/SiS Forum instead of the Via Forum. I have moved you to the correct forum.
    Good Luck,
    Richard

  • Access serial port through AIR

    isnt there any extensions or API buit for accessing serial
    port from AIR.
    i am designing a vending machile applicaton in which a coin
    drop is detected and corresponding images or message is displayed.
    MDM Zinc 3.0 allows serial port access but worths more than
    what it deserves. does AIR has some similar functionality.
    Any help.

    I'm not too hot on this subject, but would it not be possible
    to use Binary Sockets to connect to another app on the machine that
    could connect to a serial port?

  • How to access serial port using servlet

    I want to communicate with a microcontroller connected to the serial port of my computer.
    *I am using the following:
    Windows 98 operating system
    Tomcat web server 4.1
    *The directory structure is as given:
    Tomcat 4.1/webapps/myjsp/web-inf/classes/remoteservlets.
    I have placed my jsp files in my jsp folder and classfiles in remote servlets folder.
    **my java program has compiled correctly.**
    ** my simple java application which accesses the serial port works fine.***
    *when I start tomcat I am able to access the sevlet as the servlet responds with the button name i have pressed.
    **** I have also tried the following
    Copied file comm.jar in <JAVA_HOME>\jre\lib\ext
    Copied file javax.comm.properties in <JAVA_HOME>\jre\lib
    Copied file win32com.dll in <JAVA_HOME>\lib and also in c:\windows\system32 and c:\windows\system
    ***************which helped me do away with errors.
    still I don't get any output. I dont get any errors either.
    PLEASE HELP. URGENT. i am at my wits end.
    Thank you.

    Servlet is the one which runs in the server side...if u want to comunicate with the serial port of the server in which ur servlet is running can be done but making use of Communication api available....
    U can download the Api from http://java.sun.com/products/javacomm/index.jsp
    There are three levels of classes in the Java communications API:
    High-level classes like CommPortIdentifier and CommPort manage access and ownership of communication ports.
    Low-level classes like SerialPort and ParallelPort provide an interface to physical communications ports. The current release of the Java communications API enables access to serial (RS-232) and parallel (IEEE 1284) ports.
    Driver-level classes provide an interface between the low-level classes and the underlying operating system. Driver-level classes are part of the implementation but not the Java communications API. They should not be used by application programmers.
    regards
    shanu

  • Unable to Open Serial Port

    Hi I am trying to write to an ADAM 4571 Ethernet to RS422 converter. Using the software provided by the vendor Ver. 1.49. I can setup the device properly, than configure it as a virtual com port. The problem is LabView sees the port but can not open it. Visa Open Fails every time. There is very little information about this problem.
    Thanks,

    Hey Thanks for replying so fast. I know the error code would be helpful, but I don't have access to the equipment at this time. Let me tell you a little more history; Two different computers one is a laptop, has the runtime LabView 11 SP1, NIDAQ951f1_downloader and niser370 installed.  This machine the software works as it should running an executable. The second computer has LabView 11 SP1 Developer installed. This is the development station, this machine is the one that I can not open the Virtual com port. Vender software is installed on both machines and configured the same. The executable source code will not run on the development computer. It fails when it tries to talk to the serial port. To trouble shoot this problem I opened a blank VI dropped Visa Open and Visa Close in it wired a control to Comport selection and indicator to error out, connected error terminals and com out to com in. The error said that it could see the com port but could not talk to it. This error was generated by the open routine.

  • Accessing serial port on Arm platform

    I need to read and write on the serial ports of an ARM platform with a Java application, running a cross-compiled JVM.
    I considered both solutions java COMMAPI and JNI, but the problem is the same: I haven't library to support them: libLinuxSerialParallel.so, to support COMMAPI, or libnativelib.so, to implement native methods for JNI.
    How can I have this library for my ARM architecture? Is it possible to cross-compile sources for it?
    Thanks in advance.
    regards.

    Hello,
    I have a igep boar with arm core.
    I am trying to access to serial port through java.
    I am using rxtx (gnu.io) http://rxtx.qbang.org.
    I dowloaded the api for arm architecture (http://rxtx.qbang.org/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/), but there is a problem with dependencies with glib.
    This is the error when i try to call from java:
    java.lang.UnsatisfiedLinkError: /home/jdoe/equinox-SDK-3.5.2/plugins/configuration/org.eclipse.osgi/bundles/2/1/.cp/librxtxSerial.so: /lib/vfp/libpthread.so.0: version `GLIBC_2.0' not found (required by /home/jdoe/equinox-SDK-3.5.2/plugins/configuration/org.eclipse.osgi/bundles/2/1/.cp/librxtxSerial.so) thrown while loading gnu.io.RXTXCommDriver
    I tested the librxtxSerial.so:
    jdoe@ubuntu:~$ ldd librxtxSerial.so
    ./librxtxSerial.so: /lib/vfp/libpthread.so.0: version `GLIBC_2.0' not found (required by ./librxtxSerial.so)
    ./librxtxSerial.so: /lib/vfp/libc.so.6: version `GLIBC_2.1.3' not found (required by ./librxtxSerial.so)
    ./librxtxSerial.so: /lib/vfp/libc.so.6: version `GLIBC_2.1' not found (required by ./librxtxSerial.so)
    ./librxtxSerial.so: /lib/vfp/libc.so.6: version `GLIBC_2.0' not found (required by ./librxtxSerial.so)
    libpthread.so.0 => /lib/vfp/libpthread.so.0 (0x40022000)
    libc.so.6 => /lib/vfp/libc.so.6 (0x40041000)
    /lib/ld-linux.so.3 (0x2a000000)
    And this is my glic version:
    jdoe@ubuntu:~$ ls -al /lib/libc*
    -rwxr-xr-x 1 root root 1201672 2009-04-09 18:02 /lib/libc-2.9.so
    lrwxrwxrwx 1 root root 14 2010-07-01 16:52 /lib/libcap.so.1 -> libcap.so.1.10
    -rw-r--r-- 1 root root 13984 2008-11-14 02:47 /lib/libcap.so.1.10
    lrwxrwxrwx 1 root root 14 2010-06-16 17:21 /lib/libcap.so.2 -> libcap.so.2.11
    -rw-r--r-- 1 root root 13800 2008-11-17 06:14 /lib/libcap.so.2.11
    -rw-r--r-- 1 root root 181816 2009-04-09 18:02 /lib/libcidn-2.9.so
    lrwxrwxrwx 1 root root 14 2010-06-16 17:21 /lib/libcidn.so.1 -> libcidn-2.9.so
    lrwxrwxrwx 1 root root 17 2010-06-16 17:21 /lib/libcom_err.so.2 -> libcom_err.so.2.1
    -rw-r--r-- 1 root root 9648 2009-02-12 16:55 /lib/libcom_err.so.2.1
    -rw-r--r-- 1 root root 38400 2009-04-09 18:02 /lib/libcrypt-2.9.so
    -rw-r--r-- 1 root root 1210776 2009-04-04 03:06 /lib/libcrypto.so.0.9.8
    lrwxrwxrwx 1 root root 15 2010-06-16 17:21 /lib/libcrypt.so.1 -> libcrypt-2.9.so
    lrwxrwxrwx 1 root root 11 2010-06-16 17:21 /lib/libc.so.6 -> libc-2.9.so
    What should I do?

  • Unable to access console port

    Hi,
    i was unable to access my cat6509 neither from console port or telnet access since someone by mistake has modified the setting in the switch &now it become inaccessible so is there any suggestion to workaround without losing my current configuration .
    by the way when i connect to the concole port through terminal window nothing can by display in the terminal(blank)

    Hi,
    have you access to the MSFC?
    I don't understand the problem, but this maybe could help you:
    http://www.cisco.com/en/US/products/hw/switches/ps700/products_configuration_example09186a00804ceb07.shtml
    HTH
    Andrea

  • Can not access serial port while upgrading from LabVIEW 6.1 to 7.0

    Hi,
    I built an application under LabVIEW 6.0.2. few years ago. This application uses LabVIEW serial features. When I upgraded to LabVIEW 6.1, my application was still working correctly.
    Today, I upgraded to LabVIEW 7.0, mass compile all VIs and now my application can not communicate with my peripheral !!!
    The program is sending the command to the peripheral. The peripheral answers but LabVIEW serial driver does not see any datas on buffer even if datas are available ... "Bytes At serial port.vi" always returns 0. I am sure that datas are available, using a COM port psy.
    Does anyone has an idea?
    I saw a lot of solutions in the forum, but I would like to know the best solution with minimum work, te
    st, and so on ... on my program.
    Regards,
    Pascal.

    Hi Pascal,
    Which is your version of NI-VISA?
    Please see the link bellow :
    http://digital.ni.com/manuals.nsf/websearch/E8D86CD680B0753D86256D2C005D8EA0
    The first test to be made is to test the communication with your serial port using MAX (Measurement and Automation Explorer) :
    Open MAX, Go to "Devices and Interfaces", then "Ports", select COM1 (or ASRL1::INSTR). Right clic on it and select "Open VISA Session" the go the "Basic I/O" then Write data, execute, Read data, execute.
    Be sure that the communication is OK. Be sure that you use the same Alias existing in MAX in your LabVIEW program.
    Now, if all is OK, try to use Serial communication examples existing in LabVIEW Help>>Examples Finder. These examples use NI-VISA VIs.
    If all above is OK and you
    still have the same problem, try to follow these instructions :
    "In order to use the old Serial Compatibility VIs in LabVIEW 7.x, you must copy the following files from a previous version of LabVIEW to the LabVIEW 7.x directory:
    Replace the serial.llb in LabVIEW 7.x with the serial.llb from a previous version of LabVIEW. This file is found in C:\Program Files\National Instruments\LabVIEW\vi.lib\instr.
    Replace the _sersup.llb file in LabVIEW 7.x with the _sersup.llb from a previous version of LabVIEW. In LabVIEW 6i and 6.1 this file is located in C:\Program Files\National Instruments\LabVIEW\vi.lib\platform. In LabVIEW 7.x (and 5.x) this file is found in C:\Program Files\National Instruments\LabVIEW\vi.lib\instr.
    Copy the file serpdrv to the C:\Program Files\National Instruments\LabVIEW 7.x directory. This file is not installed with LabVIEW 7.x, so it only needs to be copied from a previous version of LabVIEW, not replaced."
    I hope that my answer will help you.
    Sa
    naa T
    National Instruments

  • Problem in Accessing serial port using java comm Api

    I have installed java comm Api in my pc.
    i have gone through the instalation instruction which comes on this package.
    I have done the instalation like this
    Copy win32com.dll to my <JDK>\bin directory.
    Copy comm.jar to my <JDK>\lib directory.
    Copy javax.comm.properties to my <JDK>\lib directory.
    and restart the system.
    But when i run the BlackBox , it is giving me message
    "serial port not found".
    Can any one tell me , what is the exact problem ?

    I'm not sure what you mean by BlackBox, but I have used the COMM api extensively.
    The majority of problems is that the api cannot see the serial port (which is what you are describing) and this is caused by incorrect placing of the javax.comm.properties file.
    As well as <JDK>\lib, try putting it into <JRE>\lib as well. That has often solved problems on my setup.

  • Unable to delete serial port (advanced bluetooth prefs)

    I was messing around with the advanced Bluetooth preferences and added a couple serial ports to this list.  But when I select the items, the remove button remains inactive.  How do I delete these?  (Note: checking the checkboxes doesn't change the state of the remove button.)

    Hi ChouDoufu,
    did you get a reply, or find a way to fix this problem? I'm experiencing exactly the same issue. Moreover, if I go to "My Bluetooth Places" and "View My Bluetooth services", I can see the various services, and even enable some of them such as File Transfer or Bluetooth Imaging. However, I cannot enable Bluetooth Serial Port, which is what I'd need to be able to connect my Palm with my Lenovo. By the way, it works fine with my other computers, just not with this Lenovo T60p...
    Cheers,
    ejay 

  • Unable to access certain ports over Site to Site VPN

    We have a client that has a Cisco 1801W Firewall that is setup as a site to site VPN terminating to a Cisco ASA 5505. The tunnel is up and established, I can ping from both sides of the tunnel.
    The problem is the clients behind the Cisco ASA (192.168.2.x) cannot reach certain ports behind the Router (192.168.1.x). The main thing we're trying to do is browse via UNC path (ex: \\192.168.1.120 from a 192.168.2.x machine).
    I got 3389 working after I changed the -
    ip nat inside source static tcp 192.168.1.120 3389 y.y.x.x 3389 route-map SDM_RMAP_1 extendable
    Modified the command to include the public IP instead of interface FastEthernet0
    I believe it has something to do with the way NAT and route-maps are setup currently but I'm not familar enough with them to make the changes. I worked with Cisco to ensure the VPN tunnel was fine and it's something security related on the Router.
    Here is the configuration (removed a few lines not necessary. y.y.x.x = WAN IP of Router x.x.y.y = WAN IP of ASA).
    Building configuration...
    Current configuration : 23648 bytes
    version 12.4
    no service pad
    service timestamps debug datetime msec
    service timestamps log datetime msec
    no service password-encryption
    hostname PrarieTow
    boot-start-marker
    boot-end-marker
    logging buffered 52000
    enable secret 5 $1$7Ab8$oFQY76OPhJm/UUkXfqCbl/
    aaa new-model
    aaa group server radius rad_eap
    aaa group server radius rad_mac
    aaa group server radius rad_acct
    aaa group server radius rad_admin
    aaa group server tacacs+ tac_admin
    aaa group server radius rad_pmip
    aaa group server radius dummy
    aaa authentication login default local
    aaa authentication login eap_methods group rad_eap
    aaa authentication login mac_methods local
    aaa authorization ipmobile default group rad_pmip
    aaa accounting network acct_methods start-stop group rad_acct
    crypto isakmp policy 1
    encr 3des
    authentication pre-share
    group 2
    crypto isakmp key Ch4C5eSP address x.x.y.y
    crypto ipsec transform-set ESP-3DES-SHA esp-3des esp-sha-hmac
    crypto map SDM_CMAP_1 1 ipsec-isakmp
    description Tunnel tox.x.y.y
    set peer x.x.y.y
    set transform-set ESP-3DES-SHA
    match address 118
    no ip source-route
    ip cef
    no ip dhcp use vrf connected
    ip dhcp excluded-address 192.168.1.1 192.168.1.19
    ip dhcp excluded-address 192.168.1.101 192.168.1.254
    ip dhcp excluded-address 192.168.1.60
    ip dhcp excluded-address 192.168.1.120
    ip dhcp excluded-address 192.168.1.125
    ip dhcp excluded-address 192.168.1.126
    ip dhcp pool sdm-pool1
       network 192.168.1.0 255.255.255.0
       domain-name pltowing.local
       default-router 192.168.1.1
       dns-server 192.168.1.120 68.238.0.12
    no ip bootp server
    ip domain name pltowing
    ip name-server 184.16.4.22
    ip name-server 184.16.33.54
    ip port-map user-protocol--8 port udp 3389
    ip port-map user-protocol--9 port udp 14147
    ip port-map user-protocol--2 port tcp 3489
    ip port-map user-protocol--3 port udp 3489
    ip port-map user-protocol--1 port udp 3390
    ip port-map user-protocol--6 port udp 4431
    ip port-map user-protocol--7 port tcp 3389
    ip port-map user-protocol--4 port tcp 3390
    ip port-map user-protocol--5 port tcp 4431
    ip port-map user-protocol--13 port tcp 3487
    ip port-map user-protocol--12 port udp 3488
    ip port-map user-protocol--11 port tcp 3488
    ip port-map user-protocol--10 port tcp 14147
    ip port-map user-protocol--16 port tcp 8099
    ip port-map user-protocol--15 port udp 1194
    ip port-map user-protocol--14 port udp 3487
    ip inspect log drop-pkt
    multilink bundle-name authenticated
    parameter-map type protocol-info msn-servers
    server name messenger.hotmail.com
    server name gateway.messenger.hotmail.com
    server name webmessenger.msn.com
    parameter-map type protocol-info aol-servers
    server name login.oscar.aol.com
    server name toc.oscar.aol.com
    server name oam-d09a.blue.aol.com
    parameter-map type protocol-info yahoo-servers
    server name scs.msg.yahoo.com
    server name scsa.msg.yahoo.com
    server name scsb.msg.yahoo.com
    server name scsc.msg.yahoo.com
    server name scsd.msg.yahoo.com
    server name cs16.msg.dcn.yahoo.com
    server name cs19.msg.dcn.yahoo.com
    server name cs42.msg.dcn.yahoo.com
    server name cs53.msg.dcn.yahoo.com
    server name cs54.msg.dcn.yahoo.com
    server name ads1.vip.scd.yahoo.com
    server name radio1.launch.vip.dal.yahoo.com
    server name in1.msg.vip.re2.yahoo.com
    server name data1.my.vip.sc5.yahoo.com
    server name address1.pim.vip.mud.yahoo.com
    server name edit.messenger.yahoo.com
    server name messenger.yahoo.com
    server name http.pager.yahoo.com
    server name privacy.yahoo.com
    server name csa.yahoo.com
    server name csb.yahoo.com
    server name csc.yahoo.com
    username prairie privilege 15 password 0 towing
    archive
    log config
      hidekeys
    ip ssh version 2
    class-map type inspect match-all sdm-nat-user-protocol--7-1
    match access-group 108
    match protocol user-protocol--7
    class-map type inspect match-all sdm-cls-VPNOutsideToInside-1
    match access-group 120
    class-map type inspect match-all sdm-nat-user-protocol--6-1
    match access-group 107
    match protocol user-protocol--6
    class-map type inspect match-any SDM_HTTPS
    match access-group name SDM_HTTPS
    class-map type inspect match-any SDM_SSH
    match access-group name SDM_SSH
    class-map type inspect match-any SDM_SHELL
    match access-group name SDM_SHELL
    class-map type inspect match-any sdm-cls-access
    match class-map SDM_HTTPS
    match class-map SDM_SSH
    match class-map SDM_SHELL
    class-map type inspect match-all sdm-nat-user-protocol--5-1
    match access-group 106
    match protocol user-protocol--5
    class-map type inspect match-all sdm-nat-user-protocol--4-1
    match access-group 105
    match protocol user-protocol--4
    class-map type inspect match-all sdm-nat-user-protocol--3-1
    match access-group 104
    match protocol user-protocol--3
    class-map type inspect match-all sdm-nat-user-protocol--2-1
    match access-group 103
    match protocol user-protocol--2
    class-map type inspect match-all sdm-nat-user-protocol--1-1
    match access-group 102
    match protocol user-protocol--1
    class-map type inspect match-any SDM_AH
    match access-group name SDM_AH
    class-map type inspect imap match-any sdm-app-imap
    match  invalid-command
    class-map type inspect match-all sdm-nat-user-protocol--9-1
    match access-group 110
    match protocol user-protocol--9
    class-map type inspect match-all sdm-nat-user-protocol--8-1
    match access-group 109
    match protocol user-protocol--8
    class-map type inspect match-any sdm-cls-protocol-p2p
    match protocol edonkey signature
    match protocol gnutella signature
    match protocol kazaa2 signature
    match protocol fasttrack signature
    match protocol bittorrent signature
    class-map type inspect match-any sdm-cls-insp-traffic
    match protocol cuseeme
    match protocol dns
    match protocol ftp
    match protocol h323
    match protocol https
    match protocol icmp
    match protocol imap
    match protocol pop3
    match protocol netshow
    match protocol shell
    match protocol realmedia
    match protocol rtsp
    match protocol smtp extended
    match protocol sql-net
    match protocol streamworks
    match protocol tftp
    match protocol vdolive
    match protocol tcp
    match protocol udp
    class-map type inspect match-all sdm-insp-traffic
    match class-map sdm-cls-insp-traffic
    class-map type inspect match-any SDM_ESP
    match access-group name SDM_ESP
    class-map type inspect match-any SDM_VPN_TRAFFIC
    match protocol isakmp
    match protocol ipsec-msft
    match class-map SDM_AH
    match class-map SDM_ESP
    class-map type inspect match-all SDM_VPN_PT
    match access-group 119
    match class-map SDM_VPN_TRAFFIC
    class-map type inspect gnutella match-any sdm-app-gnutella
    match  file-transfer
    class-map type inspect match-any SDM-Voice-permit
    match protocol h323
    match protocol skinny
    match protocol sip
    class-map type inspect ymsgr match-any sdm-app-yahoo-otherservices
    match  service any
    class-map type inspect msnmsgr match-any sdm-app-msn-otherservices
    match  service any
    class-map type inspect match-all sdm-protocol-pop3
    match protocol pop3
    class-map type inspect match-all sdm-nat-user-protocol--16-1
    match access-group 117
    match protocol user-protocol--16
    class-map type inspect match-all sdm-nat-user-protocol--14-1
    match access-group 115
    match protocol user-protocol--14
    class-map type inspect match-all sdm-nat-user-protocol--15-1
    match access-group 116
    match protocol user-protocol--15
    class-map type inspect match-all sdm-nat-user-protocol--12-1
    match access-group 113
    match protocol user-protocol--12
    class-map type inspect match-all sdm-nat-user-protocol--13-1
    match access-group 114
    match protocol user-protocol--13
    class-map type inspect match-all sdm-nat-user-protocol--10-1
    match access-group 111
    match protocol user-protocol--10
    class-map type inspect match-all sdm-nat-user-protocol--11-1
    match access-group 112
    match protocol user-protocol--11
    class-map type inspect match-any sdm-cls-icmp-access
    match protocol icmp
    match protocol tcp
    match protocol udp
    class-map type inspect match-any sdm-cls-protocol-im
    match protocol ymsgr yahoo-servers
    match protocol msnmsgr msn-servers
    match protocol aol aol-servers
    class-map type inspect aol match-any sdm-app-aol-otherservices
    match  service any
    class-map type inspect pop3 match-any sdm-app-pop3
    match  invalid-command
    class-map type inspect match-all sdm-access
    match class-map sdm-cls-access
    match access-group 101
    class-map type inspect kazaa2 match-any sdm-app-kazaa2
    match  file-transfer
    class-map type inspect match-all sdm-protocol-p2p
    match class-map sdm-cls-protocol-p2p
    class-map type inspect http match-any sdm-http-blockparam
    match  request port-misuse im
    match  request port-misuse p2p
    match  req-resp protocol-violation
    class-map type inspect match-all sdm-protocol-im
    match class-map sdm-cls-protocol-im
    class-map type inspect match-all sdm-invalid-src
    match access-group 100
    class-map type inspect match-all sdm-icmp-access
    match class-map sdm-cls-icmp-access
    class-map type inspect ymsgr match-any sdm-app-yahoo
    match  service text-chat
    class-map type inspect msnmsgr match-any sdm-app-msn
    match  service text-chat
    class-map type inspect edonkey match-any sdm-app-edonkey
    match  file-transfer
    match  text-chat
    match  search-file-name
    class-map type inspect http match-any sdm-app-httpmethods
    match  request method bcopy
    match  request method bdelete
    match  request method bmove
    match  request method bpropfind
    match  request method bproppatch
    match  request method connect
    match  request method copy
    match  request method delete
    match  request method edit
    match  request method getattribute
    match  request method getattributenames
    match  request method getproperties
    match  request method index
    match  request method lock
    match  request method mkcol
    match  request method mkdir
    match  request method move
    match  request method notify
    match  request method options
    match  request method poll
    match  request method propfind
    match  request method proppatch
    match  request method put
    match  request method revadd
    match  request method revlabel
    match  request method revlog
    match  request method revnum
    match  request method save
    match  request method search
    match  request method setattribute
    match  request method startrev
    match  request method stoprev
    match  request method subscribe
    match  request method trace
    match  request method unedit
    match  request method unlock
    match  request method unsubscribe
    class-map type inspect edonkey match-any sdm-app-edonkeychat
    match  search-file-name
    match  text-chat
    class-map type inspect http match-any sdm-http-allowparam
    match  request port-misuse tunneling
    class-map type inspect fasttrack match-any sdm-app-fasttrack
    match  file-transfer
    class-map type inspect match-all sdm-protocol-http
    match protocol http
    class-map type inspect edonkey match-any sdm-app-edonkeydownload
    match  file-transfer
    class-map type inspect match-all sdm-protocol-imap
    match protocol imap
    class-map type inspect aol match-any sdm-app-aol
    match  service text-chat
    policy-map type inspect sdm-permit-icmpreply
    class type inspect sdm-icmp-access
      inspect
    class class-default
      pass
    policy-map type inspect p2p sdm-action-app-p2p
    class type inspect edonkey sdm-app-edonkeychat
      log
      allow
    class type inspect edonkey sdm-app-edonkeydownload
      log
      allow
    class type inspect fasttrack sdm-app-fasttrack
      log
      allow
    class type inspect gnutella sdm-app-gnutella
      log
      allow
    class type inspect kazaa2 sdm-app-kazaa2
      log
      allow
    class class-default
    policy-map type inspect sdm-pol-NATOutsideToInside-1
    class type inspect sdm-nat-user-protocol--1-1
      inspect
    class type inspect sdm-nat-user-protocol--2-1
    inspect
    class type inspect sdm-nat-user-protocol--3-1
      inspect
    class type inspect sdm-nat-user-protocol--4-1
      inspect
    class type inspect sdm-nat-user-protocol--5-1
      inspect
    class type inspect sdm-nat-user-protocol--6-1
      inspect
    class type inspect sdm-nat-user-protocol--7-1
      inspect
    class type inspect sdm-nat-user-protocol--8-1
      inspect
    class type inspect sdm-nat-user-protocol--9-1
      inspect
    class type inspect sdm-nat-user-protocol--10-1
      inspect
    class type inspect sdm-nat-user-protocol--11-1
      inspect
    class type inspect sdm-nat-user-protocol--12-1
      inspect
    class type inspect sdm-nat-user-protocol--13-1
      inspect
    class type inspect sdm-nat-user-protocol--14-1
      inspect
    class type inspect sdm-nat-user-protocol--15-1
      inspect
    class type inspect sdm-nat-user-protocol--16-1
      inspect
    class type inspect sdm-cls-VPNOutsideToInside-1
      inspect
    class class-default
    policy-map type inspect imap sdm-action-imap
    class type inspect imap sdm-app-imap
      log
    class class-default
    policy-map type inspect pop3 sdm-action-pop3
    class type inspect pop3 sdm-app-pop3
      log
    class class-default
    policy-map type inspect im sdm-action-app-im
    class type inspect aol sdm-app-aol
      log
      allow
    class type inspect msnmsgr sdm-app-msn
      log
    allow
    class type inspect ymsgr sdm-app-yahoo
      log
      allow
    class type inspect aol sdm-app-aol-otherservices
      log
      reset
    class type inspect msnmsgr sdm-app-msn-otherservices
      log
      reset
    class type inspect ymsgr sdm-app-yahoo-otherservices
      log
      reset
    class class-default
    policy-map type inspect sdm-inspect
    class type inspect sdm-invalid-src
      inspect
    class type inspect sdm-protocol-http
      inspect
    class type inspect sdm-protocol-imap
      inspect
      service-policy imap sdm-action-imap
    class type inspect sdm-protocol-pop3
    inspect
      service-policy pop3 sdm-action-pop3
    class type inspect sdm-protocol-p2p
      inspect
      service-policy p2p sdm-action-app-p2p
    class type inspect sdm-protocol-im
      inspect
      service-policy im sdm-action-app-im
    class type inspect sdm-insp-traffic
      inspect
    class type inspect SDM-Voice-permit
      inspect
    class class-default
      pass
    policy-map type inspect http sdm-action-app-http
    class type inspect http sdm-http-blockparam
      log
      reset
    class type inspect http sdm-app-httpmethods
      log
      reset
    class type inspect http sdm-http-allowparam
      log
    allow
    class class-default
    policy-map type inspect sdm-permit
    class type inspect SDM_VPN_PT
      pass
    class type inspect sdm-access
      inspect
    class class-default
    zone security out-zone
    zone security in-zone
    zone-pair security sdm-zp-self-out source self destination out-zone
    service-policy type inspect sdm-permit-icmpreply
    zone-pair security sdm-zp-NATOutsideToInside-1 source out-zone destination in-zone
    service-policy type inspect sdm-pol-NATOutsideToInside-1
    zone-pair security sdm-zp-out-self source out-zone destination self
    service-policy type inspect sdm-permit
    zone-pair security sdm-zp-in-out source in-zone destination out-zone
    service-policy type inspect sdm-inspect
    bridge irb
    interface FastEthernet0
    description $ETH-LAN$$FW_OUTSIDE$
    ip address y.y.x.x 255.255.255.252
    no ip redirects
    no ip unreachables
    no ip proxy-arp
    ip nat outside
    ip virtual-reassembly
    zone-member security out-zone
    duplex auto
    speed auto
    crypto map SDM_CMAP_1
    interface BRI0
    no ip address
    no ip redirects
    no ip unreachables
    no ip proxy-arp
    encapsulation hdlc
    shutdown
    interface FastEthernet1
    interface FastEthernet2
    interface FastEthernet3
    interface FastEthernet4
    interface FastEthernet5
    interface FastEthernet6
    interface FastEthernet7
    interface FastEthernet8
    interface Vlan1
    no ip address
    no ip redirects
    no ip unreachables
    no ip proxy-arp
    bridge-group 1
    interface BVI1
    description $FW_INSIDE$
    ip address 192.168.1.1 255.255.255.0
    ip nat inside
    ip virtual-reassembly
    zone-member security in-zone
    ip default-gateway 50.50.20.105
    ip route 0.0.0.0 0.0.0.0 50.50.20.105
    ip route 10.8.0.0 255.255.255.0 192.168.1.251
    ip http server
    ip http authentication local
    ip http secure-server
    ip http timeout-policy idle 600 life 86400 requests 10000
    ip nat inside source static tcp 192.168.1.120 8099 interface FastEthernet0 8099
    ip nat inside source route-map SDM_RMAP_1 interface FastEthernet0 overload
    ip nat inside source static udp 192.168.1.251 1194 y.y.x.x 1194 route-map SDM_RMAP_1 extendable
    ip nat inside source static tcp 192.168.1.120 3389 y.y.x.x 3389 route-map SDM_RMAP_1 extendable
    ip nat inside source static udp 192.168.1.120 3389 y.y.x.x 3389 route-map SDM_RMAP_1 extendable
    ip nat inside source static tcp 192.168.1.125 3489 y.y.x.x 3390 route-map SDM_RMAP_1 extendable
    ip nat inside source static udp 192.168.1.120 3390 y.y.x.x 3390 route-map SDM_RMAP_1 extendable
    ip nat inside source static tcp 192.168.1.126 3487 y.y.x.x 3487 route-map SDM_RMAP_1 extendable
    ip nat inside source static udp 192.168.1.126 3487 y.y.x.x 3487 route-map SDM_RMAP_1 extendable
    ip nat inside source static tcp 192.168.1.126 3488 y.y.x.x 3488 route-map SDM_RMAP_1  extendable
    ip nat inside source static udp 192.168.1.126 3488 y.y.x.x 3488 route-map SDM_RMAP_1 extendable
    ip nat inside source static udp 192.168.1.125 3489 y.y.x.x 3489 route-map SDM_RMAP_1 extendable
    ip nat inside source static tcp 192.168.1.120 4431 y.y.x.x 4431 route-map SDM_RMAP_1 extendable
    ip nat inside source static udp 192.168.1.120 4431 y.y.x.x 4431 route-map SDM_RMAP_1 extendable
    ip nat inside source static tcp 192.168.1.120 14147 y.y.x.x 14147 route-map SDM_RMAP_1 extendable
    ip nat inside source static udp 192.168.1.120 14147 y.y.x.x 14147 route-map SDM_RMAP_1 extendable
    ip access-list extended SDM_AH
    remark SDM_ACL Category=1
    permit ahp any any
    ip access-list extended SDM_ESP
    remark SDM_ACL Category=1
    permit esp any any
    ip access-list extended SDM_HTTPS
    remark SDM_ACL Category=1
    permit tcp any any eq 443
    ip access-list extended SDM_SHELL
    remark SDM_ACL Category=1
    permit tcp any any eq cmd
    ip access-list extended SDM_SSH
    remark SDM_ACL Category=1
    permit tcp any any eq 22
    access-list 1 permit 192.168.1.0 0.0.0.255
    access-list 2 remark SDM_ACL Category=2
    access-list 2 permit 192.168.1.0 0.0.0.255
    access-list 100 remark SDM_ACL Category=128
    access-list 100 permit ip host 255.255.255.255 any
    access-list 100 permit ip 127.0.0.0 0.255.255.255 any
    access-list 100 permit ip 50.50.20.104 0.0.0.3 any
    access-list 101 remark SDM_ACL Category=128
    access-list 101 permit ip any any
    access-list 102 remark SDM_ACL Category=0
    access-list 102 permit ip any host 192.168.1.120
    access-list 103 remark SDM_ACL Category=0
    access-list 103 permit ip any host 192.168.1.125
    access-list 104 remark SDM_ACL Category=0
    access-list 104 permit ip any host 192.168.1.125
    access-list 105 remark SDM_ACL Category=0
    access-list 105 permit ip any host 192.168.1.120
    access-list 106 remark SDM_ACL Category=0
    access-list 106 permit ip any host 192.168.1.120
    access-list 107 remark SDM_ACL Category=0
    access-list 107 permit ip any host 192.168.1.120
    access-list 108 remark SDM_ACL Category=0
    access-list 108 permit ip any host 192.168.1.120
    access-list 109 remark SDM_ACL Category=0
    access-list 109 permit ip any host 192.168.1.120
    access-list 110 remark SDM_ACL Category=0
    access-list 110 permit ip any host 192.168.1.120
    access-list 111 remark SDM_ACL Category=0
    access-list 111 permit ip any host 192.168.1.120
    access-list 112 remark SDM_ACL Category=0
    access-list 112 permit ip any host 192.168.1.126
    access-list 113 remark SDM_ACL Category=0
    access-list 113 permit ip any host 192.168.1.126
    access-list 114 remark SDM_ACL Category=0
    access-list 114 permit ip any host 192.168.1.126
    access-list 115 remark SDM_ACL Category=0
    access-list 115 permit ip any host 192.168.1.126
    access-list 116 remark SDM_ACL Category=0
    access-list 116 permit ip any host 192.168.1.251
    access-list 117 remark SDM_ACL Category=0
    access-list 117 permit ip any host 192.168.1.120
    access-list 118 remark SDM_ACL Category=4
    access-list 118 remark IPSec Rule
    access-list 118 permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255
    access-list 119 remark SDM_ACL Category=128
    access-list 119 permit ip host x.x.y.y any
    access-list 120 remark SDM_ACL Category=0
    access-list 120 remark IPSec Rule
    access-list 120 permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255
    access-list 121 remark SDM_ACL Category=2
    access-list 121 remark IPSec Rule
    access-list 121 deny   ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255
    access-list 121 permit ip 192.168.1.0 0.0.0.255 any
    no cdp run
    route-map SDM_RMAP_1 permit 1
    match ip address 121
    radius-server attribute 32 include-in-access-req format %h
    radius-server vsa send accounting
    control-plane
    bridge 1 protocol ieee
    bridge 1 route ip
    bridge 2 route ip
    line con 0
    line aux 0
    line vty 0 4
    privilege level 15
    transport input ssh
    webvpn cef
    end

    Hello Frank,
    Just to clarify, you have changed the rule so y.y.x.x is router WAN link:
    ip nat inside source static tcp 192.168.1.120 3389 y.y.x.x 3389 route-map SDM_RMAP_1 extendable
    and after that you could access 192.168.1.120:3389 from 192.168.2.0 networks ?
    Above rule do a static translation of 192.168.1.120 3389 to your WAN link for all traffic EXCEPT VPN.
    So maybe you were trying to access y.y.x.x (not 192.168.1.120) port 3389 from 192.168.2.0 networks ?
    (and that traffic is not being sent via VPN but just normally routed through internet)
    Michal

  • How to access the serial port on sdk 3.1.3 ?

    Hi all,
    I know that accessing serial port is not possible on firmware 2.x for non jailbroken iPhones.
    But what about firmware 3.0?
    Apple has focused firmware 3.0 on accessories, through bluetooth or through serial port. So, accessing serial port should be possible.
    But I can't find any documentation / sample code for that.
    Would you please help me?
    Regards,
    Alx
    PS: I tried to read the port /dev/cu.iap and get this message:
    Error opening serial port /dev/cu.iap - Permission denied(13).
    Looks bad.

    Yes I am enregistred in the Mad For iPod program?
    And I try to communique with my accessorie
    So the Code
    +*// SerialPortsModuleAppDelegate.m*+
    +*// SerialPortsModule*+
    +*// Created by BPO iMac on 08/02/10.*+
    +*// Copyright _MyCompanyName_ 2010. All rights reserved.*+
    +*#import "SerialPortsModuleAppDelegate.h"*+
    +*#import <fcntl.h>*+
    +*@implementation SerialPortsModuleAppDelegate*+
    +*@synthesize window;*+
    +*- (void)applicationDidFinishLaunching:(UIApplication *)application {*+
    +*// Override point for customization after application launch*+
    +*[window makeKeyAndVisible];*+
    +* portSerie = [SerialManager alloc];*+
    +* [portSerie init];*+
    +* int nb_port;*+
    +* nb_port = [portSerie findRS232Ports];*+
    +* NSString path_port;+
    +* path_port = [NSString alloc];*+
    +* int num_port;*+
    +* if(nb_port!=0)*+
    +* {*+
    +* num_port=0;*+
    +* path_port=[portSerie pathAtIndex:num_port];*+
    +* int resultat= [portSerie openInput:path_port baudrate:9600 bits:8 parity:0 stopbits:1 flags:O_RDONLY];*+
    +* if(resultat==-1)*+
    +* {*+
    +* NSLog(@"Communication Error");*+
    +* }*+
    +* resultat= [portSerie openOutput:path_port baudrate:9600 bits:8 parity:0 stopbits:1];*+
    +* if(resultat==-1)*+
    +* {*+
    +* NSLog(@"Communication Error");*+
    +* }*+
    +* }*+
    +* [path_port release];*+
    +* *+
    +*- (void)dealloc {*+
    +*[window release];*+
    +*[super dealloc];*+
    @end
    +*// SerialPortsModuleAppDelegate.h*+
    +*// SerialPortsModule*+
    +*// Created by BPO iMac on 08/02/10.*+
    +*// Copyright _MyCompanyName_ 2010. All rights reserved.*+
    +*#import <UIKit/UIKit.h>*+
    +*#import "SerialManager.h"*+
    +*@interface SerialPortsModuleAppDelegate : NSObject <UIApplicationDelegate> {*+
    +*UIWindow window;+
    +* SerialManager portSerie;+
    +*@property (nonatomic, retain) IBOutlet UIWindow window;+
    @end
    +*// SerialManager.m*+
    +*// K3 Tools*+
    +*// Created by Kok Chen on 4/28/09.*+
    +*// Copyright 2009 Kok Chen, W7AY. All rights reserved.*+
    +*#import "SerialManager.h"*+
    +*#include <unistd.h>*+
    +*#include <termios.h>*+
    +*#include <sys/ioctl.h>*+
    +*#include <IOKit/IOKitLib.h>*+
    +*#include <IOKit/serial/IOSerialKeys.h>*+
    +*#import <fcntl.h>*+
    +*#import <UIKit/UIKit.h>*+
    +*@implementation SerialManager*+
    +*- (id)init*+
    +* self = [ super init ] ;*+
    +* if ( self ) {*+
    +* termiosBits = -1 ;*+
    +* inputfd = outputfd = -1 ;*+
    +* useTermiosThread = NO ;*+
    +* needsNotification = NO ;*+
    +* termioLock = [ [ NSLock alloc ] init ] ;*+
    +* }*+
    +* return self ;*+
    +*static int findPorts( CFStringRef *stream, CFStringRef *path, int maxDevice, CFStringRef type )*+
    +*kernreturnt kernResult ;*+
    +*machportt masterPort ;*+
    +* ioiteratort serialPortIterator ;*+
    +* ioobjectt modemService ;*+
    +*CFMutableDictionaryRef classesToMatch ;*+
    +* CFStringRef cfString ;*+
    +* int count ;*+
    +*kernResult = IOMasterPort( MACHPORTNULL, &masterPort ) ;*+
    +*if ( kernResult != KERN_SUCCESS ) return 0 ;*+
    +* *+
    +*classesToMatch = IOServiceMatching( kIOSerialBSDServiceValue ) ;*+
    +*if ( classesToMatch == NULL ) return 0 ;*+
    +* *+
    +* // get iterator for serial ports (including modems)*+
    +* CFDictionarySetValue( classesToMatch, CFSTR(kIOSerialBSDTypeKey), type ) ;*+
    +*kernResult = IOServiceGetMatchingServices( masterPort, classesToMatch, &serialPortIterator ) ;*+
    +* // walk through the iterator*+
    +* count = 0 ;*+
    +* while ( ( modemService = IOIteratorNext( serialPortIterator ) ) ) {*+
    +* if ( count >= maxDevice ) break ;*+
    +*cfString = IORegistryEntryCreateCFProperty( modemService, CFSTR(kIOTTYDeviceKey), kCFAllocatorDefault, 0 ) ;*+
    +*if ( cfString ) {*+
    +* stream[count] = cfString ;*+
    +* cfString = IORegistryEntryCreateCFProperty( modemService, CFSTR(kIOCalloutDeviceKey), kCFAllocatorDefault, 0 ) ;*+
    +* if ( cfString ) {*+
    +* path[count] = cfString ;*+
    +* count++ ;*+
    +* }*+
    +* }*+
    +*IOObjectRelease( modemService ) ;*+
    +* IOObjectRelease( serialPortIterator ) ;*+
    +* return count ;*+
    +*// return number of ports*+
    +*- (int)findPorts:(CFStringRef)type*+
    +* CFStringRef cstream[64], cpath[64] ;*+
    +* int i ;*+
    +* *+
    +* numberOfPorts = findPorts( cstream, cpath, 64, type ) ;*+
    +* for ( i = 0; i < numberOfPorts; i++ ) {*+
    +* stream = [ [ NSString stringWithString:(NSString*)cstream ] retain ] ;*+
    +* CFRelease( cstream ) ;*+
    +* path = [ [ NSString stringWithString:(NSString*)cpath ] retain ] ;*+
    +* CFRelease( cpath ) ;*+
    +* }*+
    +* return numberOfPorts ;*+
    +*- (int)findPorts*+
    +* return [ self findPorts:CFSTR( kIOSerialBSDAllTypes ) ] ;*+
    +*- (int)findModems*+
    +* return [ self findPorts:CFSTR( kIOSerialBSDModemType ) ] ;*+
    +*- (int)findRS232Ports*+
    +* return [ self findPorts:CFSTR( kIOSerialBSDRS232Type ) ] ;*+
    +*- (NSString)streamAtIndex:(int)n+
    +* if ( n < 0 || n >= numberOfPorts ) return nil ;*+
    +* return stream[n] ;*+
    +*- (NSString)pathAtIndex:(int)n+
    +* if ( n < 0 || n >= numberOfPorts ) return nil ;*+
    +* return path[n] ;*+
    +*// common function to open port and set up serial port parameters*+
    +*static int openPort( NSString *path, int speed, int bits, int parity, int stops, int openFlags, Boolean input )*+
    +* int fd, cflag ;*+
    +* struct termios termattr ;*+
    +* *+
    +* fd = open( [ path cStringUsingEncoding:NSASCIIStringEncoding], openFlags ) ;*+
    +* if ( fd < 0 ) return -1 ;*+
    +* *+
    +* // build other flags*+
    +* cflag = 0 ;*+
    +* cflag |= ( bits == 7 ) ? CS7 : CS8 ; // bits*+
    +* if ( parity != 0 ) {*+
    +* cflag |= PARENB ; // parity*+
    +* if ( parity == 1 ) cflag |= PARODD ;*+
    +* }*+
    +* if ( stops > 1 ) cflag |= CSTOPB ;*+
    +* *+
    +* // merge flags into termios attributes*+
    +* tcgetattr( fd, &termattr ) ;*+
    +* termattr.c_cflag &= ~( CSIZE | PARENB | PARODD | CSTOPB ) ; // clear all bits and merge in our selection*+
    +* termattr.c_cflag |= cflag ;*+
    +* *+
    +* // set speed, split speed not support on Mac OS X?*+
    +* cfsetispeed( &termattr, speed ) ;*+
    +* cfsetospeed( &termattr, speed ) ;*+
    +* // set termios*+
    +* tcsetattr( fd, TCSANOW, &termattr ) ;*+
    +* return fd ;*+
    +*- (int)openInput:(NSString*)pathname baudrate:(int)speed bits:(int)bits parity:(int)parity stopbits:(int)stops flags:(int)openFlags*+
    +* return ( inputfd = openPort( pathname, speed, bits, parity, stops, openFlags, YES ) ) ;*+
    +*- (int)openInput:(NSString*)pathname baudrate:(int)speed bits:(int)bits parity:(int)parity stopbits:(int)stops*+
    +* return ( inputfd = openPort( pathname, speed, bits, parity, stops, ( O_RDONLY | O_NOCTTY | O_NDELAY ), YES ) ) ;*+
    +*- (int)openOutput:(NSString*)pathname baudrate:(int)speed bits:(int)bits parity:(int)parity stopbits:(int)stops flags:(int)openFlags*+
    +* return ( outputfd = openPort( pathname, speed, bits, parity, stops, openFlags, NO ) ) ;*+
    +*- (int)openOutput:(NSString*)pathname baudrate:(int)speed bits:(int)bits parity:(int)parity stopbits:(int)stops*+
    +* return ( outputfd = openPort( pathname, speed, bits, parity, stops, ( O_WRONLY | O_NOCTTY | O_NDELAY ), NO ) ) ;*+
    +*- (void)closeInput*+
    +* if ( inputfd > 0 ) close( inputfd ) ;*+
    +*- (void)closeOutput*+
    +* if ( outputfd > 0 ) close( outputfd ) ;*+
    +*- (int)inputFileDescriptor*+
    +* return inputfd ;*+
    +*- (int)outputFileDescriptor*+
    +* return outputfd ;*+
    +*- (int)getTermios*+
    +* int bits ;*+
    +* *+
    +* if ( inputfd > 0 ) {*+
    +* [ termioLock lock ] ;*+
    +* ioctl( inputfd, TIOCMGET, &bits ) ;*+
    +* [ termioLock unlock ] ;*+
    +* return bits ;*+
    +* }*+
    +* return 0 ;*+
    +*- (void)setRTS:(Boolean)state*+
    +* int bits ;*+
    +* if ( inputfd > 0 ) {*+
    +* [ termioLock lock ] ;*+
    +* ioctl( inputfd, TIOCMGET, &bits ) ;*+
    +* if ( state ) bits |= TIOCM_RTS ; else bits &= ~( TIOCM_RTS ) ;*+
    +* ioctl( inputfd, TIOCMSET, &bits ) ;*+
    +* [ termioLock unlock ] ;*+
    +* }*+
    +*- (void)setDTR:(Boolean)state*+
    +* int bits ;*+
    +* if ( inputfd > 0 ) {*+
    +* [ termioLock lock ] ;*+
    +* ioctl( inputfd, TIOCMGET, &bits ) ;*+
    +* if ( state ) bits |= TIOCM_DTR ; else bits &= ~( TIOCM_DTR ) ;*+
    +* ioctl( inputfd, TIOCMSET, &bits ) ;*+
    +* [ termioLock unlock ] ;*+
    +* }*+
    +*// IO Notifications*+
    +*// prototype for delegate*+
    +*- (void)port:(NSString*)name added:(Boolean)added*+
    +* if ( delegate && [ delegate respondsToSelector:@selector(port:added:) ] ) [ delegate port:name added:added ] ;*+
    +*// this is called from deviceAdded() and deviceRemoved() callbacks*+
    +*- (void)portsChanged:(Boolean)added iterator:(ioiteratort)iterator*+
    +* ioobjectt modemService ;*+
    +* CFStringRef cfString ;*+
    +* while ( ( modemService = IOIteratorNext( iterator ) ) > 0 ) {*+
    +* cfString = IORegistryEntryCreateCFProperty( modemService, CFSTR( kIOTTYDeviceKey ), kCFAllocatorDefault, 0 ) ;*+
    +* if ( cfString ) {*+
    +* [ self port:(NSString*)cfString added:added ] ;*+
    +* CFRelease( cfString ) ;*+
    +* }*+
    +* IOObjectRelease( modemService ) ;*+
    +* }*+
    +*// callback notification when device added*+
    +*static void deviceAdded(void *refcon, ioiteratort iterator )*+
    +* ioobjectt modemService ;*+
    +* *+
    +* if ( refcon ) [ (SerialManager*)refcon portsChanged:YES iterator:iterator ] ;*+
    +* else {*+
    +* while ( modemService = IOIteratorNext( iterator ) ) IOObjectRelease( modemService ) ;*+
    +* }*+
    +*static void deviceRemoved(void *refcon, ioiteratort iterator )*+
    +* ioobjectt modemService ;*+
    +* *+
    +* if ( refcon ) [ (SerialManager*)refcon portsChanged:NO iterator:iterator ] ;*+
    +* else {*+
    +* while ( modemService = IOIteratorNext( iterator ) ) IOObjectRelease( modemService ) ;*+
    +* }*+
    +*- (void)startNotification*+
    +* CFMutableDictionaryRef matchingDict ;*+
    +* *+
    +* notifyPort = IONotificationPortCreate( kIOMasterPortDefault ) ;*+
    +* CFRunLoopAddSource( CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource( notifyPort ), kCFRunLoopDefaultMode ) ;*+
    +* matchingDict = IOServiceMatching( kIOSerialBSDServiceValue ) ;*+
    +* CFRetain( matchingDict ) ;*+
    +* CFDictionarySetValue( matchingDict, CFSTR(kIOSerialBSDTypeKey), CFSTR( kIOSerialBSDAllTypes ) ) ;*+
    +* *+
    +* IOServiceAddMatchingNotification( notifyPort, kIOFirstMatchNotification, matchingDict, deviceAdded, self, &addIterator ) ;*+
    +* deviceAdded( nil, addIterator ) ; // set up addIterator*+
    +* IOServiceAddMatchingNotification( notifyPort, kIOTerminatedNotification, matchingDict, deviceRemoved, self, &removeIterator ) ;*+
    +* deviceRemoved( nil, removeIterator ) ; // set up removeIterator*+
    +*- (void)stopNotification*+
    +* if ( addIterator ) {*+
    +* IOObjectRelease( addIterator ) ;*+
    +* addIterator = 0 ;*+
    +* }*+
    +* if ( removeIterator ) {*+
    +* IOObjectRelease( removeIterator ) ;*+
    +* removeIterator = 0 ;*+
    +* }*+
    +* if ( notifyPort ) {*+
    +* CFRunLoopRemoveSource( CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource( notifyPort ), kCFRunLoopDefaultMode ) ;*+
    +* IONotificationPortDestroy( notifyPort ) ;*+
    +* notifyPort = nil ;*+
    +* }*+
    +*// prototype for delegate or subclass*+
    +*- (void)controlFlagsChanged:(int)termbits*+
    +* if ( delegate && [ delegate respondsToSelector:@selector(controlFlagsChanged:) ] ) [ delegate controlFlagsChanged:termbits ] ;*+
    +*- (void)termiosThread*+
    +* NSAutoreleasePool *pool = [ [ NSAutoreleasePool alloc ] init ] ;*+
    +* int termbits ;*+
    +* while ( 1 ) {*+
    +* if ( useTermiosThread == NO ) break ;*+
    +* if ( inputfd > 0 ) {*+
    +* if ( [ termioLock tryLock ] ) {*+
    +* ioctl( inputfd, TIOCMGET, &termbits ) ;*+
    +* if ( termiosBits != termbits ) [ self controlFlagsChanged:termbits ] ;*+
    +* termiosBits = termbits ;*+
    +* [ termioLock unlock ] ;*+
    +* }*+
    +* [ NSThread sleepUntilDate:[ NSDate dateWithTimeIntervalSinceNow:0.25 ] ] ;*+
    +* }*+
    +* else {*+
    +* [ NSThread sleepUntilDate:[ NSDate dateWithTimeIntervalSinceNow:1.0 ] ] ;*+
    +* }*+
    +* }*+
    +* [ pool release ] ;*+
    +*// If delegate is set, setDelegate also starts a termiosThread if delegate responds to -controlFlagsChanged:*+
    +*- (void)setDelegate:(id)object*+
    +* delegate = object ;*+
    +* if ( delegate == nil ) {*+
    +* useTermiosThread = NO ;*+
    +* if ( needsNotification ) {*+
    +* needsNotification = NO ;*+
    +* [ self stopNotification ] ;*+
    +* }*+
    +* }*+
    +* else {*+
    +* if ( [ delegate respondsToSelector:@selector(controlFlagsChanged:) ] ) {*+
    +* useTermiosThread = YES ;*+
    +* [ NSThread detachNewThreadSelector:@selector(termiosThread) toTarget:self withObject:nil ] ;*+
    +* } *+
    +* if ( [ delegate respondsToSelector:@selector(port:added:) ] ) {*+
    +* needsNotification = YES ;*+
    +* [ self startNotification ] ;*+
    +* }*+
    +* }*+
    +*- (id)delegate*+
    +* return delegate ;*+
    @end
    +*// SerialManager.h*+
    +*// K3 Tools*+
    +*// Created by Kok Chen on 4/28/09.*+
    +*// Copyright 2009 Kok Chen, W7AY. All rights reserved.*+
    +*//#import <Cocoa/Cocoa.h>*+
    +*#import <Foundation/Foundation.h>*+
    +*#import <UIKit/UIKit.h>*+
    +*#import <CoreData/CoreData.h>*+
    +*//#import <IOKit/IOKitLib.h>*+
    +*//#import <IOKitLib.h>*+
    +*#include <IOKit/IOKitLib.h>*+
    +*typedef int FileDescriptor ;*+
    +*@interface SerialManager : NSObject {*+
    +* NSLock *termioLock ;*+
    +* FileDescriptor outputfd ;*+
    +* FileDescriptor inputfd ;*+
    +* id delegate ;*+
    +* // serial ports in system*+
    +* NSString *stream[64] ;*+
    +* NSString *path[64] ;*+
    +* int numberOfPorts ;*+
    +* *+
    +* // termios*+
    +* int termiosBits ;*+
    +* Boolean useTermiosThread ;*+
    +* *+
    +* // IO notifications*+
    +* IONotificationPortRef notifyPort ;*+
    +* ioiteratort addIterator, removeIterator ;*+
    +* Boolean needsNotification ;*+
    +*- (void)setDelegate:(id)sender ;*+
    +*- (int)findPorts ;*+
    +*- (int)findModems ;*+
    +*- (int)findRS232Ports ;*+
    +*- (NSString*)streamAtIndex:(int)n ;*+
    +*- (NSString*)pathAtIndex:(int)n ;*+
    +*- (FileDescriptor)openInput:(NSString*)path baudrate:(int)speed bits:(int)bits parity:(int)parity stopbits:(int)stops ;*+
    +*- (FileDescriptor)openInput:(NSString*)path baudrate:(int)speed bits:(int)bits parity:(int)parity stopbits:(int)stops flags:(int)openFlags ;*+
    +*- (FileDescriptor)openOutput:(NSString*)path baudrate:(int)speed bits:(int)bits parity:(int)parity stopbits:(int)stops ;*+
    +*- (FileDescriptor)openOutput:(NSString*)path baudrate:(int)speed bits:(int)bits parity:(int)parity stopbits:(int)stops flags:(int)openFlags ;*+
    +*- (void)closeInput ;*+
    +*- (void)closeOutput ;*+
    +*- (FileDescriptor)inputFileDescriptor ;*+
    +*- (FileDescriptor)outputFileDescriptor ;*+
    +*- (int)getTermios ;*+
    +*- (void)setRTS:(Boolean)state ;*+
    +*- (void)setDTR:(Boolean)state ;*+
    +*- (void)setDelegate:(id)object ;*+
    +*- (id)delegate ;*+
    +*// delegates*+
    +*- (void)port:(NSString*)name added:(Boolean)added ;*+
    +*- (void)controlFlagsChanged:(int)termbits ;*+
    @end
    Could you help me ?

  • 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.

Maybe you are looking for