sa_array.cpp File Reference

Go to the source code of this file.

Classes

struct  _sa_Array

Defines

#define SA_ARRAY_INTEGRATION   1
#define sa_set_symbian_error(errCode, msg)
#define sa_trap_symbian_sensor_start(object, msg)
#define sa_typical_symbian_sensor_start(object, msg)
#define sa_typical_symbian_sensor_create(expr, msg)
#define sa_typical_symbian_sensor_reconfigure(sn)
#define sa_set_qt_error(ex, msg)
#define sa_typical_qt_sensor_create(expr, msg)
#define sa_reconfigure_ignore_all_keys   { success = TRUE; }
#define SENSOR_APPFOCUS_START   sa_typical_symbian_sensor_start(self->iSensor_appfocus, "failed to start appfocus scanning")
#define SENSOR_BTPROX_START   sa_typical_symbian_sensor_start(self->iSensor_btprox, "failed to start btprox scanning")
#define SENSOR_INACTIVITY_START   sa_typical_symbian_sensor_start(self->iSensor_inactivity, "failed to start inactivity scanning")
#define SENSOR_INDICATOR_START   sa_typical_symbian_sensor_start(self->iSensor_indicator, "failed to start indicator scanning")
#define SENSOR_KEYPRESS_START   sa_typical_symbian_sensor_start(self->iSensor_keypress, "failed to start keypress scanning")
#define SENSOR_PROFILE_START   sa_typical_symbian_sensor_start(self->iSensor_profile, "failed to start profile scanning")
#define SENSOR_TIMER_START   { success = sa_Sensor_timer_start(self->iSensor_timer, error); }
#define SENSOR_MARK_START   { success = sa_Sensor_mark_start(self->iSensor_mark, error); }
#define SENSOR_APPFOCUS_STOP   { self->iSensor_appfocus->Stop(); }
#define SENSOR_BTPROX_STOP   { self->iSensor_btprox->Stop(); }
#define SENSOR_INACTIVITY_STOP   { self->iSensor_inactivity->Stop(); }
#define SENSOR_INDICATOR_STOP   { self->iSensor_indicator->Stop(); }
#define SENSOR_KEYPRESS_STOP   { self->iSensor_keypress->Stop(); }
#define SENSOR_PROFILE_STOP   { self->iSensor_profile->Stop(); }
#define SENSOR_TIMER_STOP   { sa_Sensor_timer_stop(self->iSensor_timer); }
#define SENSOR_MARK_STOP   { sa_Sensor_mark_stop(self->iSensor_mark); }
#define SENSOR_APPFOCUS_IS_RUNNING   (self->iSensor_appfocus->IsActive())
#define SENSOR_BTPROX_IS_RUNNING   (self->iSensor_btprox->IsActive())
#define SENSOR_INACTIVITY_IS_RUNNING   (self->iSensor_inactivity->IsActive())
#define SENSOR_INDICATOR_IS_RUNNING   (self->iSensor_indicator->IsActive())
#define SENSOR_KEYPRESS_IS_RUNNING   (self->iSensor_keypress->IsActive())
#define SENSOR_PROFILE_IS_RUNNING   (self->iSensor_profile->IsActive())
#define SENSOR_TIMER_IS_RUNNING   (sa_Sensor_timer_is_active(self->iSensor_timer))
#define SENSOR_MARK_IS_RUNNING   (sa_Sensor_mark_is_active(self->iSensor_mark))
#define SENSOR_APPFOCUS_DESTROY   { delete self->iSensor_appfocus; self->iSensor_appfocus = NULL; }
#define SENSOR_BTPROX_DESTROY   { delete self->iSensor_btprox; self->iSensor_btprox = NULL; }
#define SENSOR_INACTIVITY_DESTROY   { delete self->iSensor_inactivity; self->iSensor_inactivity = NULL; }
#define SENSOR_INDICATOR_DESTROY   { delete self->iSensor_indicator; self->iSensor_indicator = NULL; }
#define SENSOR_KEYPRESS_DESTROY   { delete self->iSensor_keypress; self->iSensor_keypress = NULL; }
#define SENSOR_PROFILE_DESTROY   { delete self->iSensor_profile; self->iSensor_profile = NULL; }
#define SENSOR_TIMER_DESTROY   { sa_Sensor_timer_destroy(self->iSensor_timer); }
#define SENSOR_MARK_DESTROY   { sa_Sensor_mark_destroy(self->iSensor_mark); }
#define SENSOR_PROFILE_CREATE   sa_typical_symbian_sensor_create(self->iSensor_profile = CSensor_profile::NewL(self->logDb), "profile sensor initialization")
#define SENSOR_BTPROX_CREATE   sa_typical_symbian_sensor_create(self->iSensor_btprox = CSensor_btprox::NewL(self->logDb), "btprox sensor initialization")
#define SENSOR_INACTIVITY_CREATE   sa_typical_symbian_sensor_create(self->iSensor_inactivity = CSensor_inactivity::NewL(self->ac), "inactivity sensor initialization")
#define SENSOR_INDICATOR_CREATE   sa_typical_symbian_sensor_create(self->iSensor_indicator = CSensor_indicator::NewL(self->ac), "indicator sensor initialization")
#define SENSOR_APPFOCUS_CREATE   sa_typical_symbian_sensor_create(self->iSensor_appfocus = CSensor_appfocus::NewL(self->logDb), "appfocus sensor initialization")
#define SENSOR_KEYPRESS_CREATE   sa_typical_symbian_sensor_create(self->iSensor_keypress = CSensor_keypress::NewL(self->logDb), "keypress sensor initialization")
#define SENSOR_TIMER_CREATE   { self->iSensor_timer = sa_Sensor_timer_new(self->logDb, error); success = (self->iSensor_timer != NULL); }
#define SENSOR_MARK_CREATE   { self->iSensor_mark = sa_Sensor_mark_new(self->logDb, error); success = (self->iSensor_mark != NULL); }
#define reconfigure_not_supported_by_component(key)
#define SENSOR_APPFOCUS_RECONFIGURE(key, value)   sa_reconfigure_ignore_all_keys
#define SENSOR_BTPROX_RECONFIGURE(key, value)   sa_typical_symbian_sensor_reconfigure(btprox)
#define SENSOR_INACTIVITY_RECONFIGURE(key, value)   sa_reconfigure_ignore_all_keys
#define SENSOR_INDICATOR_RECONFIGURE(key, value)   sa_reconfigure_ignore_all_keys
#define SENSOR_KEYPRESS_RECONFIGURE(key, value)   sa_reconfigure_ignore_all_keys
#define SENSOR_PROFILE_RECONFIGURE(key, value)   sa_reconfigure_ignore_all_keys
#define SENSOR_TIMER_RECONFIGURE(key, value)   sa_reconfigure_ignore_all_keys
#define SENSOR_MARK_RECONFIGURE(key, value)   sa_reconfigure_ignore_all_keys
#define handle_any_sensor_start_failure
#define SENSOR_AUTOSTART_IS_ALLOWED(_name)   sensor_autostart_is_allowed("sensor." #_name ".autostart")

