• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ send_command函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

int main(int argc, char *argv[])
{
	if (argc != 2 || !strlen(argv[1]))
	{
	fprintf(stderr, "%s [client name]\n", argv[0]);
	return 1;
	}

	if (!set_program_name(argv[0]) || !initialize_client())
	{
	fprintf(stderr, "%s: could not initialize client\n", argv[0]);
	client_cleanup();
	return 1;
	}

	load_internal_plugins();

	if (!start_message_queue())
	{
	fprintf(stderr, "%s: could not start message queue\n", argv[0]);
	client_cleanup();
	return 1;
	}

	if (!register_resource_client(NULL))
	{
	fprintf(stderr, "%s: could not register client\n", argv[0]);
	stop_message_queue();
	client_cleanup();
	return 1;
	}

	command_handle new_service = register_service(argv[1], PARAM_ECHO_TYPE);
	command_reference service_status = 0;

	if ( !new_service || !(service_status = send_command(new_service)) ||
	     !(wait_command_event(service_status, event_complete, local_default_timeout()) & event_complete) )
	{
	fprintf(stderr, "%s: could not register service\n", argv[0]);
	if (new_service)    destroy_command(new_service);
	if (service_status) clear_command_status(service_status);
	stop_message_queue();
	client_cleanup();
	return 1;
	}

	destroy_command(new_service);
	clear_command_status(service_status);

	set_log_client_name(argv[1]);

	if (!stop_message_queue())
	{
	client_cleanup();
	return 1;
	}

	set_queue_event_hook(&message_queue_hook);

	result outcome = inline_message_queue();
	client_cleanup();
	return outcome? 0 : 1;
}
开发者ID:BackupTheBerlios,项目名称:rservr-svn,代码行数:63,代码来源:rsv-echo.c


示例2: send_command

void
PrimeSession::modify_cursor_left_edge (void)
{
    send_command (PRIME_MODIFY_CURSOR_LEFT_EDGE);
}
开发者ID:tzhuan,项目名称:scim-prime,代码行数:5,代码来源:prime_session.cpp


示例3: radio_change_state

// change radio state, e.g. from receive to ready
void radio_change_state(uint8_t next_state)
{
	radio_buffer.data[0] = next_state;
	send_command(CMD_CHANGE_STATE, radio_buffer.data, 1, 0);
}
开发者ID:astuder,项目名称:dAISy,代码行数:6,代码来源:radio.c


示例4: radio_fifo_info

// retrieve radio FIFO information
void radio_fifo_info(uint8_t reset_fifo)
{
	radio_buffer.data[0] = reset_fifo;
	send_command(CMD_FIFO_INFO, radio_buffer.data, 1, sizeof(radio_buffer.fifo_info));
}
开发者ID:astuder,项目名称:dAISy,代码行数:6,代码来源:radio.c


示例5: radio_get_modem_status

// retrieve radio modem status information
void radio_get_modem_status(uint8_t clr_pending)
{
	radio_buffer.data[0] = clr_pending;
	send_command(CMD_GET_MODEM_STATUS, radio_buffer.data, 1, sizeof(radio_buffer.modem_status));
}
开发者ID:astuder,项目名称:dAISy,代码行数:6,代码来源:radio.c


示例6: test_xml

