Пример #1
0
void sms_new_message_callback(char *number, char *content)
{
    screen_resume();
    
    g_sms_has_new_message = 1;
    UG_ButtonSetText(&g_home_window, 9, "K");


    strcpy(g_sms_new_message_info, number);
    sensor_t *sms_sensor = sensor_find(SMS_ID);
    sms_sensor->p = g_sms_new_message_info;
    ifttt_check();
    sms_sensor->p = NULL;

    ifttt_book_add(content);
}
Пример #2
0
/**
 * @brief Attach a specified sensor descriptor to a sensor device.
 *
 * Applications invoke this routine to attach a \c sensor_t instance to an
 * existing sensor device of a specified \c type.  Assuming the attach call
 * is successful, the \c sensor_t instance can then be used with other sensor
 * API functions to perform operations on the device.
 *
 * @param   sensor  Specifies a descriptor to attach to the sensor device.
 * @param   type    Specifies the sensor type to attach.
 * @param   num     Driver instance number; currently ignored.
 * @param   aux     API Reserved value; should always be set to zero.
 * @return  bool    true if the call succeeds, else false is returned.
 */
bool sensor_attach(sensor_t *sensor, sensor_type_t type, int num, void *aux)
{
	bool attached = false;

	sensor_hal_t *hal = sensor_find(type);

	sensor->hal  = hal;   /* Set unconditionally for use in driver init. */
	sensor->type = type;  /* user-selected type (for multi-function device)
	                       **/
	sensor->aux  = aux;

	if ((hal != NULL) && /* sensor_bus_probe (hal, 0) && */
			((hal->sensor_init)(sensor, num))) {
		sensor->mod = SENSOR_STATE_NORMAL;
		sensor->err = SENSOR_ERR_NONE;
		attached = true;
	} else {
		sensor->err = SENSOR_ERR_DRIVER;
	}

	return attached;
}