Functions

static gboolean sensor_autostart_is_allowed (const gchar *cfg_key)
sa_Arraysa_Array_new (ac_AppContext *ac, GError **error)
void sa_Array_start (sa_Array *self)
void sa_Array_stop (sa_Array *self)
void sa_Array_destroy (sa_Array *self)
gboolean sa_sensor_is_supported (const gchar *name)
gboolean sa_Array_sensor_is_running (sa_Array *self, const gchar *name)
void sa_Array_sensor_stop (sa_Array *self, const gchar *name)
gboolean sa_Array_sensor_start (sa_Array *self, const gchar *name, GError **error)
gboolean sa_Array_reconfigure (sa_Array *self, const gchar *key, const gchar *value, GError **error)

Define Documentation

#define handle_any_sensor_start_failure
Value:
{   \
    if ((!success) && error) {        \
      if (*error == gx_error_no_memory)     \
  gx_dblog_fatal_error_clear(self->logDb, error); \
      else            \
  gx_dblog_error_clear(self->logDb, error); \
    }             \
  }

Definition at line 237 of file sa_array.cpp.

#define reconfigure_not_supported_by_component ( key   ) 
Value:
{ \
    if (error) \
      *error = gx_error_new(domain_cl2app, code_not_supported, "configuration key '%s' not supported by concerned component", key); \
    success = FALSE; \
  }

Definition at line 219 of file sa_array.cpp.

#define SA_ARRAY_INTEGRATION   1

Definition at line 19 of file sa_array.cpp.

#define sa_reconfigure_ignore_all_keys   { success = TRUE; }

Definition at line 65 of file sa_array.cpp.

#define sa_set_qt_error ( ex,
msg   ) 
Value:
{                 \
  if (error)                \
    *error = gx_error_new(domain_qt, -1, "Qt error: %s", ex.what());  \
}

Definition at line 48 of file sa_array.cpp.

