当前位置: 首页>>代码示例>>C++>>正文


C++ send_text函数代码示例

本文整理汇总了C++中send_text函数的典型用法代码示例。如果您正苦于以下问题:C++ send_text函数的具体用法?C++ send_text怎么用?C++ send_text使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了send_text函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: do_set_param

static int do_set_param(Request *req)
{
	u8 *name = g_buffer;
	char *content = (char *)g_buffer;
	int retv = 0;
	Section * section;
	Ack ack;

	retv = receive_text(name, req->dataSize);
	name[req->dataSize] = 0;
	APP_INFO("Section Name is : %s\n", (char *)name);
	section = find_section((char *)name);
	ack.info = ack.result = (NULL == section) ? -1 : 0;
	retv = send_text((u8 *)&ack, sizeof(ack));
	if (ack.result == -1) {
		APP_INFO("Section [%s] is not found!\n", (char *)name);
		return -1;
	}

	// Receive parameter settings
	retv = receive_text((u8 *)content, req->info);
	content[req->info] = 0;
	if (0) {
		APP_INFO("===== Parameter Setting is : \n%s", content);
	} else {
		APP_INFO("===== Parameter Setting is : \n%s", content);
		retv = mw_config_params(section->map, content);
		retv = (*section->set)(section->name);
		ack.result = ack.info = retv;
	}
	retv = send_text((u8 *)&ack, sizeof(ack));
	return retv;
}
开发者ID:ShawnOfMisfit,项目名称:ambarella,代码行数:33,代码来源:image_server.c

示例2: do_get_param

static int do_get_param(Request *req)
{
	u8 *name = g_buffer;
	char *content = (char *)g_buffer;
	int retv = 0;
	Section * section;
	Ack ack;

	// Get section name
	retv = receive_text(name, req->dataSize);
	name[req->dataSize] = 0;
	APP_INFO("Section Name is : %s\n", (char *)name);

	section = find_section((char *)name);
	if (NULL == section) {
		ack.result = -1;
		ack.info = -1;
		APP_INFO("Section [%s] is not found!\n", (char *)name);
		return send_text((u8 *)&ack, sizeof(ack));
	} else {
		retv = (*section->get)(section->name, req->info);
		retv = mw_output_params(section->map, &content);
		APP_INFO("\n%s\n", content);
		ack.result = retv;
		ack.info = strlen(content);
		send_text((u8 *)&ack, sizeof(ack));
		return send_text((u8 *)content, ack.info);
	}
}
开发者ID:ShawnOfMisfit,项目名称:ambarella,代码行数:29,代码来源:image_server.c

示例3: hash_map

int hash_map(int actor_node, char *text) {

    /** public function - see header */

    int socket=clients.client[actor_node].socket;
    char map_name[80]="";
    int map_id;

    if(sscanf(text, "%*s *s")==-1){

        //if no tail specified in command, default to current map
        map_id=clients.client[actor_node].map_id;
    }
    else if(sscanf(text, "%*s %[^\n]", map_name)==1){

        map_id=get_map_id(map_name);

        if(map_id==-1){

            send_text(socket, CHAT_SERVER, "%cMap does not exist", c_red3+127);
            return 0;
        }
    }
    else {

        send_text(socket, CHAT_SERVER, "%cyou need to use the format #MAP [map_name] or #MAP", c_red3+127);
        return 0;
    }

    get_map_details(actor_node, map_id);
    get_map_developer_details(actor_node, map_id);

    return 0;
}
开发者ID:UnoffLandz,项目名称:unoff-landz,代码行数:34,代码来源:hash_commands_devs.c

示例4: hash_set_map_development_status

int hash_set_map_development_status(int actor_node, char *text) {

    /** public function - see header */

    int socket=clients.client[actor_node].socket;
    int development_status=0;
    int map_id;

    //extract data from text string
    if(sscanf(text, "%*s %i %i", &map_id, &development_status)!=2){

        send_text(socket, CHAT_SERVER, "%cyou need to use the format #SET_MAP_DEVELOPMENT_STATUS [map id] [map development status 0-2]", c_red3+127);
        return 0;
    }

    //check map exists
    if(strlen(maps.map[map_id].elm_filename)==0){

        send_text(socket, CHAT_SERVER, "%cthat map id does not exist", c_red3+127);
        return 0;
    }

    //update map array
    maps.map[map_id].development_status=development_status;

    //update database
    push_sql_command("UPDATE MAP_TABLE SET STATUS=%i WHERE MAP_ID=%i", maps.map[map_id].development_status, map_id);

    send_text(socket, CHAT_SERVER, "%cyou changed the development status of map %i to %i", c_green3+127, map_id, maps.map[map_id].development_status);

    return 0;
}
开发者ID:UnoffLandz,项目名称:unoff-landz,代码行数:32,代码来源:hash_commands_devs.c

示例5: main

void main ()
{
	get_text();

	send_text(1,line1);
	send_text(2,line2);
}
开发者ID:thenaughtychild,项目名称:HMI_for_HCL,代码行数:7,代码来源:send_data_to_lcd.c

示例6: hash_set_map_name

int hash_set_map_name(int actor_node, char *text) {

    /** public function - see header */

    int socket=clients.client[actor_node].socket;
    char map_name[80]="";
    int map_id;

    if(sscanf(text, "%*s %i %[^\n]", &map_id, map_name)!=2){

        send_text(socket, CHAT_SERVER, "%cyou need to use the format #SET_MAP_NAME [map id] [map name]", c_red3+127);
        return 0;
    }

    //check map exists
    if(strlen(maps.map[map_id].elm_filename)==0){

        send_text(socket, CHAT_SERVER, "%cthat map id does not exist", c_red3+127);
        return 0;
    }

    //update map array
    strcpy(maps.map[map_id].map_name, map_name);

    //update database
    push_sql_command("UPDATE MAP_TABLE SET MAP_NAME='%s' WHERE MAP_ID=%i", maps.map[map_id].map_name, map_id);

    send_text(socket, CHAT_SERVER, "%cyou changed the name of map %i to %s", c_green3+127, map_id, maps.map[map_id].map_name);

    return 0;
}
开发者ID:UnoffLandz,项目名称:unoff-landz,代码行数:31,代码来源:hash_commands_devs.c

示例7: interr_P1

__interrupt void interr_P1(void){
    
    P1OUT ^= 0x01;              // Sinalizar interrupção
  
    flag_pisca ^= 1;		// Inverte flag_pisca
    if (flag_pisca == 1){
        // Enviar msg pela serial
        send_text("Botton ON\n");
    }		
    else{
        // Enviar msg pela serial
        send_text("Botton OFF\n");
        
        itoa(int_buffer_ADC10, char_buffer_ADC10, 10);          // int to char base 10
        send_text(char_buffer_ADC10);
        send_byte('\n');
    }
    
    P1IFG = 0x00;		// Zera a flag de interrupção da porta 1
    
    // DEBAUNCING
    __delay_cycles(8000);	// delay de 1ms
    x = 1;			// garante que irá entrar no while
    
    while(x == 1)
    if((P1IN & 0x08) == 0){     // testa se o botão p1.3 está pressionado
        x = 0;		        // muda estatus de x para sair do while
    }
    else{			// se não estiver pressionado volta a conferir
        x = 1;
    }
    __delay_cycles(8000);	// delay de 1ms
    
}
开发者ID:edgarreis,项目名称:BrigdeCom-MSP430G2553,代码行数:34,代码来源:ComUart04.c

示例8: full_char_proc

gboolean full_char_proc(KeySym keysym)
{
  char *s = half_char_to_full_char(keysym);

  if (!s)
    return 0;

  char tt[CH_SZ+1];

  utf8cpy(tt, s);

  if (current_CS->im_state  == HIME_STATE_ENG_FULL) {
    send_text(tt);
    return 1;
  }

  if (current_method_type() == 6 && current_CS->im_state == HIME_STATE_CHINESE)
    add_to_tsin_buf_str(tt);
  else
  if (gtab_phrase_on() && ggg.gbufN)
    insert_gbuf_nokey(tt);
  else
    send_text(tt);

  return 1;
}
开发者ID:CarterTsai,项目名称:hime,代码行数:26,代码来源:eve.c

示例9: hash_cp

int hash_cp(int actor_node, char *text) {

    /** public function - see header */

    (void)(text);

    int socket=clients.client[actor_node].socket;

    int active_chan_slot=clients.client[actor_node].active_chan;

    if(active_chan_slot==0){

        send_text(socket, CHAT_SERVER, "%cNo active channel", c_red3+127);
        return 0;
    }

    int chan_id=clients.client[socket].chan[active_chan_slot-31];

    send_text(socket, CHAT_SERVER, "%cListing for channel [%i]: %s", c_blue1+127, chan_id, channels.channel[chan_id].channel_name);
    send_text(socket, CHAT_SERVER, "%cDescription: %s", c_blue1+127, channels.channel[chan_id].description);
    send_text(socket, CHAT_SERVER, "%cCharacters in channel...", c_blue1+127);

    for(int i=0; i<MAX_ACTORS; i++){

        if(clients.client[i].client_node_status==CLIENT_NODE_USED && clients.client[i].player_type==PLAYER){

            if(player_in_chan(i, chan_id)!=-1){

                send_text(socket, CHAT_SERVER, "%c%s ", c_blue1+127, clients.client[i].char_name);
            }
        }
    }

    return 0;
}
开发者ID:UnoffLandz,项目名称:unoff-landz,代码行数:35,代码来源:hash_commands_chat.c

示例10: hash_track

int hash_track(int actor_node, char *text) {

    /** public function - see header */

    int socket=clients.client[actor_node].socket;
    char on_off[4]="";

    if(sscanf(text, "%*s %s", on_off)!=1){

        send_text(socket, CHAT_SERVER, "%cyou need to use the format #TRACK [ON / OFF]", c_red3+127);
        return 0;
    }

    str_conv_upper(on_off);

    if(strcmp(on_off, "ON")==0) {

        send_text(socket, CHAT_SERVER, "%cposition tracking 'on'", c_green3+127);
        clients.client[actor_node].debug_status=DEBUG_TRACK;
    }

    else if(strcmp(on_off, "OFF")==0) {

        send_text(socket, CHAT_SERVER, "%cposition tracking 'off'", c_green3+127);
        clients.client[actor_node].debug_status=DEBUG_OFF;
    }

    else {

        send_text(socket, CHAT_SERVER, "%cyou need to use the format #TRACK [ON / OFF]", c_red3+127);
        return 0;
    }

    return 0;
}
开发者ID:UnoffLandz,项目名称:unoff-landz,代码行数:35,代码来源:hash_commands_devs.c

示例11: hash_set_map_author_email

int hash_set_map_author_email(int actor_node, char *text) {

    /** public function - see header */

    int socket=clients.client[actor_node].socket;
    char map_author_email[80]="";
    int map_id;

    //extract data from text string
    if(sscanf(text, "%*s %i %s", &map_id, map_author_email)!=2){

        send_text(socket, CHAT_SERVER, "%cyou need to use the format #SET_MAP_AUTHOR_EMAIL [map id] [map author email address]", c_red3+127);
        return 0;
    }

    //check map exists
    if(strlen(maps.map[map_id].elm_filename)==0){

        send_text(socket, CHAT_SERVER, "%cthat map id does not exist", c_red3+127);
        return 0;
    }

    //update map array
    strcpy(maps.map[map_id].author_email, map_author_email);

    //update database
    push_sql_command("UPDATE MAP_TABLE SET AUTHOR_EMAIL='%s' WHERE MAP_ID=%i", maps.map[map_id].author_email, map_id);

    send_text(socket, CHAT_SERVER, "%cyou changed the author email of map %i to %s", c_green3+127, map_id, maps.map[map_id].author_email);

    return 0;
}
开发者ID:UnoffLandz,项目名称:unoff-landz,代码行数:32,代码来源:hash_commands_devs.c

示例12: hash_trace

int hash_trace(int actor_node, char *text) {

    /** public function - see header */

    (void)(text);

    int socket=clients.client[actor_node].socket;
    int map_id=clients.client[actor_node].map_id;
    int map_axis=maps.map[map_id].map_axis;

    int pos_x=clients.client[actor_node].map_tile % map_axis;
    int pos_y=clients.client[actor_node].map_tile / map_axis;

    send_text(socket, CHAT_SERVER, "%cwalkable tile trace (@=%i/%i)", c_green3+127, pos_x, pos_y);

    for(int x=pos_x-20; x<pos_x+20; x++){

        char str[81]="";

        for(int y=pos_y-40; y<pos_y+40; y++){

            int z=(y * map_axis) + x;

            if(z==clients.client[actor_node].map_tile){

                fprintf(stderr, "@");
                strcat(str, "@");
            }
            else {

                if(y>=0 && y<map_axis && x>=0 && x<map_axis){

                    if(maps.map[map_id].height_map[z]==NON_TRAVERSABLE_TILE){

                        fprintf(stderr, "#");
                        strcat(str, "#");
                    }
                    else{

                        fprintf(stderr, ".");
                        strcat(str, ".");
                    }
                }
                else{
                    fprintf(stderr, ":");
                    strcat(str, ":");
                }
            }
        }

        send_text(socket, CHAT_SERVER, "%c%s", c_grey1+127, str);
        fprintf(stderr, "\n");
    }

    return 0;
}
开发者ID:UnoffLandz,项目名称:unoff-landz,代码行数:56,代码来源:hash_commands_devs.c

示例13: emit

void static emit()
{
  send_text("Received:");
  char  text[2+1];
  text[2] = '\0';
  while ( received_data_is_waiting() )
  {
    send_text(" 0x");
    u8_to_hex( next_received_char(), text);
    send_text( text);
  }
  send_text("\r\n");
}
开发者ID:neilstockbridge,项目名称:dsoquad-demo,代码行数:13,代码来源:main.c

示例14: send_text

MAV_RESULT GCS_MAVLINK_Tracker::handle_command_long_packet(const mavlink_command_long_t &packet)
{
    // do command
    send_text(MAV_SEVERITY_INFO,"Command received: ");

    switch(packet.command) {

    case MAV_CMD_COMPONENT_ARM_DISARM:
        if (is_equal(packet.param1,1.0f)) {
            tracker.arm_servos();
            return MAV_RESULT_ACCEPTED;
        }
        if (is_zero(packet.param1))  {
            tracker.disarm_servos();
            return MAV_RESULT_ACCEPTED;
        }
        return MAV_RESULT_UNSUPPORTED;

    case MAV_CMD_DO_SET_SERVO:
        if (!tracker.servo_test_set_servo(packet.param1, packet.param2)) {
            return MAV_RESULT_FAILED;
        }
        return MAV_RESULT_ACCEPTED;

        // mavproxy/mavutil sends this when auto command is entered 
    case MAV_CMD_MISSION_START:
        tracker.set_mode(AUTO, MODE_REASON_GCS_COMMAND);
        return MAV_RESULT_ACCEPTED;

    default:
        return GCS_MAVLINK::handle_command_long_packet(packet);
    }
}
开发者ID:ArduPilot,项目名称:ardupilot,代码行数:33,代码来源:GCS_Mavlink.cpp

示例15: do_aaa_control

static int do_aaa_control(Request *req)
{
	int retv = 0;
	Ack ack;

	APP_INFO("Process AAA control id [%d].\n", (int)req->info);
	switch (req->info) {
	case AAA_START:
		retv = mw_start_aaa(fd_iav);
		if (retv < 0) {
			APP_ERROR("mw_start_aaa failed!\n");
		}
		APP_INFO("AAA control : Start AAA done !\n");
		break;
	case AAA_STOP:
		retv = mw_stop_aaa();
		APP_INFO("AAA control : Stop AAA done !\n");
		break;
	default:
		APP_PRINTF("Unknown AAA control id [%d]\n", (int)req->info);
		break;
	}
	ack.result = ack.info = retv;
	retv = send_text((u8 *)&ack, sizeof(ack));

	return retv;
}
开发者ID:ShawnOfMisfit,项目名称:ambarella,代码行数:27,代码来源:image_server.c


注:本文中的send_text函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。