void
test_xml(void)
{
  assert_send_command("table_create Users TABLE_HASH_KEY ShortText");
  assert_send_command("column_create Users age COLUMN_SCALAR UInt32");
  assert_send_command("column_create Users comment COLUMN_SCALAR Text");
  cut_assert_equal_string(
      cut_take_printf("<COLUMN_LIST>\n"
                      "<HEADER>\n"
                      "<PROPERTY>\n"
                      "<TEXT>id</TEXT>\n"
                      "<TEXT>UInt32</TEXT></PROPERTY>\n"
                      "<PROPERTY>\n"
                      "<TEXT>name</TEXT>\n"
                      "<TEXT>ShortText</TEXT></PROPERTY>\n"
                      "<PROPERTY>\n"
                      "<TEXT>path</TEXT>\n"
                      "<TEXT>ShortText</TEXT></PROPERTY>\n"
                      "<PROPERTY>\n"
                      "<TEXT>type</TEXT>\n"
                      "<TEXT>ShortText</TEXT></PROPERTY>\n"
                      "<PROPERTY>\n"
                      "<TEXT>flags</TEXT>\n"
                      "<TEXT>ShortText</TEXT></PROPERTY>\n"
                      "<PROPERTY>\n"
                      "<TEXT>domain</TEXT>\n"
                      "<TEXT>ShortText</TEXT></PROPERTY>\n"
                      "<PROPERTY>\n"
                      "<TEXT>range</TEXT>\n"
                      "<TEXT>ShortText</TEXT></PROPERTY>\n"
                      "<PROPERTY>\n"
                      "<TEXT>source</TEXT>\n"
                      "<TEXT>ShortText</TEXT></PROPERTY></HEADER>\n"
                      "<COLUMN>\n"
                      "<INT>%u</INT>\n"
                      "<TEXT>_key</TEXT>\n"
                      "<TEXT></TEXT>\n"
                      "<TEXT></TEXT>\n"
                      "<TEXT>COLUMN_SCALAR</TEXT>\n"
                      "<TEXT>Users</TEXT>\n"
                      "<TEXT>ShortText</TEXT>\n"
                      "<SOURCES></SOURCES></COLUMN>\n"
                      "<COLUMN>\n"
                      "<INT>%u</INT>\n"
                      "<TEXT>comment</TEXT>\n"
                      "<TEXT>%s.0000102</TEXT>\n"
                      "<TEXT>var</TEXT>\n"
                      "<TEXT>COLUMN_SCALAR|PERSISTENT</TEXT>\n"
                      "<TEXT>Users</TEXT>\n"
                      "<TEXT>Text</TEXT>\n"
                      "<SOURCES></SOURCES></COLUMN>\n"
                      "<COLUMN>\n"
                      "<INT>%u</INT>\n"
                      "<TEXT>age</TEXT>\n"
                      "<TEXT>%s.0000101</TEXT>\n"
                      "<TEXT>fix</TEXT>\n"
                      "<TEXT>COLUMN_SCALAR|PERSISTENT</TEXT>\n"
                      "<TEXT>Users</TEXT>\n"
                      "<TEXT>UInt32</TEXT>\n"
                      "<SOURCES></SOURCES></COLUMN></COLUMN_LIST>",
                      grn_obj_id(context, get("Users")),
                      grn_obj_id(context, get("Users.comment")), database_path,
                      grn_obj_id(context, get("Users.age")), database_path),
      send_command("column_list Users --output_type xml"));
}
开发者ID:mooz,项目名称:groonga,代码行数:65,代码来源:test-command-column-list.c


示例7: process_events

static void process_events(PluginData* data, PDReader* reader, PDWriter* writer) {
    uint32_t event;

    while ((event = PDRead_get_event(reader))) {
        switch (event) {
            //case PDEventType_getExceptionLocation : setExceptionLocation(plugin, writer); break;
            //case PDEventType_getCallstack : set_callstack(plugin, writer); break;

            case PDEventType_GetRegisters:
            {
                get_registers(data);
                break;
            }

            case PDEventType_GetCallstack:
            {
                if (should_send_command(data))
                    set_callstack(data, reader, writer);

                break;
            }

            case PDEventType_GetDisassembly:
            {
                if (should_send_command(data))
                    get_disassembly(data, reader, writer);

                break;
            }

            case PDEventType_GetMemory:
            {
                if (should_send_command(data))
                    get_memory(data, reader, writer);
                break;
            }

            case PDEventType_MenuEvent:
            {
                on_menu(data, reader);
                break;
            }

            case PDEventType_SetBreakpoint:
            {
                set_breakpoint(data, reader, writer);

                // if we add a breakpoint to VICE it will always stop but if we are already running when
                // adding the breakpoint we just force VICE to run again

                if (data->state == PDDebugState_Running)
                    send_command(data, "ret\n");

                break;
            }

            case PDEventType_DeleteBreakpoint:
            {
                del_breakpoint(data, reader, writer);
                break;
            }

            case PDEventType_SetExecutable:
            {
                //if (should_send_command(data))
                set_executable(data, reader);

                break;
            }
        }
    }
}
开发者ID:NextGenIntelligence,项目名称:ProDBG,代码行数:72,代码来源:c64_vice_debugger.c


示例8: gdbr_write_registers

