Exemplo n.º 1
0
static void http_capture_send_buffer() {
	int len = 64;
	if (http_capture_sentLen+len > 18*168)
		len = 18*168 - http_capture_sentLen;
	if (len <= 0)
		return;
		
	Tuplet start = TupletInteger(0xFFF9, http_capture_sentLen);
	Tuplet buf = TupletBytes(1000, &http_capture_frameBuffer[http_capture_sentLen], len);

	DictionaryIterator *iter;
	app_message_out_get(&iter);

	if (iter == NULL)
		return;

	dict_write_tuplet(iter, &start);
	dict_write_tuplet(iter, &buf);
	dict_write_end(iter);

	http_capture_sentLen += len;

	app_message_out_send();
	app_message_out_release();	
}
Exemplo n.º 2
0
HTTPResult http_out_get(const char* url, bool use_post, int32_t cookie, DictionaryIterator **iter_out) {
	AppMessageResult app_result = app_message_out_get(iter_out);
	if(app_result != APP_MSG_OK) {
		return app_result;
	}
	DictionaryResult dict_result = dict_write_cstring(*iter_out, HTTP_URL_KEY, url);
	if(dict_result != DICT_OK) {
		return dict_result << 12;
	}
	dict_result = dict_write_int32(*iter_out, HTTP_COOKIE_KEY, cookie);
	if(dict_result != DICT_OK) {
		return dict_result << 12;
	}
	dict_result = dict_write_int32(*iter_out, HTTP_APP_ID_KEY, our_app_id);
	if(dict_result != DICT_OK) {
		return dict_result << 12;
	}
	if(!use_post) {
		dict_result = dict_write_int8(*iter_out, HTTP_USE_GET_KEY, 1);
		if(dict_result != DICT_OK) {
			return dict_result << 12;
		}
	}
	return HTTP_OK;
}
Exemplo n.º 3
0
Arquivo: common.c Projeto: abl/peapod
void reset_sequence_number() {
    DictionaryIterator *iter = NULL;
    app_message_out_get(&iter);
    if(!iter) return;
    dict_write_int32(iter, IPOD_SEQUENCE_NUMBER_KEY, 0xFFFFFFFF);
    app_message_out_send();
    app_message_out_release();
}
Exemplo n.º 4
0
void request_command(int command) {
  DictionaryIterator *dict;
  if (app_message_out_get(&dict) == APP_MSG_OK) {
	dict_write_uint8(dict, REACTOR_COMMAND, command);
	app_message_out_send();
	app_message_out_release();
  }
}
Exemplo n.º 5
0
Arquivo: common.c Projeto: abl/peapod
AppMessageResult ipod_message_out_get(DictionaryIterator **iter_out) {
    AppMessageResult result = app_message_out_get(iter_out);
    if(result != APP_MSG_OK) return result;
    dict_write_int32(*iter_out, IPOD_SEQUENCE_NUMBER_KEY, ++s_sequence_number);
    if(s_sequence_number == 0xFFFFFFFF) {
        s_sequence_number = 1;
    }
    return APP_MSG_OK;
}
Exemplo n.º 6
0
/*
 * Make a battery status request
 */
void battery_request() {

  DictionaryIterator *iter;
  app_message_out_get(&iter);
  if (!iter) 
	return;

  dict_write_uint8(iter, REQUEST_BATTERY_KEY, 1);
  app_message_out_send();
  app_message_out_release();
}
void request_phone_state() {
  Tuplet value = TupletInteger(REQUEST_DATA_KEY, REQUEST_UNREAD | REQUEST_MISSED);
  DictionaryIterator *iter;
  app_message_out_get(&iter);
  if (iter == NULL) return;

  dict_write_tuplet(iter, &value);
  dict_write_end(iter);
  
  app_message_out_send();
  app_message_out_release();
}
Exemplo n.º 8
0
/*
 * Make a calendar request
 */
void calendar_request() {

  DictionaryIterator *iter;
  app_message_out_get(&iter);
  if (!iter) 
	return;
		
  dict_write_int8(iter, REQUEST_CALENDAR_KEY, -1);
  dict_write_uint8(iter, CLOCK_STYLE_KEY, CLOCK_STYLE_24H);
  g_count = 0;
  g_received_rows = 0;
  app_message_out_send();
  app_message_out_release();
  set_status(STATUS_REQUEST);
}
Exemplo n.º 9
0
static void send_cmd() {
  Tuplet value = TupletInteger(1, 1);

  DictionaryIterator *iter;
  app_message_out_get(&iter);

  if (iter == NULL) {
    return;
  }

  dict_write_tuplet(iter, &value);
  dict_write_end(iter);

  app_message_out_send();
  app_message_out_release();
}