#define sa_set_symbian_error ( errCode,
msg   ) 
Value:
if (error) \
      *error = ((errCode == KErrNoMemory) ? gx_error_no_memory : gx_error_new(domain_symbian, errCode, msg ": %s (%d)", plat_error_strerror(errCode), errCode));

Definition at line 21 of file sa_array.cpp.

#define sa_trap_symbian_sensor_start ( object,
msg   ) 
Value:
{ \
  success = TRUE;         \
  TRAPD(_errCode, (object)->StartL());        \
  if (_errCode) { sa_set_symbian_error(_errCode, msg); success = FALSE; } \
}

Definition at line 25 of file sa_array.cpp.

#define sa_typical_qt_sensor_create ( expr,
msg   ) 
Value:
{           \
  try {           \
    expr ;          \
    success = TRUE;       \
  } catch (const std::exception &_ex) {   \
    sa_set_qt_error(_ex, msg);      \
    success = FALSE;        \
  }           \
}

Definition at line 54 of file sa_array.cpp.

#define sa_typical_symbian_sensor_create ( expr,
msg   ) 
Value:
{ \
  TRAPD(_errCode, expr); \
  if (_errCode) { sa_set_symbian_error(_errCode, msg); success = FALSE; } \
  else { success = TRUE; }                \
}

Definition at line 37 of file sa_array.cpp.

#define sa_typical_symbian_sensor_reconfigure ( sn   ) 
Value:
{     \
    (self->iSensor_##sn)->Reconfigure(key, value);      \
    success = TRUE;             \
}

Definition at line 43 of file sa_array.cpp.

#define sa_typical_symbian_sensor_start ( object,
msg   ) 
Value:
{ \
  success = TRUE; \
  TRAPD(_errCode, success = (object)->StartL(error));          \
  if (_errCode) { sa_set_symbian_error(_errCode, msg); success = FALSE; } \
}

Definition at line 31 of file sa_array.cpp.

#define SENSOR_APPFOCUS_CREATE   sa_typical_symbian_sensor_create(self->iSensor_appfocus = CSensor_appfocus::NewL(self->logDb), "appfocus sensor initialization")

Definition at line 214 of file sa_array.cpp.

#define SENSOR_APPFOCUS_DESTROY   { delete self->iSensor_appfocus; self->iSensor_appfocus = NULL; }

Definition at line 198 of file sa_array.cpp.

#define SENSOR_APPFOCUS_IS_RUNNING   (self->iSensor_appfocus->IsActive())

Definition at line 188 of file sa_array.cpp.

#define SENSOR_APPFOCUS_RECONFIGURE ( key,
value   )     sa_reconfigure_ignore_all_keys

Definition at line 226 of file sa_array.cpp.

#define SENSOR_APPFOCUS_START   sa_typical_symbian_sensor_start(self->iSensor_appfocus, "failed to start appfocus scanning")

Definition at line 168 of file sa_array.cpp.

#define SENSOR_APPFOCUS_STOP   { self->iSensor_appfocus->Stop(); }

Definition at line 178 of file sa_array.cpp.

#define SENSOR_AUTOSTART_IS_ALLOWED ( _name   )     sensor_autostart_is_allowed("sensor." #_name ".autostart")

Definition at line 259 of file sa_array.cpp.

#define SENSOR_BTPROX_CREATE   sa_typical_symbian_sensor_create(self->iSensor_btprox = CSensor_btprox::NewL(self->logDb), "btprox sensor initialization")

Definition at line 211 of file sa_array.cpp.

#define SENSOR_BTPROX_DESTROY   { delete self->iSensor_btprox; self->iSensor_btprox = NULL; }

Definition at line 199 of file sa_array.cpp.

#define SENSOR_BTPROX_IS_RUNNING   (self->iSensor_btprox->IsActive())

Definition at line 189 of file sa_array.cpp.

#define SENSOR_BTPROX_RECONFIGURE ( key,
value   )     sa_typical_symbian_sensor_reconfigure(btprox)

Definition at line 227 of file sa_array.cpp.

#define SENSOR_BTPROX_START   sa_typical_symbian_sensor_start(self->iSensor_btprox, "failed to start btprox scanning")

Definition at line 169 of file sa_array.cpp.

#define SENSOR_BTPROX_STOP   { self->iSensor_btprox->Stop(); }

Definition at line 179 of file sa_array.cpp.

#define SENSOR_INACTIVITY_CREATE   sa_typical_symbian_sensor_create(self->iSensor_inactivity = CSensor_inactivity::NewL(self->ac), "inactivity sensor initialization")

Definition at line 212 of file sa_array.cpp.

#define SENSOR_INACTIVITY_DESTROY   { delete self->iSensor_inactivity; self->iSensor_inactivity = NULL; }

Definition at line 200 of file sa_array.cpp.

#define SENSOR_INACTIVITY_IS_RUNNING   (self->iSensor_inactivity->IsActive())

Definition at line 190 of file sa_array.cpp.

#define SENSOR_INACTIVITY_RECONFIGURE ( key,
value   )     sa_reconfigure_ignore_all_keys

Definition at line 228 of file sa_array.cpp.

#define SENSOR_INACTIVITY_START   sa_typical_symbian_sensor_start(self->iSensor_inactivity, "failed to start inactivity scanning")

Definition at line 170 of file sa_array.cpp.

#define SENSOR_INACTIVITY_STOP   { self->iSensor_inactivity->Stop(); }

Definition at line 180 of file sa_array.cpp.

#define SENSOR_INDICATOR_CREATE   sa_typical_symbian_sensor_create(self->iSensor_indicator = CSensor_indicator::NewL(self->ac), "indicator sensor initialization")

Definition at line 213 of file sa_array.cpp.

#define SENSOR_INDICATOR_DESTROY   { delete self->iSensor_indicator; self->iSensor_indicator = NULL; }

Definition at line 201 of file sa_array.cpp.

#define SENSOR_INDICATOR_IS_RUNNING   (self->iSensor_indicator->IsActive())

Definition at line 191 of file sa_array.cpp.

#define SENSOR_INDICATOR_RECONFIGURE ( key,
value   )     sa_reconfigure_ignore_all_keys

Definition at line 229 of file sa_array.cpp.

#define SENSOR_INDICATOR_START   sa_typical_symbian_sensor_start(self->iSensor_indicator, "failed to start indicator scanning")

Definition at line 171 of file sa_array.cpp.

#define SENSOR_INDICATOR_STOP   { self->iSensor_indicator->Stop(); }

Definition at line 181 of file sa_array.cpp.

#define SENSOR_KEYPRESS_CREATE   sa_typical_symbian_sensor_create(self->iSensor_keypress = CSensor_keypress::NewL(self->logDb), "keypress sensor initialization")

Definition at line 215 of file sa_array.cpp.

#define SENSOR_KEYPRESS_DESTROY   { delete self->iSensor_keypress; self->iSensor_keypress = NULL; }

Definition at line 202 of file sa_array.cpp.

#define SENSOR_KEYPRESS_IS_RUNNING   (self->iSensor_keypress->IsActive())

Definition at line 192 of file sa_array.cpp.

#define SENSOR_KEYPRESS_RECONFIGURE ( key,
value   )     sa_reconfigure_ignore_all_keys

Definition at line 230 of file sa_array.cpp.

#define SENSOR_KEYPRESS_START   sa_typical_symbian_sensor_start(self->iSensor_keypress, "failed to start keypress scanning")

Definition at line 172 of file sa_array.cpp.

#define SENSOR_KEYPRESS_STOP   { self->iSensor_keypress->Stop(); }

Definition at line 182 of file sa_array.cpp.

#define SENSOR_MARK_CREATE   { self->iSensor_mark = sa_Sensor_mark_new(self->logDb, error); success = (self->iSensor_mark != NULL); }

Definition at line 217 of file sa_array.cpp.

#define SENSOR_MARK_DESTROY   { sa_Sensor_mark_destroy(self->iSensor_mark); }

Definition at line 205 of file sa_array.cpp.

#define SENSOR_MARK_IS_RUNNING   (sa_Sensor_mark_is_active(self->iSensor_mark))

Definition at line 195 of file sa_array.cpp.

#define SENSOR_MARK_RECONFIGURE ( key,
value   )     sa_reconfigure_ignore_all_keys

Definition at line 233 of file sa_array.cpp.

#define SENSOR_MARK_START   { success = sa_Sensor_mark_start(self->iSensor_mark, error); }

Definition at line 175 of file sa_array.cpp.

#define SENSOR_MARK_STOP   { sa_Sensor_mark_stop(self->iSensor_mark); }

Definition at line 185 of file sa_array.cpp.

#define SENSOR_PROFILE_CREATE   sa_typical_symbian_sensor_create(self->iSensor_profile = CSensor_profile::NewL(self->logDb), "profile sensor initialization")

Definition at line 210 of file sa_array.cpp.

#define SENSOR_PROFILE_DESTROY   { delete self->iSensor_profile; self->iSensor_profile = NULL; }

Definition at line 203 of file sa_array.cpp.

#define SENSOR_PROFILE_IS_RUNNING   (self->iSensor_profile->IsActive())

Definition at line 193 of file sa_array.cpp.

#define SENSOR_PROFILE_RECONFIGURE ( key,
value   )     sa_reconfigure_ignore_all_keys

Definition at line 231 of file sa_array.cpp.

#define SENSOR_PROFILE_START   sa_typical_symbian_sensor_start(self->iSensor_profile, "failed to start profile scanning")

Definition at line 173 of file sa_array.cpp.

#define SENSOR_PROFILE_STOP   { self->iSensor_profile->Stop(); }

Definition at line 183 of file sa_array.cpp.

#define SENSOR_TIMER_CREATE   { self->iSensor_timer = sa_Sensor_timer_new(self->logDb, error); success = (self->iSensor_timer != NULL); }

Definition at line 216 of file sa_array.cpp.

#define SENSOR_TIMER_DESTROY   { sa_Sensor_timer_destroy(self->iSensor_timer); }

Definition at line 204 of file sa_array.cpp.

#define SENSOR_TIMER_IS_RUNNING   (sa_Sensor_timer_is_active(self->iSensor_timer))

Definition at line 194 of file sa_array.cpp.

#define SENSOR_TIMER_RECONFIGURE ( key,
value   )     sa_reconfigure_ignore_all_keys

Definition at line 232 of file sa_array.cpp.

#define SENSOR_TIMER_START   { success = sa_Sensor_timer_start(self->iSensor_timer, error); }

Definition at line 174 of file sa_array.cpp.

#define SENSOR_TIMER_STOP   { sa_Sensor_timer_stop(self->iSensor_timer); }

Definition at line 184 of file sa_array.cpp.


Function Documentation

void sa_Array_destroy ( sa_Array self  ) 

Destroys a sensor array. Naturally all the sensors in it are stopped.

Definition at line 307 of file sa_array.cpp.

References DESTROY_ALL_SENSORS, and logt.

Referenced by kr_Controller_destroy(), and sa_Array_new().

sa_Array* sa_Array_new ( ac_AppContext ac,
GError **  error 
)

Instantiates a sensor array consisting of all supported sensors.

Definition at line 263 of file sa_array.cpp.

References ac_LogDb(), CREATE_ALL_SENSORS_OR_FAIL, gx_error_no_memory, logt, and sa_Array_destroy().

Referenced by kr_Controller_new().

gboolean sa_Array_reconfigure ( sa_Array self,
const gchar *  key,
const gchar *  value,
GError **  error 
)

Definition at line 359 of file sa_array.cpp.

References RECONFIGURE_MATCHING_SENSOR.

Referenced by kr_Controller_reconfigure().

gboolean sa_Array_sensor_is_running ( sa_Array self,
const gchar *  name 
)

Definition at line 327 of file sa_array.cpp.

References RETURN_WHETHER_NAMED_SENSOR_IS_RUNNING.

Referenced by f_is_sensor_running().

gboolean sa_Array_sensor_start ( sa_Array self,
const gchar *  name,
GError **  error 
)

Definition at line 346 of file sa_array.cpp.

References code_not_supported, domain_cl2app, gx_error_new(), and START_NAMED_SENSOR_OR_FAIL.

Referenced by f_sensor_start().

void sa_Array_sensor_stop ( sa_Array self,
const gchar *  name 
)

Definition at line 337 of file sa_array.cpp.

References STOP_NAMED_SENSOR.

Referenced by f_sensor_stop().

void sa_Array_start ( sa_Array self  ) 

Starts all supported sensors.

Definition at line 290 of file sa_array.cpp.

References error(), and TRY_START_ALL_SUPPORTED_SENSORS.

Referenced by kr_Controller_start().

void sa_Array_stop ( sa_Array self  ) 

Stops all supported sensors.

Definition at line 301 of file sa_array.cpp.

References STOP_ALL_SUPPORTED_SENSORS.

Referenced by kr_Controller_stop().

gboolean sa_sensor_is_supported ( const gchar *  name  ) 

Returns FALSE for unknown names.

Definition at line 321 of file sa_array.cpp.

References RETURN_WHETHER_NAMED_SENSOR_IS_SUPPORTED.

Referenced by f_is_sensor_supported().

static gboolean sensor_autostart_is_allowed ( const gchar *  cfg_key  )  [static]

Definition at line 246 of file sa_array.cpp.

References force_get_ConfigDb_bool().


ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:50:01 2011 by Doxygen 1.6.1