您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ strncmp_P函数代码示例

51自学网 2021-06-03 08:31:25
  C++
这篇教程C++ strncmp_P函数代码示例写得很实用,希望能帮到您。

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

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

示例1: soap_parse_element

static voidsoap_parse_element (soap_context_t *ctx){  if (*ctx->buf != '<')    SOAP_STREAM_ERROR();  if (ctx->buf[1] == '?')    return;			/* ignore parser instruction. */  if (ctx->parsing_complete)    return;  ctx->buf[ctx->buflen] = 0;  SOAP_DEBUG ("parse_element %s/n", ctx->buf);  if (!ctx->found_envelope)    {      if (strncmp_P (ctx->buf + 1, PSTR("Envelope"), 8))	SOAP_STREAM_ERROR();      ctx->found_envelope = 1;    }  else if (!ctx->found_body)    {      if (strncmp_P (ctx->buf + 1, PSTR("Body"), 4))	return;			/* ignore anything until <Body> */      ctx->found_body = 1;    }  else if (!ctx->found_funcname)    {      soap_lookup_funcname (ctx);      ctx->found_funcname = 1;    }  else if (strncmp_P (ctx->buf + 1, PSTR("/Body"), 5) == 0)    {      ctx->parsing_complete = 1;    }  else if (ctx->buf[1] != '/' && ctx->argslen < SOAP_MAXARGS)    {      char *ptr = strstr_P (ctx->buf + 1, PSTR("type="));      if (!ptr)	SOAP_STREAM_ERROR ();      ptr += 6;			/* Skip type=" */      char *end = strchr (ptr, '"');      if (!end)	SOAP_STREAM_ERROR ();      *end = 0;			/* chop off rest beyond type specifier */      end = strchr (ptr, ':');      if (end) ptr = end + 1;	/* Ignore namespace specifier */      SOAP_DEBUG ("found arg type: '%s'/n", ptr);      if (strcmp_P (ptr, PSTR("int")) == 0)	ctx->args[ctx->argslen].type = SOAP_TYPE_INT;      else if (strcmp_P (ptr, PSTR("string")) == 0)	ctx->args[ctx->argslen].type = SOAP_TYPE_STRING;      else	SOAP_STREAM_ERROR ();    }}
开发者ID:1234tester,项目名称:ethersex,代码行数:60,


示例2: DEBUG_P

ModemGSM::EStandardAnswer ModemGSM::WaitAnswer(unsigned int pTimeoutMS, boolean pHandleURC){	//DEBUG_P("WaitAnswer --> ");	for(;;)	{		if(Readln(pTimeoutMS, false) == TIMEOUT)		{			DEBUG_P(PSTR("** TIMEOUT"LB));			return saTimeout;		}				//DEBUGLN(FRXBuff);		if(strcmp_P(FRXBuff,PSTR("OK")) == 0)		{			//DEBUGLN_P("OK");			return saOk;    		}		else if(	(strcmp_P(FRXBuff,PSTR("ERROR")) == 0) ||					(strncmp_P(FRXBuff,PSTR("+CME ERROR:"), 11) == 0) ||					(strncmp_P(FRXBuff,PSTR("+CMS ERROR:"), 11) == 0))		{			DEBUG_P(PSTR("** "));			DEBUGLN(FRXBuff);			return saError;    		}		else if(pHandleURC)			HandleURC();		else			return saUnknown;    	}}
开发者ID:chipburner,项目名称:Arduino-GSM-Thermostat,代码行数:32,


示例3: process

bool SikwiWifi::process(){  newLine = this->read_till_eol();  if(newLine){    if(strncmp_P(this->buffer, PSTR("SK+RDY"), 6)==0 || strncmp_P(this->buffer, PSTR("Exception"), 9)==0 || strncmp_P(this->buffer, PSTR(">>>st"), 5)==0)      return false;    this->previousMillis = millis();    return true;  }  else if(millis() - this->previousMillis >= this->intervalTest) {    this->previousMillis = millis();    uint8_t i = 0;    do{      this->writeCharPROGMEMln(PSTR("SK"));      if(this->wait_for_esp_response(1000))        return true;      delay(300);    }while(i++<3);    return false;  }  return true;}
开发者ID:sikwi,项目名称:firmware,代码行数:25,


示例4: loop

void loop(){    if (wifly.available() > 0) {    	/* See if there is a request */		if (wifly.gets(buf, sizeof(buf))) {		    if (strncmp_P(buf, PSTR("GET /ping"), 9) == 0) {				/* GET request */#ifdef DEBUG				Serial.println(F("PONG XML requested"));#endif				while (wifly.gets(buf, sizeof(buf)) > 0) {				    //Skip rest of request				}				sendPong();	   	 	} else if (strncmp_P(buf, PSTR("GET /data"), 9) == 0) {	        	/* POST request */#ifdef DEBUG	        	Serial.println(F("DATACOLLECTOR XML: sendind sensors data"));#endif				while (wifly.gets(buf, sizeof(buf)) > 0) {				    //Skip rest of request				}                // discard rest of input		    	// wifly.flushRx();						sendSensorsDataXML();	    	} else {	       		// Unexpected request#ifdef DEBUG				Serial.print(F("Unexpected: "));				Serial.println(buf);				Serial.println(F("Sending 404"));#endif				while (wifly.gets(buf, sizeof(buf)) > 0) {				    //Skip rest of request				}                // discard rest of input				wifly.flushRx();						send404();	    	}		}    }}
开发者ID:LValentini,项目名称:MathDuino,代码行数:54,


示例5: dumpAllFields

/* * This method parses a incoming string (the message is expected to be complete) * Depending on the instruction the action is undertaken. */void SerialCommunicator::setReceivedMessage(const char* newMessage){	if (strcmp_P(newMessage, DUMP) == 0)	{		dumpAllFields();	} else if (strncmp_P(newMessage, GET, 4) == 0)	{		SerialOutput.println((__FlashStringHelper *) GET);		FieldData *fieldData = FieldData::findField(newMessage + 4);		if (fieldData != 0) fieldData->dump();	} else if (strncmp_P(newMessage, SET, 4) == 0)	{		SerialOutput.println((__FlashStringHelper *) SET);		FieldData *fp = FieldData::findField(newMessage + 4);		if (fp != 0)		{			fp->setValue(newMessage + 4 + strlen_P((const char *) fp->myClassName) + strlen_P((const char *) fp->myFieldName) + 2);			fp->dump();		}	} else if (strncmp_P(newMessage, SET, 3) == 0)	{		SerialOutput.println((__FlashStringHelper *) SET);		FieldData::visitAllFields(dumpWritableData, true);	} else if (strcmp_P(newMessage, LOG_HEADER) == 0)	{		SerialOutput.print((__FlashStringHelper *) LOG_HEADER);		SerialOutput.print(FIELDSEPERATOR);		FieldData::visitAllFields(logHeaderVisitor, true);		SerialOutput.println();		return;	} else if (strcmp_P(newMessage, LOG_VALUE) == 0)	{		logValue();		return;//#ifdef I_USE_RESET//	} else if (strcmp_P(newMessage, RESET) == 0)//	{//		ForceHardReset();//#endif	} else	{		dumpCommands();		if ('?' != newMessage[0])		{			SerialOutput.print((__FlashStringHelper *) ERROR);			//Even though it is handy to see what has been send			//The yun bootloader sends press ard to stop bootloader			//echoing this means the bootloader receives ard			//SerialOutput.println(newMessage);		}		return;	}	SerialOutput.println((__FlashStringHelper *) DONE);}
开发者ID:tbarchyn,项目名称:ArduinoLibraries,代码行数:58,


示例6: Clear

bool CommandParser::ParseCommand(const String& command, Command& outCommand){  Clear(); // clear first  if(command.length() < MIN_COMMAND_LENGTH)    return false;  const char* readPtr = command.c_str();    bool rightPrefix = !strncmp_P(readPtr,(const char*)CMD_PREFIX,CMD_PREFIX_LEN);// || !strncmp_P(readPtr,(const char*)CHILD_PREFIX,CMD_PREFIX_LEN);  if(!rightPrefix)    return false;  // перемещаемся за префикс (CT или CD)  readPtr += CMD_PREFIX_LEN;  // проверяем, GET или SET должно быть передано  bool isGet = !strncmp_P(readPtr,(const char*)CMD_GET,CMD_TYPE_LEN);  bool rightType =  isGet || !strncmp_P(readPtr,(const char*)CMD_SET,CMD_TYPE_LEN);  if(!rightType)    return false;  uint8_t commandType = isGet ? ctGET : ctSET;  // перемещаемся за тип команды и знак '='  readPtr += CMD_TYPE_LEN + 1;  // ищем, есть ли разделитель в строке. Если он есть, значит, передали ещё и параметры помимо просто имени модуля  const char* delimPtr = strchr(readPtr,'|');  if(!delimPtr)  {    // без параметров, тупо конструируем и выходим     outCommand.Construct(readPtr,NULL,commandType);     return true;  }  // есть параметры, надо выцепить имя модуля  size_t len = (delimPtr - readPtr);    char* moduleName = new char[len+1];  memset(moduleName,0,len+1);  strncpy(moduleName,readPtr,len);    delimPtr++;  outCommand.Construct(moduleName,delimPtr,commandType);  delete[] moduleName;  return true;   }
开发者ID:Porokhnya,项目名称:GreenhouseProject,代码行数:54,


示例7: parse_cmd_lcd_shift

int16_t parse_cmd_lcd_shift(char *cmd, char *output, uint16_t len){  if (strlen(cmd) < 1)     return ECMD_ERR_PARSE_ERROR;  if (!strncmp_P(cmd + 1, PSTR("right"), 5))    hd44780_shift(1);  else if (!strncmp_P(cmd + 1, PSTR("left"), 4))     hd44780_shift(0);  else    return ECMD_ERR_PARSE_ERROR;  return ECMD_FINAL_OK;}
开发者ID:chuckb,项目名称:ethersex,代码行数:14,


示例8: shell_network

static void shell_network(char *str){char *pos = str + sizeof("network");uint8_t is_error = 0;char dstr[DSTR_BUF];	if (strncmp_P(pos, PSTR("set "), 4) == 0)	{        pos += 4;		if (strncmp_P(pos, PSTR("ip "), 3) == 0)		{        	pos += 3;			is_error = net_conf_set_ip_string(pos);		}		else if (strncmp_P(pos, PSTR("gw "), 3) == 0)		{        	pos += 3;			is_error = net_conf_set_gw_string(pos);		}		else if (strncmp_P(pos, PSTR("nm "), 3) == 0)		{        	pos += 3;			is_error = net_conf_set_nm_string(pos);		}		else if (strncmp_P(pos, PSTR("dhcp "), 5) == 0)		{        	pos += 5;			is_error = net_conf_set_dhcpc_string(pos);		}		else		{			shell_output("unknown set operation: ", pos);		}	}	else if (strncmp_P(pos, PSTR("show"), 4) == 0)	{        pos += 5;		net_conf_get_mac_string(dstr, DSTR_BUF);		shell_output("MAC: ", dstr);		net_conf_get_ip_string(dstr, DSTR_BUF);		shell_output("IP: ", dstr);		net_conf_get_nm_string(dstr, DSTR_BUF);		shell_output("NM: ", dstr);		net_conf_get_gw_string(dstr, DSTR_BUF);		shell_output("GW: ", dstr);	}	else if (strncmp_P(pos, PSTR("load"), 4) == 0)	{		net_conf_load();	}	else if (strncmp_P(pos, PSTR("save"), 4) == 0)	{		net_conf_save();	}	else	{		shell_output_P(PSTR("options: show, set, load, save"),PSTR(""));	}}
开发者ID:satrian,项目名称:sdr-mk15,代码行数:60,


示例9: PT_THREAD

/*---------------------------------------------------------------------------*/staticPT_THREAD(handle_output(struct httpd_state *s)){  PT_BEGIN(&s->outputpt);   char *ptr;  if(!httpd_fs_open(s->filename, &s->file)) {    httpd_fs_open(http_404_html, &s->file);    strcpy_P(s->filename, http_404_html);    PT_WAIT_THREAD(&s->outputpt, send_headers(s, http_header_404));    PT_WAIT_THREAD(&s->outputpt, send_file(s));  } else {    snprintf(s->tmp_str, sizeof(s->tmp_str) -1, "%d", s->file.len);    //snprintf(s->str_tmp, 8, "%d", s->len);    PT_WAIT_THREAD(&s->outputpt, send_headers(s, http_header_200));    ptr = strchr(s->filename, ISO_period);    if(ptr != NULL && strncmp_P(ptr, http_shtml, 6) == 0) {      PT_INIT(&s->scriptpt);      PT_WAIT_THREAD(&s->outputpt, handle_script(s));    } else {      PT_WAIT_THREAD(&s->outputpt, send_file(s));    }  }  PSOCK_CLOSE(&s->sout);  PT_END(&s->outputpt);}
开发者ID:jaseg,项目名称:avr-uip,代码行数:29,


示例10: while

int Jukebox2::fileCount(FatReader &dir){  //Serial.print("WTF!");  int count = 0;  FatReader tempFile;  dir_t dirBuf;     // buffer for directory reads  dir.rewind();  while (dir.readDir(dirBuf) > 0) {    // Read every file in the directory one at a time    //Serial.print("QQQ!");      // Skip it if not a subdirectory and not a .WAV file    if (!DIR_IS_SUBDIR(dirBuf)         && strncmp_P((char *)&dirBuf.name[8], PSTR("WAV"), 3)) {      continue;    }    if (!tempFile.open(vol, dirBuf)) {        // open the file in the directory      Serial.print("file.open failed");          // something went wrong    }    if (tempFile.isDir()) {                   // check if we opened a new directory    }    else{      count++;    }  }  dir.rewind();  Serial.print("Count was:");  Serial.println(count);  return count;}
开发者ID:BorisFR,项目名称:rseries-open-control,代码行数:31,


示例11: processLine

/* * Processes a line of data in an HTTP request.  This function looks * for GET and saves a copy of the URL in the current connection's * server request.  It also sets the request's isValid flag if the * URL has been saved and an empty line is found. */boolean processLine(char* data, int len) {	// Check for a valid GET line	if ((uip_conn->appstate.request == NULL) && (strncmp_P(data, httpGET, 4) == 0)) {		// URL starts at the '/'		char* start = data + 4;		// Find trailing space after the URL		data = start;		char* end = data + len;		while (++data < end) {			if (' ' == *data) {				// Replace the space with a NULL to terminate it				*(data++) = '/0';							// copy the URL to the static storage				uip_conn->appstate.request = get_string_global;				strncpy(get_string_global, start, WISERVER_GET_STRING_MAX - 1);				// The following set is implicit. get_string_global is allocated in 				// the BSS so it starts with a NULL last char and it stays there				// as long as we never overwrite it				// get_string_global[WISERVER_GET_STRING_MAX - 1] = '/0';				return false;			}		}		// No space, not valid	}	return (len == 0);}
开发者ID:samcleaver,项目名称:WiShield_user_contrib,代码行数:36,


示例12: while

bool SikwiWifi::wait_for_esp_response(const unsigned long timeout, const char* term){  unsigned long t=millis();  bool found=false;  char len=strlen_P(term);  uint8_t i=0;  while(millis()<t+timeout) {    if(this->espSerial->available()){      char myChar = (char)this->espSerial->read();      this->buffer[i++]=myChar;      if(i>=len) {        if(strncmp_P(this->buffer+i-len, term, len)==0) {          found=true;          break;        }      }    }  }  this->buffer[i]=0;  #if defined(DEBUG_WIFI)    this->debugPrinter->println(this->buffer);  #endif  return found;}
开发者ID:sikwi,项目名称:firmware,代码行数:25,


示例13: strlen_P

bool SerialConsole::handleCommand(const char *buffer, const uint8_t len){    if (buffer[0] == 0)        return false;    for (uint8_t i = 0; i != MAX_COMMANDS; ++i)    {        if (commands[i].hasParam)        {            const uint8_t cmd_len = strlen_P(commands[i].command);            if (strncmp_P(buffer, commands[i].command, cmd_len) == 0)            {                (this->*commands[i].handler) (buffer, len);                return true;            }        } else if (strcmp_P(buffer, commands[i].command) == 0) {            (this->*commands[i].handler) (buffer, len);            return true;        }    }    uart << PGM << STR_HELP_UNKNOWN;    uart << " (" << buffer << ")" << CR;    return false;}
开发者ID:karlpilkington,项目名称:NoSpark,代码行数:27,


示例14: sizeof

/* * Read all of the config parameters from the EEPROM * * There are some sanity checks. If they fail then * it will call reset() instead. */void ConfigParms::read(){  const size_t crc_size = sizeof(uint16_t);  const size_t magic_len = sizeof(magic);  size_t size = magic_len + sizeof(*this) + crc_size;  uint8_t buffer[size];  // Read the whole block from EEPROM in memory  eeprom_read_block((void *)buffer, eepromAddr(), size);  // Verify the checksum  uint16_t crc = *(uint16_t *)(buffer + size - crc_size);  uint16_t crc1 = crc16_ccitt(buffer, size - crc_size);  if (strncmp_P((const char *)buffer, magic, magic_len) != 0) {    //DIAGPRINTLN(F("ConfigParms::read - magic wrong"));    goto do_reset;  }  if (crc != crc1) {    goto do_reset;  }  // Initialize the ConfigParms instance with the info from EEPROM  memcpy((uint8_t *)this, buffer + magic_len, sizeof(*this));  return;do_reset:  reset();}
开发者ID:SodaqMoja,项目名称:GPRSbee,代码行数:35,


示例15: while

void SimGSM::handleCallback() {	// Handle overflow request first	size_t pos = 0;	int i = _overflow_slot;	if (_overflow_size > 0 && _cb[i].func)		pos += _cb[i].func(_buf, _buf_size, _cb[i].data);	// Handle the rest if we still have available space	while (pos < _buf_size) {		size_t used = 0;		for (i = 0; i < GSM_MAX_CALLBACK; i++) {			if (_cb[i].func && !strncmp_P((char *)_buf + pos, _cb[i].match, _cb[i].length)) {				used = _cb[i].func(_buf + pos, _buf_size - pos, _cb[i].data);				if (used)					break;			}		}		pos += used ? used : 1;	}	// Callback can request overflow by returning used space	// beyond _buf space	if (pos > _buf_size) {		_overflow_size = pos - _buf_size;		_overflow_slot = i;	} else {		_overflow_size = 0;	}}
开发者ID:tegila,项目名称:SimGSM,代码行数:29,


示例16: PGM_UINT8

// Find a variable by name.//AP_Param *AP_Param::find(const char *name, enum ap_var_type *ptype){    for (uint8_t i=0; i<_num_vars; i++) {        uint8_t type = PGM_UINT8(&_var_info[i].type);        if (type == AP_PARAM_GROUP) {            uint8_t len = strnlen_P(_var_info[i].name, AP_MAX_NAME_SIZE);            if (strncmp_P(name, _var_info[i].name, len) != 0) {                continue;            }            const struct GroupInfo *group_info = (const struct GroupInfo *)PGM_POINTER(&_var_info[i].group_info);            AP_Param *ap = find_group(name + len, i, group_info, ptype);            if (ap != NULL) {                return ap;            }            // we continue looking as we want to allow top level            // parameter to have the same prefix name as group            // parameters, for example CAM_P_G        } else if (strcasecmp_P(name, _var_info[i].name) == 0) {            *ptype = (enum ap_var_type)type;            return (AP_Param *)PGM_POINTER(&_var_info[i].ptr);        }    }    return NULL;}
开发者ID:CptMacHammer,项目名称:au_uav_pkg,代码行数:27,


示例17: cli_completion

uint8_t cli_completion(char* buffer, uint16_t maxcmdlength, PGM_VOID_P cmdlist) {    uint8_t i=0;    char ref[maxcmdlength+1];    char* itemstr;    ref[0]='/0';    /* check if we are behind the first word */    while(buffer[i]) {        if(!isgraph(buffer[i++]))            return 0;    }    for(;;) {        itemstr = (char*)pgm_read_word(cmdlist);        if(itemstr==NULL)            break;        cmdlist = (uint8_t*)cmdlist +CMDLIST_ENTRY_SIZE;        if(!strncmp_P(buffer, itemstr, i)) {            if(!ref[0]) {                strcpy_P(ref, itemstr);            } else {                ref[stridentcnt_P(ref, itemstr)]='/0';            }        }    }    i = strcmp(buffer, ref);    if(i)        strcpy(buffer, ref);    return ~i;}
开发者ID:firebitsbr,项目名称:chipwhisperer,代码行数:28,


示例18: handle_command

void handle_command() {  serial_in[serial_in_ctr] = '/0';  p = serial_out;  if (!strncmp_P((char*)serial_in, PSTR("TIME"), 4)) {    handle_time();  } else if (!strncmp_P((char*)serial_in, PSTR("ACCELVERB"), 9)) {    handle_accelverb();  } else if (!strncmp_P((char*)serial_in, PSTR("ACCEL"), 5)) {    handle_accel();    p += strlcpy_P(p, off, 64);  } else if (!strncmp_P((char*)serial_in, PSTR("SCAN"), 4)) {    flash_scan();    p += strlcpy_P(p, cmdresult, 64);    p += sprintf(p, " %03d %03d", flash_addr >> 8, flash_addr & 0xFF);  } else if (!strncmp_P((char*)serial_in, PSTR("ADDR"), 4)) {
开发者ID:Nazrax,项目名称:Dream-Vibrator-M2,代码行数:16,


示例19: shell_udpds

static void shell_udpds(char *str){	char *pos = str + sizeof("udpds");	if (strncmp_P(pos, PSTR("set "), 4) == 0)	{	}	else if (strncmp_P(pos, PSTR("show"), 4) == 0)	{	}	else if (strncmp_P(pos, PSTR("enable"), 6) == 0)	{	}	else if (strncmp_P(pos, PSTR("disable"), 7) == 0)	{	}}
开发者ID:satrian,项目名称:sdr-mk15,代码行数:17,


示例20: cmd_engine_led_command

bool cmd_engine_led_command(const char *command, bool *startCmd){  if (!strncmp_P(command, PSTR("led "), 4)) {    cmd_engine_set_led(command + 4);    return true;  }  return false;}
开发者ID:w5292c,项目名称:mcode,代码行数:9,


示例21: artnet_get

/* ---------------------------------------------------------------------------- * receive Art-Net packet */voidartnet_get(void){  struct artnet_header *header;  header = (struct artnet_header *) uip_appdata;  /* check the id */  if (strncmp_P((char *) header->id, artnet_ID, 8))  {    ARTNET_DEBUG("Wrong ArtNet header, discarded/r/n");    artnet_status = RC_PARSE_FAIL;    return;  }  switch (header->opcode)  {    case OP_POLL:;      struct artnet_poll *poll;      ARTNET_DEBUG("Received artnet poll packet!/r/n");      poll = (struct artnet_poll *) uip_appdata;      processPollPacket(poll);      break;    case OP_POLLREPLY:;      ARTNET_DEBUG("Received artnet poll reply packet!/r/n");      break;    case OP_OUTPUT:;      uip_ipaddr_t artnet_pollReplyTarget;      struct artnet_dmx *dmx;      ARTNET_DEBUG("Received artnet output packet!/r/n");      dmx = (struct artnet_dmx *) uip_appdata;      uip_ipaddr_copy(&artnet_pollReplyTarget, BUF->srcipaddr);      if (dmx->universe == ((artnet_subNet << 4) | artnet_outputUniverse))      {        if (artnet_dmxDirection == 0)        {          uint16_t len = ((dmx->lengthHi << 8) + dmx->length);          set_dmx_channels((const uint8_t *) &dmx->dataStart,                           artnet_outputUniverse, 0, len);          if (artnet_sendPollReplyOnChange == TRUE)          {            artnet_pollReplyCounter++;            artnet_sendPollReply(&artnet_pollReplyTarget);          }        }      }      break;    case OP_ADDRESS:;    case OP_IPPROG:;      break;    default:      ARTNET_DEBUG("Received an invalid artnet packet!/r/n");      break;  }}
开发者ID:AnDann,项目名称:ethersex,代码行数:60,


示例22: if

const char PROGMEM *settingsLineSetNotifyCond(char *buf, uint16_t len, uint8_t index) {    if (index > 3) {        return TOO_MANY_NOTIFY;    }    if (currentSetLineIdx >= lineInputSize){        return NO_NOTIFY_OUTPUT;    }    uint8_t notif;    if (!strncmp_P(buf, LINE_NOTIFICATION_SUP, len)) {        notif = OVER_EQ;    } else if (!strncmp_P(buf, LINE_NOTIFICATION_INF, len)) {        notif = UNDER_EQ;    } else {        return PSTR("invalid notify condition");    }    eeprom_write_byte((uint8_t *) &lineInputSettings[currentSetLineIdx].notifies[index].condition, notif);    return 0;}
开发者ID:housecream,项目名称:restmcu,代码行数:19,


示例23: find_message_index

static int8_t find_message_index(char* code) {  int8_t index = 0;  for (; index < NUM_FW_COMMAND; index++) {    const struct fw_command_struct* fw_command = &fw_command_table[index];    if (strncmp_P(code, fw_command->code, 3) == 0) {      return index;    }  }  return -1;}
开发者ID:mjbots,项目名称:mjmech,代码行数:10,


示例24: strcpy

/** *	Find needle on haystack * *	@param const __FlashStringHelper *needle *	@param char *haystack *	@param __FlashStringHelper *separator *	@return *char value **/const char *uHTTP::parse(const __FlashStringHelper *needle, char *haystack, const __FlashStringHelper *sep){	char *act, *sub, *ptr;	char buffer[uHTTP_BUFFER_SIZE];	strcpy(buffer, haystack);	for(act = buffer; strncmp_P(sub, (const PROGMEM char *) needle, strlen_P((const PROGMEM char *) needle)); act = NULL){		sub = strtok_rP(act, (const PROGMEM char *) sep, &ptr);		if(sub == NULL) break;	}	return (sub) ? strchr(sub, '=') + 1 : NULL;}
开发者ID:NitrofMtl,项目名称:uHTTP-1,代码行数:18,


示例25: cmd_parse

/* * Parses the string data points to, checks if it is any of the * defined commands, and calls the apropriate function. */bool_t cmd_parse(const uint8_t* data, uint8_t size){  uint8_t i;  for(i=0; i < CMD_NUM; i++)  {    uint8_t cmd_len = pgm_read_byte(&cmds[i].cmd_len);    uint8_t arg_len = pgm_read_byte(&cmds[i].arg_len);    /*     * Makes str point to the position in the string where the     * command should be if it is valid     */    const uint8_t* str = data + size - cmd_len - arg_len - CONFIG_GRP_LEN;    #if 1    /* can data even contain the command (and argument)?  */    if(str < data);    {      /* check if it is broadcast or out group number and if it is a valid command */      if((strncmp((const char*)str, "00", CONFIG_GRP_LEN) == 0 ||           strncmp((const char*)str, (const char*)config.group, CONFIG_GRP_LEN) == 0))      {         if(strncmp_P((const char*)str + CONFIG_GRP_LEN, (PGM_P)pgm_read_word(&cmds[i].string), cmd_len) == 0)#endif#if 0    /* can data even contain the command (and argument)?  */    if((str < data)       /* and check that it starts with either witd broadcast id or       * our group number */       && (strncmp((const char*)str, "00", CONFIG_GRP_LEN) == 0 ||            strncmp((const char*)str, (const char*)config.group, CONFIG_GRP_LEN) == 0)       /* and is the command after if it is, check if it is the correct command */       && strncmp_P((const char*)str + CONFIG_GRP_LEN, (PGM_P)pgm_read_word(&cmds[i].string), cmd_len) == 0)#endif    {      /* Call the function with the pointer associated with the command */      ((cmd_callback_t*)pgm_read_word(&cmds[i].f))(data+size-arg_len);      return TRUE;    }    }    }  }  return FALSE;}
开发者ID:olcai,项目名称:sommar,代码行数:47,


示例26: jabber_extract_from

static uint8_tjabber_extract_from(void){  const char *from = strstr_P(uip_appdata, PSTR("from="));  if (!from)    return 1;  from += 6;                    /* skip from=' */  const char *resource_end = strchr(from, '/');  if (!resource_end)  {    JABDEBUG("from addr resource not found/n");    return 1;  }  const char *endptr = strchr(from, '/'');  if (!endptr)    endptr = strchr(from, '/"');  if (!endptr)  {    JABDEBUG("end of from addr not found/n");    return 1;  }  uint8_t jid_len = resource_end - from;  uint8_t len = endptr - from;  if (len + 1 > TARGET_BUDDY_MAXLEN)  {    JABDEBUG("extract_from: from addr too long/n");    return 1;  }  uint8_t auth = 1;  for (uint8_t i = 0;       i < (sizeof(jabber_known_buddies) / sizeof(jabber_known_buddies[0]));       ++i)  {    char *jidlist_ptr = (char *) pgm_read_word(&jabber_known_buddies[i]);    auth = strncmp_P(from, jidlist_ptr, jid_len) == 0;    if (auth == 1)      break;  }  JABDEBUG("authentificated %s: %d/n", from, auth);  if (!auth)    return 2;                   /* Permission denied. */  memmove(STATE->target, from, len);  STATE->target[len] = 0;  JABDEBUG("message from: %s/n", STATE->target);  return 0;                     /* Looks good. */}
开发者ID:AnDann,项目名称:ethersex,代码行数:54,


示例27: parse_command

void parse_command(char* buffer, uint16_t *pos, uint8_t *color) {	if (!strncmp_P(buffer, PSTR("//1"), 2)) {		(*pos) += 2;		(*color) = 0;	} else if (!strncmp_P(buffer, PSTR("//2"), 2)) {		(*pos) += 2;		(*color) = 1;	} else if (!strncmp_P(buffer, PSTR("//3"), 2)) {		(*pos) += 2;		(*color) = 2;	} else if (!strncmp_P(buffer, PSTR("//-"), 2)) {		if ((buffer[2] >= '0') && (buffer[2] <= '9')) {			brightness = 16+(buffer[2] - '0')*10;		}		(*pos) += 3;	} else {		(*pos) += 1;	}}
开发者ID:TomTomaso,项目名称:LEDMatrix,代码行数:20,


示例28: process

void SikwiWifiWebsocket::process(){  char *pb;  if(this->wifi->newLine){    if(strncmp_P(this->wifi->buffer, PSTR("WS:"), 3)==0){      uint8_t responseType;      pb = this->wifi->buffer+3;      if(tcpHandler)        tcpHandler(pb);    }//if found TCP:  }}
开发者ID:sikwi,项目名称:firmware,代码行数:12,


示例29: parse_cmd_lcd_backlight

int16_t parse_cmd_lcd_backlight(char *cmd, char *output, uint16_t len){  if (strlen(cmd) < 1)     return ECMD_ERR_PARSE_ERROR;  if (!strncmp_P(cmd + 1, PSTR("on"), 2))#ifdef HD44780_BACKLIGHT_INV    hd44780_backlight(0);#else    hd44780_backlight(1);#endif  else if (!strncmp_P(cmd + 1, PSTR("off"), 3)) 
开发者ID:chuckb,项目名称:ethersex,代码行数:12,


示例30: if

void LLAPSerial::processMessage(){	//if (LLAP.cMessage[0] != 'a') return; //not needed as already checked	if( checkId ) {	  if (cMessage[1] != deviceId[0]) return;	  if (cMessage[2] != deviceId[1]) return;	}	// now we have LLAP.cMessage[3] to LLAP.cMessage[11] as the actual message	if (0 == strncmp_P(&cMessage[3],PSTR("HELLO----"),9)) {		_Serial->print(cMessage);	// echo the message	} else if (0 == strncmp_P(&cMessage[3],PSTR("CHDEVID"),7)) {	  if (strchr_P(PSTR("-#@?//*ABCDEFGHIJKLMNOPQRSTUVWXYZ"), cMessage[10]) != 0 && strchr_P(PSTR("-#@?//*ABCDEFGHIJKLMNOPQRSTUVWXYZ"), cMessage[11]) != 0)	  {		deviceId[0] = cMessage[10];		deviceId[1] = cMessage[11];		_Serial->print(cMessage);	// echo the message	  }	} else {		sMessage = String(&cMessage[3]); // let the main program deal with it		bMsgReceived = true;	}}
开发者ID:thiseldo,项目名称:LLAPSerial,代码行数:21,



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


C++ strncmpi函数代码示例
C++ strncmp函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。