int gdbr_write_registers(libgdbr_t* g, char* registers) {
	// read current register set
	gdbr_read_registers(g);

	unsigned int x, len = strlen(registers);
	char* buff = calloc(len, sizeof(char));
	if (!buff)
		return -1;
	memcpy(buff, registers, len);
	char* reg = strtok(buff, ",");
	while ( reg != NULL ) {
		char* name_end = strchr(reg, '=');
		if (name_end == NULL) {
			printf("Malformed argument: %s\n", reg);
			free(buff);
			return -1;
		}
		*name_end = '\0'; // change '=' to '\0'

		// time to find the current register
		int i = 0;
		while ( g->registers[i].size > 0) {
			if (strcmp(g->registers[i].name, reg) == 0) {
				const uint64_t register_size = g->registers[i].size;
				const uint64_t offset = g->registers[i].offset;
				char* value = malloc (register_size * 2);
				if (!value) {
					free (buff);
					return -1;
				}

				memset (value, '0', register_size * 2);
				name_end++; 
				// be able to take hex with and without 0x
				if (name_end[1] == 'x' || name_end[1] == 'X') name_end += 2;
				const int val_len = strlen (name_end); // size of the rest
				strcpy (value+(register_size * 2 - val_len), name_end);

				for (x=0; x < register_size; x++) {
					g->data[offset + register_size - x - 1] = hex2char(&value[x * 2]);
				}
				free(value);
			}
			i++;
		}
		reg = strtok(NULL, " ,");
	}

	free(buff);

	uint64_t buffer_size = g->data_len * 2 + 8;
	int ret;
	char* command = calloc(buffer_size, sizeof(char));
	if (!command)
		return -1;
	snprintf (command, buffer_size, "%s", CMD_WRITEREGS);
	pack_hex (g->data, g->data_len, command+1);
	ret = send_command (g, command);
	if (ret < 0) {
		free (command);
		return ret;
	}
	read_packet (g);
	free (command);
	handle_G (g);
	return 0;
}
开发者ID:KarjamP,项目名称:radare2,代码行数:67,代码来源:core.c


示例9: main

