Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User mehraj123's Avatar
    Join Date
    Dec 2008
    Posts
    47
    Hi all,
    i want to build a lbs application.i run an example which return cellid of that phone.but when i run that example alert is null.

    please help me..
    My code:

    var so;
    // Called from onload()
    function setup(){
    try {
    so = device.getServiceObject("Service.SysInfo", "ISysInfo");
    console.info("setup: so: %s", so);
    }
    catch (e) {
    alert('<setup> ' +e);
    }
    }
    function cellid(){
    var entity = "Network";
    var key = "CellID";
    var criteria = new Object();
    criteria.Entity = entity;
    criteria.Key = key;

    try {
    var result = so.ISysInfo.GetInfo(criteria);
    alert(result);
    alert(result.ReturnValue);
    }
    catch (e) {
    alert ("getSysInfo: " + e);
    }
    }

    plz check this mycode and tell me what is the error.

    Thanks
    Mehraj

  2. #2
    Registered User jasperr's Avatar
    Join Date
    Jul 2007
    Posts
    2
    I have the same issue.

    When requesting:

    Entity="Network"
    Key="CurrentNetwork"

    within the criteria object, only the following properties come back
    with valid data:

    NetworkName
    NetworkStatus = 1
    NetworkMode
    CountryCode (MCC)
    NetworkCode (MNC)

    LocationStatus comes back as "true" which indicates AreaCode (LAC) and
    CellId are valid, but when printed to debug all they contain is:

    AreaCode = undefined
    CellId = undefined

    I was not able to access the "CellID" property directly which is why
    I am reading "CurrentNetwork" which returns all of the above parameters,
    but only with an async callback.

    For example:

    Code:
      var criteria = new Object();
      criteria.Entity = "Network";
      criteria.Key = "CurrentNetwork";
    
      try {
        so.ISysInfo.GetInfo(criteria, locCallback);
      }
      catch {}
    
    
     function locCallback(transId, eventCode, result)
     {
        showObject(result.ReturnValue);
     }
    The documentation seems to suggest that you cannot read the
    LAC and CellID directly with GetInfo(), but that they can
    be read with GetNotification(), although I've not had
    any success with this yet either.
    Last edited by jasperr; 2009-04-07 at 13:19. Reason: Highlight source code

  3. #3
    Registered User jasperr's Avatar
    Join Date
    Jul 2007
    Posts
    2
    I have had some success with this. The following code does work but you only get an alert when the "CellID" changes which is not as useful as being able to read the current "CellID".

    Code:
    function getCellID()
    {
      var criteria = new Object();
      criteria.Entity = "Network";
      criteria.Key = "CellId";
    
      try
      {
        var result = so.ISysInfo.GetNotification(criteria, cellCallback);
      }    
    
      catch (e)
      {
        alert ("Exception: " + e);
      }  
    }
    
    function cellCallback(transId, eventCode, result)
    {
      alert(result.ReturnValue.Status);
    }
    If you try to use
    Code:
    so.ISysInfo.GetInfo
    instead of
    Code:
    so.ISysInfo.GetNotification
    what you get is an exception with the text "Error: invalid transaction id".

  4. #4
    Registered User jzferreira's Avatar
    Join Date
    Sep 2008
    Location
    Manaus, Brazil
    Posts
    109
    Hi Jasper,

    it doesn't work because it's a asynchronous method. The code below will help you.

    Code:
    function getCELLID(){
        try {
            var so = device.getServiceObject("Service.SysInfo", "ISysInfo");
            var criteria = new Object();
            criteria.Entity = 'Network';
            criteria.Key = 'CellID';
            alert("GetCellID")
            
            var result = so.ISysInfo.GetNotification(criteria, function(transId, eventCode, result){
            
                if (eventCode == 4) {
                    alert("Error " + result.ErrorCode + ": " + result.ErrorMessage);
                    return;
                }
                alert("ok");
                alert(result);
                alert(result.ReturnValue);
                alert(result.ReturnValue.Status);
            });
        } 
        catch (e) {
            return null;
        }
    }

  5. #5
    Registered User mdaphu's Avatar
    Join Date
    Feb 2008
    Posts
    1
    Quote Originally Posted by jzferreira View Post
    Hi Jasper,

    it doesn't work because it's a asynchronous method. The code below will help you.
    Thank you for the code! But... how to use this?
    Just calling getCELLID() doesn't work...

    Thanks!

Similar Threads

  1. Replies: 1
    Last Post: 2009-03-23, 10:45
  2. Replies: 1
    Last Post: 2009-02-17, 09:01
  3. Problem with player resuming at Nokia 5800
    By Asgard83 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2008-12-11, 13:50
  4. What is the real problem to receive data calls with Nokia TDMA cell modem?
    By jackal_jr in forum PC Suite API and PC Connectivity SDK
    Replies: 0
    Last Post: 2002-12-04, 16:05

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved