Search Results

Search found 2 results on 1 pages for 'user2164'.

Page 1/1 | 1 

  • How do I read text from a serial port?

    - by user2164
    I am trying to read data off of a Windows serial port through Java. I have the javax.comm libraries and am able to get some data but not correct data. When I read the port into a byte array and convert it to text I get a series of characters but no real text string. I have tried to specify the byte array as being both "UTF-8" and "US-ASCII". Does anyone know how to get real text out of this? Here is my code: while (inputStream.available() > 0) { int numBytes = inputStream.read(readBuffer); System.out.println("Reading from " + portId.getName() + ": "); System.out.println("Read " + numBytes + " bytes"); } System.out.println(new String(readBuffer)); System.out.println(new String(readBuffer, "UTF-8")); System.out.println(new String(readBuffer, "US-ASCII")); the output of the first three lines will not let me copy and paste (I assume because they are not normal characters). Here is the output of the Hex: 78786000e67e9e60061e8606781e66e0869e98e086f89898861878809e1e9880 I am reading from a Hollux GPS device which does output in string format. I know this for sure because I did it through C#. The settings that I am using for communication which I know are right from the work in the C# app are: Baud Rate: 9600 Databits: 8 Stop bit: 1 parity: none

    Read the article

  • NSMutableRequest skd problem

    - by user2164
    Hi, I am trying to make a web call with the iPhone. I have done this before and it works fine but now I can't make it work. I am trying to use the following method call which the documentation says is availble in 2.0 and later: - (void)addValue:(NSString *)value forHTTPHeaderField:(NSString *)field; I am attempting to build for version 3.2 and 4.0. NSMutableURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30]; [request addValue:@"0" forHTTPHeaderField:@"Content-Length"]; The error that I'm getting is a runtime error that says "-[NSURLRequest addValue:forHTTPHeaderField:]: unrecognized selector sent to instance 0x600e0c0" Can anyone tell me what I am missing that stops this code from working? Thanks.

    Read the article

1