int main(int argc, char **argv)
{
  
  /* local client data */ 
  int sockfd;		   		/* file descriptor for endpoint */ 
  struct sockaddr_in client_sockaddr;	/* address/port pair */ 
  struct in_addr client_addr; 	/* network-format address */ 
  char client_dotted[INET_ADDRSTRLEN];/* human-readable address */ 
  int client_port; 			/* local port */ 
  
  /* remote server data */ 
  char *server_dotted; 		/* human-readable address */ 
  int server_port; 			/* remote port */ 
  
  /* the request */ 
  char *filename; 			/* filename to request */ 
  
  /* read arguments */ 
  if (argc != 5) { 
    fprintf(stderr, "client: wrong number of arguments\n"); 
    client_usage(); 
    exit(1); 
  } 
  
  server_dotted = argv[1]; 
  server_port = atoi(argv[2]); 
  client_port = atoi(argv[3]); 
  filename = argv[4]; 
  
  if (!client_arguments_valid(
			      server_dotted, server_port, 
			      client_port, filename)) { 
    client_usage(); 
    exit(1); 
  } 
  
  /* get the primary IP address of this host */ 
  get_primary_addr(&client_addr); 
  inet_ntop(AF_INET, &client_addr, client_dotted, INET_ADDRSTRLEN);
  
  /* construct an endpoint address with primary address and desired port */ 
  memset(&client_sockaddr, 0, sizeof(client_sockaddr));
  client_sockaddr.sin_family      = PF_INET;
  memcpy(&client_sockaddr.sin_addr,&client_addr,sizeof(struct in_addr)); 
  client_sockaddr.sin_port        = htons(client_port);
  
  /* make a socket*/ 
  sockfd = socket(PF_INET, SOCK_DGRAM, 0);
  if (sockfd<0) { 
    perror("can't open socket"); 
    exit(1); 
  } 
  
  /* bind it to an appropriate local address and port */ 
  if (bind(sockfd, (struct sockaddr *) &client_sockaddr, 
	   sizeof(client_sockaddr))<0) { 
    perror("can't bind local address"); 
    exit(1); 
  } 
  fprintf(stderr, "client: Receiving on %s, port %d\n", 
	  client_dotted, client_port); 
  
  /* send a command */ 
  send_command(sockfd, server_dotted, server_port, filename, 0, MAXINT); 
  
  fprintf(stderr, "client: requesting %s blocks %d-%d\n", 
	  filename, 0, MAXINT); 
  
  /* receive the whole document and make naive assumptions */ 
  int done = FALSE; // set to TRUE when you think you're done
  int init = TRUE;
  
  /* create a bit array to test which blocks have been received */
  struct bits blocksRecv;
  
  /* open a file to write to in the current directory */
  FILE *download = fopen(filename, "w");
  fclose(download);
  int outfd = open(filename, O_RDWR);
  
  while (!done) { 
    int retval;
  again: 
    if ((retval = select_block(sockfd, 0, 20000))==0) { 
      /* timeout */
      struct range nBlocks[12];
      int currentRange = 0;
      int i;
      int check = 0;
      int numBlocks = blocksRecv.nbits;
      for(i = 0; i < numBlocks; i++){
	/* look for the start of a missed block */
	if(check == 0 && bits_testbit(&blocksRecv, i)){
	  nBlocks[currentRange].first_block = i;
	  nBlocks[currentRange].last_block = numBlocks-1;
	  check++;
	}
	/* look for the end of a missed block */
	else if(check == 1 && !(bits_testbit(&blocksRecv, i))){
	  nBlocks[currentRange].last_block = i-1;
//.........这里部分代码省略.........
开发者ID:cenzovit,项目名称:COMP112,代码行数:101,代码来源:client.c


示例10: dus3000_read

static int dus3000_read(struct tslib_module_info *m, struct ts_sample *samples, int maxSamples)
{
	struct tslib_dus3000 *const d = (struct tslib_dus3000 *)m;
	const int fd = m->dev->fd;
	int i = 0;

	for (i = 0; i < maxSamples; ) {
		// - Read until we have at least four bytes, which is <= minimum reply length and also
		//   sufficient to determine the final length of all kinds of replies
		// then... code:
		if (!read_to_pos(fd, d, 4)) {
			break;
		}

		if (d->rxPosition >= 4) {
			if (d->rxBuffer[0] == 0x01) {
				if (!read_to_pos(fd, d, 6)) {
					break;
				}
				// read finger up / down and coordinates
				samples[i].pressure = d->rxBuffer[1] ? 255 : 0;
				samples[i].x = ((int)d->rxBuffer[2]) | (((int)d->rxBuffer[3]) << 8);
				samples[i].y = ((int)d->rxBuffer[4]) | (((int)d->rxBuffer[5]) << 8);
				i++;
				d->rxPosition = 0; // message complete

			} else if (d->rxBuffer[0] == 0x02 && d->rxBuffer[1] == 0x4c) {

				const ssize_t fullRequiredLength = 3 + d->rxBuffer[2];
				if (!read_to_pos(fd, d, fullRequiredLength)) {
					break;
				}
				d->rxPosition = 0; // message complete

				switch (d->rxBuffer[3]) {
				case tr_id_vers_info: // "acquisition of version information" response
					// get rest of message. length is stored in m_RxBuf[2]
#ifdef DEBUG
					d->rxBuffer[fullRequiredLength] = '\0';
					fprintf(stderr, "Version information: %s\n", d->rxBuffer + 3);
#endif
					break;

				case tr_id_firmw_info: // "firmware detailed information" response
#ifdef DEBUG
					d->rxBuffer[fullRequiredLength] = '\0';
					fprintf(stderr, "Firmware information: %s\n", d->rxBuffer);
#endif
					break;

				case tr_id_adj_offset: // "adjust offset" response
					if (d->state == AdjustOffset && d->rxBuffer[4] != 0) {
#ifdef DEBUG
						fprintf(stderr, "Adjust offset succeeded!\n");
#endif
					} else {
						// abort calibration if command transmission failed
						continue;
					}
					if (!send_command(fd, tm_calibrate_offset)) {
						fprintf(stderr,
							"Calibrate offset command transmission failed!\n");
						continue;
					}
					d->state = CalibrateOffset;
					break;

				case tr_id_cal_offset: // "calibrate offset" response
					if (d->state == CalibrateOffset && d->rxBuffer[4] != 0) {
#ifdef DEBUG
						fprintf(stderr, "Calibrate offset succeeded!\n");
#endif
					} else {
						// abort calibration if command transmission failed
						fprintf(stderr, "Calibrate offset failed!\n");
						continue;
					}
					// calibration done, restart coordinate transmission
					if (!send_command(fd, tm_coordinates_on)) {
						fprintf(stderr,
							"Enable coordinates command transmission failed!\n");
						continue;
					}
					d->state = Coordinates;
#ifdef DEBUG
					fprintf(stderr, "Calibration finished!\n");
#endif
					break;

				} // switch
			} else {
				fprintf(stderr,
					"DUS3000: unknown response 0x %02x %02x %02x %02x - resynchronizing!\n",
					d->rxBuffer[0], d->rxBuffer[1], d->rxBuffer[2], d->rxBuffer[3]);

				// stop coordinate transmission, flush buffers, and re-enable
				send_command(fd, tm_coordinates_off);
				usleep (50000); // let all pending data arrive in our buffer
				tcflush(fd, TCIOFLUSH); // clear buffers
				d->rxPosition = 0;
//.........这里部分代码省略.........
开发者ID:15903016222,项目名称:tslib,代码行数:101,代码来源:dmc_dus3000-raw.c


示例11: send_write_command

void send_write_command(unsigned char *command, int command_length)
{
	send_command(command, command_length);
}
开发者ID:ThomasKurz,项目名称:nut,代码行数:4,代码来源:bcmxcp_ser.c


示例12: send_read_command

void send_read_command(unsigned char command)
{
	send_command(&command, 1);
}
开发者ID:ThomasKurz,项目名称:nut,代码行数:4,代码来源:bcmxcp_ser.c


示例13: radio_part_info

// retrieve radio device information (e.g. chip model)
void radio_part_info(void)
{
	send_command(CMD_PART_INFO, 0, 0, sizeof(radio_buffer.part_info));
}
开发者ID:astuder,项目名称:dAISy,代码行数:5,代码来源:radio.c


示例14: launch_vice_with_config

static void launch_vice_with_config(PluginData* data) {
    int r, cmdIndex = 1;
    uv_process_options_t options = { 0 };

    log_debug("spawning vice...\n", "");

    char* args[10];
    args[0] = (char*)data->config.vice_exe;

    // TODO: Must generate the breakpoint file from the json one

    args[cmdIndex++] = "-remotemonitor";

    if (data->config.breakpoint_file) {
        //args[cmdIndex++] = "-moncommands";
        //args[cmdIndex++] = "examples/c64_vice/test_mon.txt";
    }

    //args[cmdIndex++] = (char*)data->config.prg_file;
    args[cmdIndex++] = NULL;

    options.exit_cb = 0;
    options.file = data->config.vice_exe;
    options.args = args;

    if ((r = uv_spawn(uv_default_loop(), &data->process, &options))) {
        MESSAGE_FUNCS->error("Unable to launch VICE", uv_strerror(r));
        return;
    }

    sleepMs(3000);

    connect_to_local_host(data);

    // if connected we load the image and make sure we get a reply back

    if (VICEConnection_isConnected(data->conn)) {
        log_debug("connected to vice...\n", "");

        if (!load_image(data, data->config.prg_file)) {
            return;
		}

        log_debug("image loaded ...\n", "");

        // parse the

        parse_mon_file(data, data->config.breakpoint_file);

        log_debug("start from basic...\n", "");

        // start vice!

        log_debug("started from basic\n", "");

        uint16_t address = 0; //get_basic_start(data);

        parse_mon_file(data, data->config.breakpoint_file);

        if (address != 0) {
            log_debug("start from %x\n", address);
            send_command(data, "g %x\n", address);
        }

        return;
    }

    log_debug("unable to make connection with vice\n", "");
}
开发者ID:NextGenIntelligence,项目名称:ProDBG,代码行数:69,代码来源:c64_vice_debugger.c


示例15: radio_func_info

// retrieve radio function revision information
void radio_func_info(void)
{
	send_command(CMD_FUNC_INFO, 0, 0, sizeof(radio_buffer.func_info));
}
开发者ID:astuder,项目名称:dAISy,代码行数:5,代码来源:radio.c


示例16: process_response

// DO NOT TRANSLATE ANY STRINGS IN THIS FUNCTION!
int process_response(const char *cmd_sent, char *msg_received)
{
   int i = 0;
   char *msg = msg_received;
   int echo_on = TRUE; //echo status
   int is_hex_num = TRUE;
   char temp_buf[80];

   if (cmd_sent)
   {
      for(i = 0; cmd_sent[i]; i++)
      {
         if (cmd_sent[i] != *msg)    // if the characters are not the same,
         {
            echo_on = FALSE;  // say that echo is off
            break;            // break out of the loop
         }
         msg++;
      }

      if (echo_on == TRUE)  //if echo is on
      {
         send_command("ate0"); // turn off the echo
         start_serial_timer(AT_TIMEOUT);
         // wait for chip response or timeout
         while ((read_comport(temp_buf) != PROMPT) && !serial_time_out)
            ;
         stop_serial_timer();
         if (!serial_time_out)
         {
            send_command("atl0"); // turn off linefeeds
            start_serial_timer(AT_TIMEOUT);
            // wait for chip response or timeout
            while ((read_comport(temp_buf) != PROMPT) && !serial_time_out)
               ;
            stop_serial_timer();
         }
      }
      else //if echo is off
         msg = msg_received;
   }

   while(*msg && (*msg <= ' '))
      msg++;

   if (strncmp(msg, "SEARCHING...", 12) == 0)
      msg += 13;
   else if (strncmp(msg, "BUS INIT: OK", 12) == 0)
      msg += 13;
   else if (strncmp(msg, "BUS INIT: ...OK", 15) == 0)
      msg += 16;

   for(i = 0; *msg; msg++) //loop to copy data
   {
      if (*msg > ' ')  // if the character is not a special character or space
      {
         if (*msg == '<') // Detect <DATA_ERROR
         {
            if (strncmp(msg, "<DATA ERROR", 10) == 0)
               return DATA_ERROR2;
            else
               return RUBBISH;
         }
         msg_received[i] = *msg; // rewrite response
         if (!isxdigit(*msg) && *msg != ':')
            is_hex_num = FALSE;
         i++;
      }
      else if (((*msg == '\n') || (*msg == '\r')) && (msg_received[i-1] != SPECIAL_DELIMITER)) // if the character is a CR or LF
         msg_received[i++] = SPECIAL_DELIMITER; // replace CR with SPECIAL_DELIMITER
   }
   
   if (i > 0)
      if (msg_received[i-1] == SPECIAL_DELIMITER)
         i--;
   msg_received[i] = '\0'; // terminate the string

   if (is_hex_num)
      return HEX_DATA;

   if (strcmp(msg_received, "NODATA") == 0)
      return ERR_NO_DATA;
   if (strcmp(msg_received + strlen(msg_received) - 15, "UNABLETOCONNECT") == 0)
      return UNABLE_TO_CONNECT;
   if (strcmp(msg_received + strlen(msg_received) - 7, "BUSBUSY") == 0)
      return BUS_BUSY;
   if (strcmp(msg_received + strlen(msg_received) - 9, "DATAERROR") == 0)
      return DATA_ERROR;
   if (strcmp(msg_received + strlen(msg_received) - 8, "BUSERROR") == 0 ||
       strcmp(msg_received + strlen(msg_received) - 7, "FBERROR") == 0)
      return BUS_ERROR;
   if (strcmp(msg_received + strlen(msg_received) - 8, "CANERROR") == 0)
      return CAN_ERROR;
   if (strcmp(msg_received + strlen(msg_received) - 10, "BUFFERFULL") == 0)
      return BUFFER_FULL;
   if (strncmp(msg_received, "BUSINIT:", 8) == 0)
   {
      if (strcmp(msg_received + strlen(msg_received) - 5, "ERROR") == 0)
         return BUS_INIT_ERROR;
//.........这里部分代码省略.........
开发者ID:kees,项目名称:scantool,代码行数:101,代码来源:serial.c


示例17: radio_get_chip_status

// retrieve radio chip status information
void radio_get_chip_status(uint8_t clr_pending)
{
	radio_buffer.data[0] = clr_pending;
	send_command(CMD_GET_CHIP_STATUS, radio_buffer.data, 1, sizeof(radio_buffer.chip_status));
}
开发者ID:astuder,项目名称:dAISy,代码行数:6,代码来源:radio.c


示例18: main


//.........这里部分代码省略.........
            max_row = atoi(optarg);
            break;
        case 'c':
            min_col = atoi(optarg);
            break;
        case 'C':
            max_col = atoi(optarg);
            break;
        case 'W':
            min_col = (FRAME_WIDTH - atoi(optarg)) / 2;
            max_col = (FRAME_WIDTH + atoi(optarg)) / 2;
            break;
        case 'H':
            min_row = (FRAME_HEIGHT - atoi(optarg)) / 2;
            max_row = (FRAME_HEIGHT + atoi(optarg)) / 2;
            break;
        default:
            break;
        }
    }

    if (telnet) {
        /* Telnet mode */

        /* show_intro is implied unless skip_intro was set */
        show_intro = (skip_intro == 0) ? 1 : 0;

        /* Set the default options */
        set_options();

        /* Let the client know what we're using */
        for (option = 0; option < 256; option++) {
            if (telnet_options[option]) {
                send_command(telnet_options[option], option);
                fflush(stdout);
            }
        }
        for (option = 0; option < 256; option++) {
            if (telnet_willack[option]) {
                send_command(telnet_willack[option], option);
                fflush(stdout);
            }
        }

        /* Set the alarm handler to execute the longjmp */
        signal(SIGALRM, SIGALRM_handler);

        /* Negotiate options */
        if (!setjmp(environment)) {
            /* We will stop handling options after one second */
            alarm(1);

            /* Let's do this */
            while (!feof(stdin) && done < 2) {
                /* Get either IAC (start command) or a regular character (break, unless in SB mode) */
                unsigned char i = getchar();
                unsigned char opt = 0;
                if (i == IAC) {
                    /* If IAC, get the command */
                    i = getchar();
                    switch (i) {
                    case SE:
                        /* End of extended option mode */
                        sb_mode = 0;
                        if (sb[0] == TTYPE) {
                            /* This was a response to the TTYPE command, meaning
开发者ID:fcambus,项目名称:nyancat,代码行数:67,代码来源:nyancat.c


示例19: radio_request_device_state

// read radio state
void radio_request_device_state(void)
{
	send_command(CMD_REQUEST_DEVICE_STATE, 0, 0, sizeof(radio_buffer.device_state));
}
开发者ID:astuder,项目名称:dAISy,代码行数:5,代码来源:radio.c


示例20: do_psync_account_teams

int do_psync_account_teams(psync_userid_t teamids[], int nids, result_visitor vis, void *param) {
  psync_socket *sock;
  binresult *bres;
  char *ids = NULL;
  char *idsp = 0;
  int k,i;
  const binresult *users;
  
  if (nids) {
    ids = (char *) psync_malloc(nids*FOLDERID_ENTRY_SIZE);
    idsp = ids;
    for (i = 0; i < nids; ++i) {
      k = sprintf(idsp, "%lld", (long long) teamids[i]);
      if (unlikely(k <= 0 )) break;
      idsp[k] = ',';
      idsp = idsp + k + 1;
    }
    if (i > 0)
      *(idsp - 1) = '\0';
    
    //debug(D_NOTICE, "Account_teams numids %d\n", nids);
    
    binparam params[] = {P_STR("auth", psync_my_auth), P_STR("timeformat", "timestamp"),  P_STR("teamids", ids), P_STR("showeveryone", "1")};

    sock = psync_apipool_get();
    bres = send_command(sock, "account_teams", params);
  } else {
    if (psync_my_auth[0]) {
      binparam params[] = {P_STR("auth", psync_my_auth), P_STR("timeformat", "timestamp"), P_STR("showeveryone", "1")};
      sock = psync_apipool_get();
      bres = send_command(sock, "account_teams", params);
    } else if (psync_my_user && psync_my_pass) {
      binparam params[] =  {P_STR("username", psync_my_user), P_STR("password", psync_my_pass), P_STR("timeformat", "timestamp"), P_STR("showeveryone", "1")};
      sock = psync_apipool_get();
      bres = send_command(sock, "account_teams", params);
    } else return -1;
  } 
  if (likely(bres))
    psync_apipool_release(sock);
  else {
    psync_apipool_release_bad(sock);
    debug(D_WARNING, "Send command returned in valid result.\n");
    return -1;
  }
  
  
  users = psync_find_result(bres, "teams", PARAM_ARRAY);
  
  //debug(D_NOTICE, "Result contains %d teams\n", users->length);
  
  if (!users->length){
    psync_free(bres);
    psync_free(ids);
    debug(D_WARNING, "Account_teams returned empty result!\n");
    return -2;
  } else {
    for (i = 0; i < users->length; ++i)
      vis(i, users->array[i], param);
  } 
  psync_free(bres);
  psync_free(ids);
  return 0;
}
开发者ID:ariia-git,项目名称:console-client,代码行数:63,代码来源:pbusinessaccount.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ send_command_packet函数代码示例发布时间:2022-05-30
下一篇:
C++ send_cmd函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap