Noob with questions :)

89 views
Skip to first unread message

Jake Dempsey

unread,
Jan 31, 2014, 7:49:12 PM1/31/14
to java...@googlegroups.com
I'm trying to help a friend out on a project leveraging the TC65i from MTX.  It has one serial port and one usb port. Its the  MTX-65i-RS485 LC 

I use a Mac but have VirtualBox running a Windows 7 VM.  I have installed NetBeans 7.4 and the Citerion WTK and MES and have been able to build and deploy an app to the device.  I know that because I can navigate to the "Module" from my computer and I see the .jar and .jad file in the a dir.

I have a few issues:

1. When I try just a sample hello world type example from the javacint website I am unable to debug from NetBeans.  I think it may have to do with the fact that VirtualBox assigns a 10.0.x.x ip address to the VM and I thought I saw somewhere the debugger requires a 192.168.x.x ip.  When I installed the MES I remember I did not change any of the values so its set to 192.168.0.2 and 192.168.0.1 using port 12345.  My goal is to run a java program and view the stdout somewhere.  I was able to set the stdout to file and navigate to the module to view the log file that is created from my stdout but that is not idea.  Basically when I start the java application (either with netbeans or with an AT command) I no longer can attach to the device with putty. I tried setting the stdout to USB but can not figure out how to 'attach' to view the std out.

2. I have another app that I am writing that attempts to make an http post to a web service on heroku.  The std out log file that is being generated is complaining that my "Profile could not be activated".  I read something about my sjnet was not set properly so I set it using a command I found that set it to "gprs", "internet".  I'm not exactly sure what needs to be set and if it has to be set once with an AT command or does it have to be set in my java program each time it runs.

Our end goal is to have a small java application that is pulling data from the rs485 and post the data to a server.  My application works in a regular cldc 1.1 emulator but I keep hitting hurdles trying to get it to work on the device.  

Jake

Nikita Kapitonov

unread,
Feb 3, 2014, 2:30:13 PM2/3/14
to java...@googlegroups.com
Hello Jake!

1. I don't know how to fix your Netbeans debug, but I suggest you can always use your serial port to read the output. You just print it as usual System.out.println(), and set your AT^SCFG="Userware/Stdout" to ASC0 or ASC1, depending on your device's serial port location. I've never used USB for that, but I remember somewhere it is said it's unusable for any type of in-app input or output.

2. Normally, you set it up once your program starts, for example my settings are:
ATClass.getInstance().send("AT^SJNET=\"GPRS\",\"" + Configuration.getInstance().APN[SIMSlot.getInstance().getCurrentSlot()] + "\",\"" + Configuration.getInstance().APNLogin[SIMSlot.getInstance().getCurrentSlot()] + "\",\"" + Configuration.getInstance().APNPassword[SIMSlot.getInstance().getCurrentSlot()] + "\",,0");

In my case, if I have several SIM-cards, I set it up once new one gets activated.

PS I know, I use Singleton pattern too much =)

2014-02-01 Jake Dempsey <angel...@gmail.com>:

--
javacint group - http://www.javacint.com/
---
You received this message because you are subscribed to the Google Groups "Cinterion Java enabled chips support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javacint+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ahmed Adnane

unread,
Feb 3, 2014, 3:08:28 PM2/3/14
to java...@googlegroups.com
Hello Jake,
If you set your stdout to USB, you have to install the MTX USB driver, then you can figure out the com port related to it. You use that com port to connect to your MTX device through Putty. The IP address has nothing to do with com serial output, in fact, it is used for output display during a debug session through Netbeans, but for that, you have to activate the 12345 port in a hidden configuration file (I don't remember its name). 
If you don't have the USB driver, let me know
Regards,


2014-02-01 Jake Dempsey <angel...@gmail.com>:

--
javacint group - http://www.javacint.com/
---
You received this message because you are subscribed to the Google Groups "Cinterion Java enabled chips support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javacint+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
ADNANE Ahmed

Jake Dempsey

unread,
Feb 3, 2014, 5:21:57 PM2/3/14
to java...@googlegroups.com
I have been able to get my std out working.  I set the stdout to USB.  If I run the java program, then unplug and plug the device back in I can see the virtual com port again and can connect to it with putty and see the stdout.. so one issue down!

My hello world app is working.  I used something very similar to the code here: http://www.javacint.com/TC65Dev#Type_some_code.  I am able to kick off the java app, unplug the usb, plug it back in and connect to the device (COM4 in my case) and view the "Main code running...." being repeated.

My current issue is I have no idea when/where/how to configure the SJNET so I can use the HttpConnector in my java code to make a http post.  The device is using a T-Mobile GSM SIM card.  

Jake

Jake Dempsey

unread,
Feb 3, 2014, 5:29:59 PM2/3/14
to java...@googlegroups.com
Sorry I mean the Connector not HttpConnector :)

