Starting and Stopping a Timer in Java Card + GSM

Hi,
I seem to not be able to start a timer that my applet has
allocated using the PRO_CMD_TIMER_MANAGEMENT
pro active command. I want to for example set the timer
interval to 5 seconds and I understand from the gsm
specs that the TLV value should then be {(byte) 0x00,
(byte) 0x00, (byte) 0x05} as the hour is zero, the minute is
zero and the seconds = 5 .
The command qualifier I set to 0x00 to start the timer and
I set it to 0x02 to stop the timer. The start and stop I
control from two menu items. From the GSM spec the first 2 bits
control the timer and the remaining 6 are RFU (reserved for future use),
now I assume I can then set the RFU bits to 0.
I then have a EVENT_TIMER_EXPIRED in my processToolkit which then plays a tone.
The tone proactive command works but I dont seem to be able to start the time or
stop it ?
HELP ?
is there any suggestions or any error in my reasoning here ?

I tried your solution but it seems to have no effect (?)
This is the log entry of the comms during sneding of the timer start
command:
(Notice that where you have the Timer Identifier tag = A4, here it is
24 and where you have Timer Value Tag = A5, here it is 25 - these tags and the APDU's are generated with the GSM java card libs in the development kit I'm using.....) It seems to go through but the TIMER_EVENT_EXPIRED never happens....Help ? Have a look at the source code I included (maybe I'm doing something wrong)....
**THE APDU's
//346:
A0 12 00 00 13
//Fetch
//     RAPDU = D0 11 81 03 01 27 00 82 02 81 82 24 01 01 25 03 00 00 10
//     SW = 9000
//347:
A0 14 00 00 0C 81 03 01 27 00 02 02 82 81 03 01 31
//>>Terminal response
//     SW = 9142
**SOURCE CODE
//IN A METHOD CALLED FROM A MENU ITEM SELECTED
byte[] valCurrentCallUnit = {
(byte)0x00, (byte)0x00, (byte)0x10
}; //i.e. 1 second
timerHandle = reg.allocateTimer();
proHdlr.init(PRO_CMD_TIMER_MANAGEMENT,(byte)0x00,DEV_ID_ME);
proHdlr.appendTLV((byte) TAG_TIMER_IDENTIFIER,timerHandle);
proHdlr.appendTLV((byte) TAG_TIMER_VALUE,valCurrentCallUnit,
(short) 0, (short) 3);
result = proHdlr.send();
//the following is not suppose to be required according to GSM 11.14
reg.setEvent(EVENT_TIMER_EXPIRATION);
//IN THE processToolkit method, I have:
public void processToolkit(byte event) {
     EnvelopeHandler envHdlr = EnvelopeHandler.getTheHandler();
     ProactiveHandler proHdlr = ProactiveHandler.getTheHandler();
     ProactiveResponseHandler rspHdlr;
switch(event) {
case EVENT_TIMER_EXPIRATION:
doSomething();
proHdlr.init(PRO_CMD_TIMER_MANAGEMENT,
(byte)0x00,DEV_ID_ME);
proHdlr.appendTLV((byte) TAG_TIMER_IDENTIFIER,timerHandle);
proHdlr.appendTLV((byte) TAG_TIMER_VALUE,valCurrentCallUnit,
(short) 0, (short) 3);
result = proHdlr.send();
break;
} /** switch event */
}/** processToolkit */
Any help would be appreciated....

Similar Messages

  • Starting and stopping applications via a Java-application on Windows/Unix

    Hello,
    I want to start java and other applications via a java application.
    This java application should start several different applications on windows and
    on unix systems and take care of their current state (e.g. running/not running).
    For all applications to be started there are .sh-scripts for unix and .bat-scripts
    for windows. In the scripts there could be a java call, e.g. "java someApplication",
    or some executables could be called. These scripts set the applications' environment etc.
    and start the application finally.
    My java application calls these scripts via the ProcessBuilder API, which is working fine.
    But there is the following problem: on windows, when executing a script that starts
    some other application, the ProcessBuilder gives me process-handle to the started
    process. If calling destroy() on this handle, only the cmd.exe gets killed which
    started the application. The application itself is running on. This is undesired behaviour
    since I want to be able to control the started applications, at least start and stop it which
    is impossible that way.
    On unix, it is working when using
    "exec java someApplication"
    instead of just
    "java someApplication"
    in the .sh-scripts. The exec command substitutes the shell process with the underlying
    process started in the script, so everything is working as expected on unix.
    But how could I get this working on windows systems? Is there any equivalent to the exec
    command on unix? Any suggestions appreciated.
    If something's unclear in my description, please let me know.

    Yes - after looking at this option - I think that's the direction I am going to go. It probably makes sense to give my JMS topics and my BPEL server their own OC4J instances anyway - for a number of reasons.
    Lon

  • How to start and Stop Running services with Java Programme

    I have some Service Runinig on My Windows machine like Tomcat Server,i want to update some file in Tomcat server through java program ,it works only when my tomcat stops ,I want to write peice of Code so that i can stop service with my prog and start after updating my files

    heres something that may help yeah
    http://wrapper.tanukisoftware.org/doc/english/introduction.html

  • Starting and stopping Elapsed Time

    I have some code in LabVIEW 8.2.1 I am writing for Qual test with a customer. The basics of the test are the following: monitor and record pressure (thru transducers), temperatures (fluid and ambient), and monitor the opening and closing a valve. The valve has two light switches orientated in such a way, that mechanical counters will count a cycle when it is fully closed to open to closed.
    The problem I am having, is that I need the elapsed time vi to start counting, once it has moved off of the full open switch. It needs to count to 240 seconds, at which time it will pass on to an on bit, which will energize the valve again. I can get it to start running at the right part, but it will stop once
    it gets in between the two light switches. It almost seems like the elapsed time vi doesn't have enough flexibility for what I need. That or I need to write a bunch of code that would enable it to do what I want.
    I am not sure on how I can post code so it can be viewed in LabVIEW, so here is a word doc.
    Attachments:
    elapsed timing vi.doc ‏45 KB

    Hello Chadius, 
    Thanks for posting,
    I took a look at your code this morning. We at NI recommend using varibales as one of the last resources when trying to pass data out in cases where this is rseally necesary, when looking at your code I realized that the variables to pass data are not needed and that actually there are some misconceptions about the functionality of the vi funtions, do not be ashamed that is totally understandable when you are new to a concept and more understandable if you are new to labVIEW.
    Before proceeding with the code I would like to encourage you to check the Getting started with LV It gives you the basis to start programming in labVIEW and helps us understand better how LV executes.
    There is also a lot of good help loaded in Labview that can help us determine what to use and what is expected of each function, you can access this by pressing ""CTRL+H" and accesing the detailed help when hovering over a specific VI and clicking detailed help.
    Then if you are a new user to labview and would likely use labview for long term development I will suggest the training.
    Now, getting to your code I can see that you are doing a bit more code than what you actually need, so for instance:
    -we can eliminate the constants and the selector and just pass the boolean.
    -we can also use less while loops so the part where you write to the variables can be done in the same while loop on the right.
    -Instead writing to the variable and reading from that same variable you can just wire a cable so you have the same data
    -You can use the error wire out/in of the functions to control code execution.
    Last but not least, I am asumming here that this application you are coding is most likely to be a state machine where you are making a choice depending of the inputs you have, If "A" then "B"
    This is an example of a simple state machine based on user input, you can change that input to be an event, a trigger etc.
    Hope this helps, 
    Luis
    Application Engineer
    National Instruments. 
    Attachments:
    LV_Getting_Started.pdf ‏918 KB
    This way looks better.JPG ‏20 KB
    Delete constants pass only bbolean.JPG ‏15 KB

  • I am having data i want to measure pulse width without using hardware and tell me how to start and stop soft timer using labview

    soft pulse width measurement

    If you are creating a pulse in software somehow, then you can use Pulse Measurements.vi that's on the Analyze>Waveform Measurements palette. This will require that the input is of the waveform data type with signal and timing information. There's several timing functions on the time & Dialog palette that you could probably use. Check out Tick Count and Elapsed Time. If you could provide more details on what exactly you need to do, we could provide more help.

  • Starting and stopping timer using external inputs interfaced with labview

    hello,
    I have trouble finding how to start and stop the timer using external voltage or current pulse. we are interfacing a circuit to labview. so for that we need to count the time it takes between the two external voltages. We have to keep on comparing the voltages to some reference voltage. And when the external voltage crosses the reference voltage we have to start the timer and again we have to stop the timer using tha same logic. We need it for time calculation between the triggers.
    hope you can help.

    https://decibel.ni.com/content/docs/DOC-23334 is agood example to start. You need to modify it to include stop trigger.

  • I do not have the 'Advanced' tab on the menu bar. I am trying to change ringtone on my iphone 4s. Have done the following: Right cick on song, entered the start and stop times, but unable to proceed as need 'Advanced' tab in order to change to option.

    I do not have the 'Advanced' tab on the menu bar. I am trying to change ringtone on my iphone 4s. Have done the following: Right cick on song, entered the start and stop times, but unable to proceed as need 'Advanced' tab in order to change to option.

    You don't need to upgrade your software.  But if you're struggling with Spry, IMO you should cut your losses and switch to something better for the longrun.
    If you have a budget to work with, I highly recommend Project Seven's Pop-Menu Magic 3.  It's easy to use in DW CS4, 5, 6 or CC.  More importantly, it's bullet proof and works in all devices. 
    Pop-Menu  Magic3 by PVII (commercial DW extension)
    http://www.projectseven.com/products/menusystems/pmm3/index.htm
    If you don't have a budget to work with, you can roll your own menus with jQuery plugins.  A bit more effort on your part, but they perform better than Spry.
    jQuery Superfish
    http://users.tpg.com.au/j_birch/plugins/superfish/
    jQuery MegaMenu2
    DEMO:
    http://www.geektantra.com/projects/jquery-megamenu-2/
    DOWNLOAD:
    http://code.google.com/p/jquery-megamenu/
    Nancy O.

  • In Month View, showing start and stop times for appointments

    Hi, I want to show both the start and stop times for all appointments in my iCal Month view and have not been able to figure out how to do that. Any suggestions? - Dave

    I would also like to know how to do this if possible. I want to print month-view schedules with start and end times for events. Thought I'd bump this up to see if anyone has any ideas.

  • Printing event start and stop times

    In month view, is there any way to have both the start and stop times for an event show when you print the calendar so you can see the duration of an event - thanks.

    You might be able to use this script to reset the start/stop times to zero.  Try with a small selection and see if it works for you.
    http://dougscripts.com/itunes/scripts/ss.php?sp=batchtrimtime

  • My ipod nano 7th gen. won't save the changes I make to a song's start and stop time. How do I fix this?

    So I have a few songs that I don't like the intro to or the end of it that I had cut to where I wanted on my previous ipod. When I try to do the ame thing with this one with the start and stop time, it will work for awhile and then randomly start and stop where it had originally. I have done it like 4 times now for some songs and I can't seem to get it to stick. Suggestions?

    If you use the Sync feature in iTunes, then it needs to be done to the song in your Music Library, then synced with the iPod.  If you do not use the Sync feature and are performing the changes to the song on your iPod specifically, then the setting may be getting overwritten when you drag the song that's already on the iPod back onto the iPod.  It will overwrite all local settings for the song on the iPod with the settings in your library. 
    Try performing the changes to the song in your music library, and then dragging it back over to your ipod (or Sync your iPod if you use that feature).  This will make sure that the setting are consistent in both your library and iPod in-case you were to ever overwrite the song once more.

  • Hard drive starts and stops a few times

    I went to my parents for the Christmas holidays today and tried to use their older computer to put music on to my iPod. Since it's so old I couldn't use iTunes, so instead I used Ephpod. After it was done copying the files to the iPod I saved the changes and disconnected, but immediately afterwards instead of going straight to the menu, the hard drive started and stopped about 10-15 times with the Apple logo being displayed. Now I can't reach the menu, the hard drive will start and stop spinning until it gives up, and when I reconnect it to the computer it won't even recognize it as an external drive. Any ideas?
    eMac   Mac OS X (10.4.3)  

    I have the same issue and the iPod wont reset.

  • I am trying to do a full Time Machine Backup to a new external disk. The backup starts, and it says "Time remaining about 4 days." That seems like a very long time, but the real problem is that the computer "logs off" after a few hours, and the b.u. stops

    I am trying to do a full Time Machine Backup to a new external disk. The backup starts, and it says "Time remaining about 4 days." That seems like a very long time, but the real problem is that the computer "logs off" after a few hours, and the backup stops. The system preferences are set to "Never" for Computer sleep and Display sleep. The computer does not ordinarily log off automatically, but it has done this twice since I started the Time Machine backup.

    If you have more than one user account, these instructions must be carried out as an administrator.
    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Enter the word "Starting" (without the quotes) in the String Matching text field. You should now see log messages with the words "Starting * backup," where * represents any of the words "automatic," "manual," or "standard." Note the timestamp of the last such message. Clear the text field and scroll back in the log to that time. Select the messages timestamped from then until the end of the backup, or the end of the log if that's not clear. Copy them (command-C) to the Clipboard. Paste (command-V) into a reply to this message.
    If all you see are messages that contain the word "Starting," you didn't clear the search box.
    If there are runs of repeated messages, post only one example of each. Don't post many repetitions of the same message.
    When posting a log extract, be selective. Don't post more than is requested.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Some personal information, such as the names of your files, may be included — anonymize before posting.

  • Is there a DJ app for the Ipad that will read the "start" and "stop time" setting for each individual song, as they are set in the song Options screen in Itunes?

    Is there a DJ app for the Ipad that will read the "start" and "stop time" setting for each individual song, as they are set in the song Options screen in Itunes? The Ipod Touch, by itself does not allow cross-fading, therefore when the stop time is edited short, the song jusst truncates then goes to the next song. I tried the DJay ap and while it would crossfade, it would NOT read the song settings for the stop marker. So now I want to try and Ipad and see if there is an app that will READ the Itune stop settings within the song. I do NOT want an app that will allow me to DO the stop marker. I want an app that will READ the stop marker from the song as it is set in Itunes.

    Itunes provides the option for setting the Start and Stop times of each music track.  However, the start and stop times do not synchronize to the iPhone.  I don't understand why this option is even available as it doesn't work when listening to music on the phone.  I have not found another application that will support the start and stop time markets.  I have searched quite a bit for this but can't find anything.  I hope we can find something. 

  • Start and stop the Communication channel from Java Mapping

    How to start and stop the Communication channel from Java Mapping in XI 3.0
    Scenario  PI - > MQ -> Third Party web application 
    Web application is down and then Communication channels are stop manually .  
    We need to automate this process,
    MQ Solution - Trigger will be set in MQ which will be called when web application is stopped
    Trigger will send u201CSTOP u201C message to PI
    How to configure PI scenario to stop different com channels when this message received ?

    check this link: http://help.sap.com/saphelp_nw04/helpdata/EN/45/0c86aab4d14dece10000000a11466f/frameset.htm
    make sure that MQ send http request to PI. i dont think a configuration scenario is required in PI. Only roles should be enabled with proper user provided to MQ team.
    However, for security reasons, you can configure a scenario if you dont want to expose PI infrastructure directly to 3rd parties.

  • Start and Stop a Windows Service From Java

    Is there any way to start and stop a Windows service from Java? The only post I found on it (http://forum.java.sun.com/thread.jspa?threadID=647509) had a link to one of the many aps that allow Java programs to be services, which is not what I am interested in doing.
    I am attempting to get data from performance counters from the Windows Performance Monitor into a Java ap without using JNI. I can get the data from C++ or a .net language pretty easily and was going to create a service that would listen for socket requests and feed back the data. However, I'd like to start and stop that service when my java code starts and stops. Is this possible? Would it make more sense to just use a .exe and Runtime.exec()?

    If it's only to start or stop a service then you could use the net command without any need for JNI.import java.io.*;
    public class MsWinSvc {
        static final String CMD_START = "cmd /c net start \"";
        static final String CMD_STOP = "cmd /c net stop \"";
        public static int startService(String serviceName) throws Exception {
            return execCmd(CMD_START + serviceName + "\"");
        public static int stopService(String serviceName) throws Exception {
            return execCmd(CMD_STOP + serviceName + "\"");
        static int execCmd(String cmdLine) throws Exception {
            Process process = Runtime.getRuntime().exec(cmdLine);
            StreamPumper outPumper = new StreamPumper(process.getInputStream(), System.out);
            StreamPumper errPumper = new StreamPumper(process.getErrorStream(), System.err);
            outPumper.start();
            errPumper.start();
            process.waitFor();
            outPumper.join();
            errPumper.join();
            return process.exitValue();
        static class StreamPumper extends Thread {       
            private InputStream is;
            private PrintStream os;
            public StreamPumper(InputStream is, PrintStream os) {
                this.is = is;
                this.os = os;
            public void run() {
                try {
                    BufferedReader br = new BufferedReader(new InputStreamReader(is));
                    String line;
                    while ((line = br.readLine()) != null)
                        os.println(line);
                catch (Exception e) {
                    e.printStackTrace();
    }Regards

Maybe you are looking for

  • Did You Know: Folders in iOS 7

    Did you know that now with iOS 7, you not longer have a limit to the amount of apps you can have in 1 folder??  Previously you could only have 9 apps per folder but now that limit has been lifted! Try and place as many of your favorite apps into one

  • Poor LV6.1 webserver performanc​e

    Hi! I want to use the LV6.1 webserver to serve a static html site including some front panel images. All works as expected except the very poor performance even on the local system. I first suspected PC/WIn configuration problems but since two other

  • Itunes wont launch ive tried uninstalling and reinstalling i double click icon then nothing happens

    i tried to open itunes i click icon nothing happens ive looked at other forums and gone into settings etc repaired quick time etc still nothing

  • How to get a summarized mail traffic report in exchange 2013

    Hi all How to calculate the exchange 2013 SMTP mail traffic in terms of hour,day,month,top senders,largest message and top recipients list . Same time we would like to have those summarized mail traffic report for all the mailbox servers in the form

  • 0CALDAY as a key field

    Hello All, I made some changes to tansformation for calculation of some keyfigures from one DSO to another. The changes were calculating the keyfigure correctly. But in the target DSO the 0CALDAY is selected as a key field, due to which the records f