static void hw_control_do_query( HwControl* h, uint8_t* query, int querylen ) { uint8_t* q; T("%s: query %4d '%.*s'", __FUNCTION__, querylen, querylen, query ); q = if_starts_with( query, querylen, "power:light:brightness:" ); if (q != NULL) { if (h->client_funcs.light_brightness && android_hw->hw_lcd_backlight) { char* qq = strchr((const char*)q, ':'); int value; if (qq == NULL) { D("%s: badly formatted", __FUNCTION__ ); return; } *qq++ = 0; value = atoi(qq); h->client_funcs.light_brightness( h->client, (char*)q, value ); } return; } }
static void hw_control_do_query( HwControl* h, uint8_t* query, int querylen ) { uint8_t* q; T("%s: query %4d '%.*s'", __FUNCTION__, querylen, querylen, query ); q = if_starts_with( query, querylen, "power:light:brightness:" ); if (q != NULL) { if (h->client_funcs.light_brightness && android_hw->hw_lcd_backlight) { char* qq = strchr((const char*)q, ':'); int value; if (qq == NULL) { D("%s: badly formatted", __FUNCTION__ ); return; } *qq++ = 0; value = atoi(qq); h->client_funcs.light_brightness( h->client, (char*)q, value ); } return; } else { q = if_starts_with( query, querylen, "led:" ); if (q!=NULL) { if (h->client_funcs.led_notification) { int on=0, off=0, color=0; int ret = sscanf(q, "%d,%d,%d", &on, &off, &color); if (ret <3) { D("%s: badly formatted", __FUNCTION__ ); return; } h->client_funcs.led_notification( h->client, "led", on, off, color); } } else { q = if_starts_with( query, querylen, "vibrator:" ); if (q!=NULL && h->client_funcs.vibrator_notification) { int value = atoi(q); h->client_funcs.vibrator_notification( h->client, "vibrator", value, 0); } } } }