Problem in reading cell broadcast message(nokia 3660)

Login to reply to this topic.
Fri, 2005-09-09 16:36
Joined: 2005-09-09
Forum posts: 20
hi

I am trying to retrieve the cell broadcast message containing the location string. I am including etelagsm.h and linking with gsmadv.lib.
I tried both the cases:
1) Instantiating RAdvGsmSmsMessaging, and calling ReadCbsMessage(lStatus, lMsg).
2) Invoking statically, RAdvGsmSmsMessaging::ReadCbsMessage(lStatus, lMsg)

But none of these methods work. The code compiles fine, but both the emulator and Nokia 3660 say "Application Closed" while execution.

Actually, there seems to be a problem with initializing RAdvGsmSmsMessaging, because none of the APIs, e.g RAdvGsmSmsMessaging::GetCbsReceiveMode(lMode) or RAdvGsmSmsMessaging::SetCbsReceiveMode(lMode) execute successfully.

Btw, I am using Nokia Series 60 SDK 1.2

Please somebody throw some light on this problem..

-Abhinav Kaushik

Sat, 2005-09-10 08:16
Joined: 2005-09-09
Forum posts: 20
Re: Problem in reading cell broadcast message(nokia 3660)
Dear All,

I would like to present a few things that I tried, but were unsuccessful.
I tried using the following sample code from newLC post "Mission Impossible : Getting the Location string".

RTelServer iServer;   
RMobilePhone iPhone;
RTelServer::TPhoneInfo iPhoneInfo;
TRequestStatus iReqStatus;
RMobileBroadcastMessaging iBroadcastMsg;
TBuf8<88> iGsmMsgdata;
_LIT(KGsmModuleName, "phonetsy.tsy");       
iServer.Connect();       
iServer.LoadPhoneModule( KGsmModuleName );
TInt enumphone;
               
User::LeaveIfError(iServer.EnumeratePhones(enumphone));       
if (enumphone < 1) {
  User::Leave(KErrNotFound);
}
       
User::LeaveIfError(iServer.GetPhoneInfo(0, iPhoneInfo));       
User::LeaveIfError(iPhone.Open(iServer, iPhoneInfo.iName));

iBroadcastMsg.Open(iPhone);
RMobileBroadcastMessaging::TMobileBroadcastAttributesV1 iAttrInfo;
TPckg<RMobileBroadcastMessaging::TMobileBroadcastAttributesV1> iDes(iAttrInfo);       
iBroadcastMsg.ReceiveMessage(iReqStatus,iGsmMsgdata,iDes);
User::WaitForRequest(iReqStatus);
...............
...............

In the Series 60 SDK 1.2, I am unable to find the declaration (header files) and implementation of class RMobileBroadcastMessaging. Please tell me if I am supposed to get the header and lib for RMobileBroadcastMessaging from somewhere.

On thread, "Mission Impossible : Getting the Location string", there was a post saying that for Symbian 6.1 I think etelagsm.h holds the answer. How can that be done. Does it happen using RAdvGsmSmsMessaging? I had posted what I tried in my last comment. Please tell me if I am doing something wrong.
Wed, 2006-07-26 13:53
Joined: 2005-07-04
Forum posts: 59
Re: Problem in reading cell broadcast message(nokia 3660)
Were u able to find what header files to be included for RMobileBroadcastMessaging
Thu, 2006-07-27 05:50
Joined: 2005-07-06
Forum posts: 53
Re: Problem in reading cell broadcast message(nokia 3660)
hi

RMobileBroadcastMessaging is in ETelmm.h


Thu, 2006-08-03 07:22
Joined: 2006-04-03
Forum posts: 80
Re: Problem in reading cell broadcast message(nokia 3660)
hi all,


No need to panic. I have some thing for all of you.

As far as location name is concerned. I am able to fetch the location. I have done this project before six months and i have tested this stuff for long time.


Here you go.

libs :
etel.lib estlib.lib GSMBAS.LIB etelmm.lib

includes :
<etelbgsm.h>
<etelmm.h>

The code for fetching the location from CBM message
-----------------------------------------------------
   TInt enumphone = 1;
   //Get Locattion
   RTelServer iServer;   
   RMobilePhone iPhone;
      RTelServer::TPhoneInfo iPhoneInfo;
   TRequestStatus iReqStatus;
   
   
   //GSM CBM's length is 88 bytes
   TBuf8<256> iGsmMsgdata;
_LIT(KGsmModuleName, "phonetsy.tsy");         
   
   //to get other info then location
      RBasicGsmPhone phone;
      MBasicGsmPhoneNetwork::TCurrentNetworkInfo NetworkInfo;
   
      TBuf<MBasicGsmPhoneNetwork::KLongNetworkNameSize> iLongNwName;

      
      iServer.Connect();
      
      iServer.LoadPhoneModule( KGsmModuleName );
           
      User::LeaveIfError(iServer.EnumeratePhones(enumphone));
      
      if (enumphone < 1) {
         User::Leave(KErrNotFound);
      }
   
      //Initialise the phone object
      User::LeaveIfError(iServer.GetPhoneInfo(0, iPhoneInfo));
      
      //to get other info
      User::LeaveIfError(phone.Open(iServer, iPhoneInfo.iName));
      CleanupClosePushL(phone);
      User::LeaveIfError(phone.GetCurrentNetworkInfo(NetworkInfo));
      CleanupStack::PopAndDestroy();
      //ends here
      
      // network file
      
      TBuf16<128> bLocStr;
      RMobileBroadcastMessaging iBroadcastMsg;
      User::LeaveIfError(iPhone.Open(iServer, iPhoneInfo.iName));
      iBroadcastMsg.Open(iPhone);
      RMobileBroadcastMessaging::TMobileBroadcastAttributesV1 iAttrInfo;
      TPckg<RMobileBroadcastMessaging::TMobileBroadcastAttributesV1> iDes(iAttrInfo);       
      //Wait for the CBM
      
      iBroadcastMsg.ReceiveMessage(iReqStatus,iGsmMsgdata,iDes);
      
      User::WaitForRequest(iReqStatus);
      
      TBuf16<100> bDisplay;
      
      bDisplay.Copy(iGsmMsgdata);
      
      
      int i;
      char locationString[94];
      char cbuf;
      int char_cnt=0;
      unsigned int bb = 0;
     
      unsigned char ur,curr,prev = 0;
      
      for (i=6;i<iGsmMsgdata.Length();i++)
      {
         cbuf = iGsmMsgdata[i];
         unsigned char aa = (1 << (7 - bb%7)) - 1;
         ur = cbuf & aa;
         ur = (ur << (bb)) | prev;
         curr = cbuf & (0xff ^ aa);
         curr = curr >> (7 - bb);                       
         prev = curr;
         if(ur == 0xd)
         {
            break;
         }

         locationString[char_cnt] = ur;

         bb = ++bb % 7;               

         char_cnt++;
         if(bb==0)
         {       
            locationString[char_cnt++] = prev;
            prev =0;
         }
      }
      locationString[char_cnt] = '\0';
      TPtrC8 symbPtr((TText8*)locationString);
      bDisplay.Copy(symbPtr);
    iPhone.Close();
    iServer.UnloadPhoneModule( KGsmModuleName );
    iServer.Close();

-----------------------------------------------------


cheers.
-vasant

Vasant Patel.
Sr. Software Engineer.
S60 2nd Ed., S60 3rd Ed., Win32.

  • Login to reply to this topic.