httpConn = (HttpConnection)Connector.open(serverUrl); // this causes the profile not activated error.

Also, I am attaching a class I found online that I am leveraging for making a http post.  I can't remember where I found it.  I am really only using the postDataToServer method for my application.  Could someone do a quick glance to see if this is ok for use?

I have other questions but not sure how to ask/direct them.  In short: how do you ensure your http post happens?  Because of the possibility of not getting a connection or your connection breaking on post, how do you manage retries etc?  Is there a better HttpClient somewhere that I can leverage that can manage retrieving a connection and ensuring delivery of my post?

Jake

Jake Dempsey

unread,
Feb 3, 2014, 5:30:46 PM2/3/14
to java...@googlegroups.com
ugh, hit post too fast: attaching file..
connector.txt

Florent

unread,
Feb 3, 2014, 5:56:51 PM2/3/14
to java...@googlegroups.com
Hi Jake,

What is your operator name and your data plan ? There's probably a specific APN you need to use.

I haven't setup the APN manually for a long long time. The tc65lib I built (with help from Nikita and Joschka) has automatic APN detection. It fetches the MCC (Mobile Country Code) and the MNC (Mobile Network Code), find some matchings APNs and try each one. The main APN list is taken from Android. One the SIM card is exchanged (ICCID has changed), detection is performed again with the last APN used and then from scratch. Your program might already be in that APN list, you can test it by using the demo program: http://94.23.55.152:8080/demo/demo.jar
Even if you find your APN by yourself, please give me your country and your APN name so that I add it to the list if it's not there already.

Your HTTP code should work but it is quite complex, you should focus on having some simple and readable code. Here is a sample code that fetches the time on a HTTP server:

Best regards,

Florent

Gabriel Duarte

unread,
Feb 3, 2014, 5:58:16 PM2/3/14
to javacint

Hello,
have you checked the APN address from your carrier?

--

Nikita Kapitonov

unread,
Feb 3, 2014, 6:20:55 PM2/3/14
to java...@googlegroups.com
I have other questions but not sure how to ask/direct them.  In short: how do you ensure your http post happens?

That's pretty simple. In HTTP GET and POST you firstly put some data to remote server, then read some response. If you read a good response like with "200 OK" or so, you've just POSTed some data successfully, that's the idea.


2014-02-04 Jake Dempsey <angel...@gmail.com>:

--

Jake Dempsey

unread,
Feb 3, 2014, 6:28:15 PM2/3/14
to java...@googlegroups.com, nikita.k...@teplomonitor.ru
Nikita.. you made me spill my coffee.

I do understand that much.. I am more referring to a type of guaranteed messaging.  Outside of the http request/response cycle there is a number of issues that can arise that can cause the request/response cycle to fail.  I was curious if anything had been done to create a robust library for ensuring delivery taking into account the limited connectivity issue that might provide retries.

Jake

Jake Dempsey

unread,
Feb 3, 2014, 6:30:09 PM2/3/14
to java...@googlegroups.com
I found this online:


Using this info (from #6 on the page) how would I set SJNET?

Jake

Nikita Kapitonov

unread,
Feb 3, 2014, 6:53:01 PM2/3/14
to java...@googlegroups.com
Dunno about the library, but yes, there are number of issues, mainly because of the nature of GPRS connectivity. It's a complex thing, but you can divide them into:
1) Connection just hangs for a great time, no error, no exceptions
you can't really do anything here, other than identify the situation and create a new thread to make another request. And finally you will get an exception here, after some timeout.

2) You get an exception like "Profile could not be activated" or so
here you have plenty of ways - first of all retry several times; I find going to airplane mode and backwards do the deal also; and finally you can reboot your module, depending on how do you see it possible or not - some systems are designed not to reboot without vital reason. Maybe you're just ran out of money, that could be reason also.

3) You get a negative response from server
Just deal with it like you're designed it - maybe correct your request or wait a little.


2014-02-04 Jake Dempsey <angel...@gmail.com>:

Florent Clairambault

unread,
Feb 4, 2014, 5:57:05 AM2/4/14
to javacint
Given your page, it should be something like that:

AT^SJNET="gprs","epc.tmobile.com","",""

And I added the APN to the list. So if you try the demo program it should work instantly.

About HTTP comm: It's standard and pretty much your problem. You have to decide how you will want to re-send your data and when you will want to discard it. The non-standard thing is the "Profile could not activated", it can happen without any specific reason, but it seems to occur more frequently after a manual and short switch off/on.

About rebooting your module, you should define something like "if I could reach the server in the last X hours, I will reboot.". I personally never trigger a reboot unless issued by a remote command. I always let the watchdog do its work by reporting a dysfunctional state when nothing has been transmitted for some time.

Best regards,

--
Florent Clairambault

Cell : +33 6 86 95 54 05
Home : +33 1 83 64 24 64
Reply all
Reply to author
Forward
0 new messages