IALARMMGR_SetAlarm returns Code as 1 | developer.brewmp.com IALARMMGR_SetAlarm returns Code as 1 | developer.brewmp.com

Developer

IALARMMGR_SetAlarm returns Code as 1

Forums:

 

HI All

I am able to create the Alarm Instance Successfully but IALARMMGR_SetAlarm returns Code as 1 but not able to set the Alarm

Below is the Code Snippet.

 

if (ISHELL_CreateInstance(pMe->piShell, AEECLSID_ALARMMGR,        (void **)&pMe->piAlarmMgr) != SUCCESS) {                  pMe->piAlarmMgr = NULL;       return FALSE;    }    int nErr;uint32 nSecs = 20;    uint32 UserCode = 0;    nErr = IALARMMGR_SetAlarm(pMe->piAlarmMgr, AEECLSID_CPOWERMODETEST,&UserCode, nSecs);    DBGPRINTF("Error Code %d",nErr);    if (AEE_SUCCESS != nErr)     {        DBGPRINTF("Alarm Not Set");        return FALSE;    }    else    {        DBGPRINTF("Alarm Set");    }    return TRUE;

 

Please help me on this

 

Thanks & Regards

 Pradeep

 

try passing NULL in UsercODE
IALARMMGR_SetAlarm(pMe->piAlarmMgr, AEECLSID_CPOWERMODETEST,NULL, nSecs);
try ISHELL_SetAlarm()
where do u try this?

try passing NULL in UsercODE
IALARMMGR_SetAlarm(pMe->piAlarmMgr, AEECLSID_CPOWERMODETEST,NULL, nSecs);
try ISHELL_SetAlarm()
where do u try this?

i Tried this on the Device..
i even tried ISHELL_SetAlarm(pMe->piShell,AEECLSID_CPOWERMODETEST,0,20); but the return code is 1
 
i tried IALARMMGR_SetAlarm(pMe->piAlarmMgr, AEECLSID_CPOWERMODETEST,NULL, nSecs); passing NULL in User Code but the return code is 1..
 

i Tried this on the Device..
i even tried ISHELL_SetAlarm(pMe->piShell,AEECLSID_CPOWERMODETEST,0,20); but the return code is 1
 
i tried IALARMMGR_SetAlarm(pMe->piAlarmMgr, AEECLSID_CPOWERMODETEST,NULL, nSecs); passing NULL in User Code but the return code is 1..
 

it may be a device issue.
can u check this. SetAlarm can return EFAILED if this condition is true.
   nNow = GETTIMESECONDS();
   /* can't do calculation.... */
   if (nNow < ONE_YEAR_SECS) {
      return EFAILED;
   }

it may be a device issue.
can u check this. SetAlarm can return EFAILED if this condition is true.
   nNow = GETTIMESECONDS();
   /* can't do calculation.... */
   if (nNow < ONE_YEAR_SECS) {
      return EFAILED;
   }

Hi Shivendra
 
I Tried your Code
 
int nNow = GETTIMESECONDS();DBGPRINTF("NOw %d",nNow);   /* can't do calculation.... */   if (nNow < ONE_YEAR_SECS) {       DBGPRINTF("Failed %d",ONE_YEAR_SECS);      return EFAILED;   }
This is the Ouptut i Got
NOw 19946 Failed 31536000  

Hi Shivendra
 
I Tried your Code
 
int nNow = GETTIMESECONDS();DBGPRINTF("NOw %d",nNow);   /* can't do calculation.... */   if (nNow < ONE_YEAR_SECS) {       DBGPRINTF("Failed %d",ONE_YEAR_SECS);      return EFAILED;   }
This is the Ouptut i Got
NOw 19946 Failed 31536000  

this is the reason for error then. the current time the device is invalid, hence the call to setAlarm fails with EFAILED. you cannot set the Alarm in this state.
possible reasons:
This time value is obtained from the base station.
Probablly the device has not aquired time when u call this function. Use ISTIMEVALID() or IDeviceNotifier  - NMASK_DEVICENOTIFIER_TIMEACQUIRED, to determine if system time has been acquired.
You should call setAlarm only after the device has aquired a valid time.

this is the reason for error then. the current time the device is invalid, hence the call to setAlarm fails with EFAILED. you cannot set the Alarm in this state.
possible reasons:
This time value is obtained from the base station.
Probablly the device has not aquired time when u call this function. Use ISTIMEVALID() or IDeviceNotifier  - NMASK_DEVICENOTIFIER_TIMEACQUIRED, to determine if system time has been acquired.
You should call setAlarm only after the device has aquired a valid time.

Is their any API to set the Date and Time ???

Is their any API to set the Date and Time ???

no. in CDMA devices, the data/time is synced from Base Station once the device registers itself.

no. in CDMA devices, the data/time is synced from Base Station once the device registers itself.