×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    34

    Maximum value of short

    Hi All,
    I am having a counter that is incremented at every transaction. I want to check if the counter reached the maximum value of 0xFFFF and then reset it to 0x0001. I am not able to do a proper compare beyond 0x7FFF. Is there any restriction on the Nokia 6212 NFC about the maximum allowed values or did someone come across this problem?. My code looks like,

    Code:
    incrementATC();
    byte[] srcBuf = new byte[2];
    Util.setShort(srcBuf, (short)0, ATC);
    byte[] desBuf = {(byte) 0x7f, (byte) 0xfe};
    	
    short res = Util.arrayCompare(srcBuf, (short)0, desBuf, (short)0, (short)2);
    if (res > ( (short) 0) ){
    	setATCount(INITIAL_ATC);
    	ISOException.throwIt((short)0x6999);
       }
    thanks
    Enya

  2. #2
    Nokia Developer Champion
    Join Date
    Sep 2007
    Posts
    915

    Re: Maximum value of short

    Quote Originally Posted by enyab View Post
    Hi All,
    I am having a counter that is incremented at every transaction. I want to check if the counter reached the maximum value of 0xFFFF and then reset it to 0x0001. I am not able to do a proper compare beyond 0x7FFF. Is there any restriction on the Nokia 6212 NFC about the maximum allowed values or did someone come across this problem?. My code looks like,

    Code:
    incrementATC();
    byte[] srcBuf = new byte[2];
    Util.setShort(srcBuf, (short)0, ATC);
    byte[] desBuf = {(byte) 0x7f, (byte) 0xfe};
    	
    short res = Util.arrayCompare(srcBuf, (short)0, desBuf, (short)0, (short)2);
    if (res > ( (short) 0) ){
    	setATCount(INITIAL_ATC);
    	ISOException.throwIt((short)0x6999);
       }
    thanks
    Enya
    Can you tell me why you are not using integer and why you are using hex.

  3. #3
    Registered User
    Join Date
    Sep 2008
    Posts
    34

    Re: Maximum value of short

    I can use an integer.. means.. a short value like (short)99 for example. But I cannot use (short)65535 .. the ATC goes max upto (short)32767.. and any value above it I dont get an integer.. I get an Hex value. I assume that the phone has an upper limit. Is it true ?.
    thanks
    Enya

  4. #4
    (Retired) Nokia Developer Admin.
    Join Date
    Jan 2006
    Location
    Michigan
    Posts
    4,664

    Re: Maximum value of short

    I think you will find that 65535 is unsigned short, a short is +- 32767

    Ron

  5. #5
    Registered User
    Join Date
    Sep 2008
    Posts
    34

    Re: Maximum value of short

    Hi Ron,
    thanks for remining that.. and so the smart card os does not support unsigned short ?. Is there any alternative way for representing a value of 65535 ?
    thanks
    Enya

Similar Threads

  1. capture short key and long key
    By kkrish in forum Symbian
    Replies: 4
    Last Post: 2010-02-09, 04:48
  2. concated sms received as separate short messages
    By priyakeshav28@gmail.com in forum General Messaging
    Replies: 0
    Last Post: 2009-05-04, 15:26
  3. Opening secure channel from the applet doesnot work with Nokia 6131
    By sujithkjoseph in forum Near Field Communication
    Replies: 0
    Last Post: 2008-06-05, 13:51
  4. Short Source_code for Direct Screen Access ... ?
    By IngeSchmidt in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2004-07-13, 16:10
  5. urgent: what is maximum string length?
    By prakala in forum Mobile Java General
    Replies: 0
    Last Post: 2003-05-23, 22:45

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •