本文整理汇总了C++中ESP_LOGD函数的典型用法代码示例。如果您正苦于以下问题:C++ ESP_LOGD函数的具体用法?C++ ESP_LOGD怎么用?C++ ESP_LOGD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ESP_LOGD函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: http_on_headers_complete
static int http_on_headers_complete(http_parser *parser)
{
esp_http_client_handle_t client = parser->data;
client->response->status_code = parser->status_code;
client->response->data_offset = parser->nread;
client->response->content_length = parser->content_length;
client->response->data_process = 0;
ESP_LOGD(TAG, "http_on_headers_complete, status=%d, offset=%d, nread=%d", parser->status_code, client->response->data_offset, parser->nread);
client->state = HTTP_STATE_RES_COMPLETE_HEADER;
return 0;
}
示例2: ESP_LOGD
/**
* @brief Begin a new %I2C transaction.
*
* Begin a transaction by adding an %I2C start to the queue.
* @return N/A.
*/
void I2C::beginTransaction() {
if (debug) {
ESP_LOGD(LOG_TAG, "beginTransaction()");
}
m_cmd = ::i2c_cmd_link_create();
esp_err_t errRc = ::i2c_master_start(m_cmd);
if (errRc != ESP_OK) {
ESP_LOGE(LOG_TAG, "i2c_master_start: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
}
m_directionKnown = false;
} // beginTransaction
示例3: ESP_LOGD
/**
* @brief Create a %BLE Service.
*
* With a %BLE server, we can host one or more services. Invoking this function causes the creation of a definition
* of a new service. Every service must have a unique UUID.
* @param [in] uuid The UUID of the new service.
* @param [in] numHandles The maximum number of handles associated with this service.
* @param [in] inst_id With multiple services with the same UUID we need to provide inst_id value different for each service.
* @return A reference to the new service object.
*/
BLEService* BLEServer::createService(BLEUUID uuid, uint32_t numHandles, uint8_t inst_id) {
ESP_LOGD(LOG_TAG, ">> createService - %s", uuid.toString().c_str());
m_semaphoreCreateEvt.take("createService");
// Check that a service with the supplied UUID does not already exist.
if (m_serviceMap.getByUUID(uuid) != nullptr) {
ESP_LOGW(LOG_TAG, "<< Attempt to create a new service with uuid %s but a service with that UUID already exists.",
uuid.toString().c_str());
}
BLEService* pService = new BLEService(uuid, numHandles);
pService->m_instId = inst_id;
m_serviceMap.setByUUID(uuid, pService); // Save a reference to this service being on this server.
pService->executeCreate(this); // Perform the API calls to actually create the service.
m_semaphoreCreateEvt.wait("createService");
ESP_LOGD(LOG_TAG, "<< createService");
return pService;
} // createService
示例4: ESP_LOGD
/**
* @brief Publish a message.
* Publish a message on the given topic.
*
* @param [in] topic The topic against which we wish to publish.
* @param [in] payload The payload of the message we wish to publish.
* @param [in] qos The quality of service for the publish.
* @return N/A.
*/
void AWS::publish(std::string topic, std::string payload, QoS qos) {
IoT_Publish_Message_Params message;
message.payload = (void *)payload.data();
message.payloadLen = payload.length();
message.qos = qos;
message.isRetained = 0;
IoT_Error_t err = ::aws_iot_mqtt_publish(&m_client, topic.c_str(), topic.length(), &message);
if (err != SUCCESS) {
ESP_LOGD(tag, "aws_iot_mqtt_publish: error=%d", err);
}
} // publish
示例5: run
void run(void *data) {
ESP_LOGD(tag, "Testing curl ...");
RESTClient client;
/**
* Test POST
*/
RESTTimings *timings = client.getTimings();
client.setURL("https://httpbin.org/post");
client.addHeader("Content-Type", "application/json");
client.post("hello world!");
ESP_LOGD(tag, "Result: %s", client.getResponse().c_str());
timings->refresh();
ESP_LOGD(tag, "timings: %s", timings->toString().c_str());
printf("Tests done\n");
return;
}
示例6: get_wlan
STATIC mp_obj_t get_wlan(size_t n_args, const mp_obj_t *args) {
static int initialized = 0;
if (!initialized) {
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_LOGD("modnetwork", "Initializing WiFi");
ESP_EXCEPTIONS( esp_wifi_init(&cfg) );
ESP_EXCEPTIONS( esp_wifi_set_storage(WIFI_STORAGE_RAM) );
ESP_LOGD("modnetwork", "Initialized");
initialized = 1;
}
int idx = (n_args > 0) ? mp_obj_get_int(args[0]) : WIFI_IF_STA;
if (idx == WIFI_IF_STA) {
return MP_OBJ_FROM_PTR(&wlan_sta_obj);
} else if (idx == WIFI_IF_AP) {
return MP_OBJ_FROM_PTR(&wlan_ap_obj);
} else {
mp_raise_ValueError("invalid WLAN interface identifier");
}
}
示例7: while
/**
* @brief Accept an incoming connection.
* @private
*
* Block waiting for an incoming connection and accept it when it arrives. The new
* socket is placed on a queue and a semaphore signaled that a new client is available.
*/
/* static */ void SockServ::acceptTask(void* data) {
SockServ* pSockServ = (SockServ*)data;
try {
while(1) {
ESP_LOGD(LOG_TAG, "Waiting on accept")
Socket tempSock = pSockServ->m_serverSocket.accept();
if (!tempSock.isValid()) {
continue;
}
pSockServ->m_clientSet.insert(tempSock);
xQueueSendToBack(pSockServ->m_acceptQueue, &tempSock, portMAX_DELAY);
pSockServ->m_clientSemaphore.give();
}
} catch(std::exception e) {
ESP_LOGD(LOG_TAG, "acceptTask ending");
pSockServ->m_clientSemaphore.give(); // Wake up any waiting clients.
FreeRTOS::deleteTask();
}
} // acceptTask
示例8: ESP_LOGD
/**
* @brief Create the service.
* Create the service.
* @param [in] gatts_if The handle of the GATT server interface.
* @return N/A.
*/
void BLEService::executeCreate(BLEServer *pServer) {
ESP_LOGD(LOG_TAG, ">> executeCreate() - Creating service (esp_ble_gatts_create_service) service uuid: %s", getUUID().toString().c_str());
m_pServer = pServer;
esp_gatt_srvc_id_t srvc_id;
srvc_id.id.inst_id = 0;
srvc_id.id.uuid = *m_uuid.getNative();
m_semaphoreCreateEvt.take("executeCreate"); // Take the mutex and release at event ESP_GATTS_CREATE_EVT
esp_err_t errRc = ::esp_ble_gatts_create_service(getServer()->getGattsIf(), &srvc_id, 10);
if (errRc != ESP_OK) {
ESP_LOGE(LOG_TAG, "esp_ble_gatts_create_service: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
return;
}
m_semaphoreCreateEvt.wait("executeCreate");
ESP_LOGD(LOG_TAG, "<< executeCreate");
} // executeCreate
示例9: check_working_socket
int check_working_socket()
{
int ret;
#if EXAMPLE_ESP_TCP_MODE_SERVER
ESP_LOGD(TAG, "check server_socket");
ret = get_socket_error_code(server_socket);
if(ret != 0) {
ESP_LOGW(TAG, "server socket error %d %s", ret, strerror(ret));
}
if(ret == ECONNRESET)
return ret;
#endif
ESP_LOGD(TAG, "check connect_socket");
ret = get_socket_error_code(connect_socket);
if(ret != 0) {
ESP_LOGW(TAG, "connect socket error %d %s", ret, strerror(ret));
}
if(ret != 0)
return ret;
return 0;
}
示例10: bootloader_common_erase_part_type_data
bool bootloader_common_erase_part_type_data(const char *list_erase, bool ota_data_erase)
{
const esp_partition_info_t *partitions;
const char *marker;
esp_err_t err;
int num_partitions;
bool ret = true;
partitions = bootloader_mmap(ESP_PARTITION_TABLE_OFFSET, ESP_PARTITION_TABLE_MAX_LEN);
if (!partitions) {
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", ESP_PARTITION_TABLE_OFFSET, ESP_PARTITION_TABLE_MAX_LEN);
return false;
}
ESP_LOGD(TAG, "mapped partition table 0x%x at 0x%x", ESP_PARTITION_TABLE_OFFSET, (intptr_t)partitions);
err = esp_partition_table_verify(partitions, true, &num_partitions);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Failed to verify partition table");
ret = false;
} else {
ESP_LOGI(TAG, "## Label Usage Offset Length Cleaned");
for (int i = 0; i < num_partitions; i++) {
const esp_partition_info_t *partition = &partitions[i];
char label[sizeof(partition->label) + 1] = {0};
if (partition->type == PART_TYPE_DATA) {
bool fl_ota_data_erase = false;
if (ota_data_erase == true && partition->subtype == PART_SUBTYPE_DATA_OTA) {
fl_ota_data_erase = true;
}
// partition->label is not null-terminated string.
strncpy(label, (char *)&partition->label, sizeof(label) - 1);
if (fl_ota_data_erase == true || (bootloader_common_label_search(list_erase, label) == true)) {
err = bootloader_flash_erase_range(partition->pos.offset, partition->pos.size);
if (err != ESP_OK) {
ret = false;
marker = "err";
} else {
marker = "yes";
}
} else {
marker = "no";
}
ESP_LOGI(TAG, "%2d %-16s data %08x %08x [%s]", i, partition->label,
partition->pos.offset, partition->pos.size, marker);
}
}
}
bootloader_munmap(partitions);
return ret;
}
示例11: ESP_LOGD
/**
* @brief Get the service object corresponding to the uuid.
* @param [in] uuid The UUID of the service being sought.
* @return A reference to the Service or nullptr if don't know about it.
* @throws BLEUuidNotFound
*/
BLERemoteService* BLEClient::getService(BLEUUID uuid) {
ESP_LOGD(LOG_TAG, ">> getService: uuid: %s", uuid.toString().c_str());
// Design
// ------
// We wish to retrieve the service given its UUID. It is possible that we have not yet asked the
// device what services it has in which case we have nothing to match against. If we have not
// asked the device about its services, then we do that now. Once we get the results we can then
// examine the services map to see if it has the service we are looking for.
if (!m_haveServices) {
getServices();
}
std::string uuidStr = uuid.toString();
for (auto &myPair : m_servicesMap) {
if (myPair.first == uuidStr) {
ESP_LOGD(LOG_TAG, "<< getService: found the service with uuid: %s", uuid.toString().c_str());
return myPair.second;
}
} // End of each of the services.
ESP_LOGD(LOG_TAG, "<< getService: not found");
return nullptr;
} // getService
示例12: stream
/**
* @brief Return the constituent parts of the path.
* If we imagine a path as composed of parts separated by slashes, then this function
* returns a vector composed of the parts. For example:
*
* ```
* /x/y/z
* ```
* will break out to:
*
* ```
* path[0] = ""
* path[1] = "x"
* path[2] = "y"
* path[3] = "z"
* ```
*
* @return A vector of the constituent parts of the path.
*/
std::vector<std::string> FileSystem::pathSplit(std::string path) {
std::istringstream stream(path);
std::vector<std::string> ret;
std::string pathPart;
while (std::getline(stream, pathPart, '/')) {
ret.push_back(pathPart);
}
// Debug
for (int i = 0; i < ret.size(); i++) {
ESP_LOGD(LOG_TAG, "part[%d]: %s", i, ret[i].c_str());
}
return ret;
} // pathSplit
示例13: stream
/**
* @brief Return the constituent parts of the path.
* If we imagine a path as composed of parts separated by slashes, then this function
* returns a vector composed of the parts. For example:
*
* ```
* /x/y/z
* ```
* will break out to:
*
* ```
* path[0] = ""
* path[1] = "x"
* path[2] = "y"
* path[3] = "z"
* ```
*
* @return A vector of the constituent parts of the path.
*/
std::vector<std::string> WebServer::HTTPRequest::pathSplit() {
std::istringstream stream(getPath());
std::vector<std::string> ret;
std::string pathPart;
while(std::getline(stream, pathPart, '/')) {
ret.push_back(pathPart);
}
// Debug
for (int i=0; i<ret.size(); i++) {
ESP_LOGD(tag, "part[%d]: %s", i, ret[i].c_str());
}
return ret;
} // pathSplit
示例14: stream
/**
* @brief Return the constituent parts of the path.
* If we imagine a path as composed of parts separated by slashes, then this function
* returns a vector composed of the parts. For example:
*
* ```
* /x/y/z
* ```
* will break out to:
*
* ```
* path[0] = ""
* path[1] = "x"
* path[2] = "y"
* path[3] = "z"
* ```
*
* @return A vector of the constituent parts of the path.
*/
std::vector<std::string> WebServer::HTTPRequest::pathSplit() const {
std::istringstream stream(std::string(getPath(), getPathLen())); // I don't know if there's a better istringstream constructor for this
std::vector<std::string> ret;
std::string pathPart;
while (std::getline(stream, pathPart, '/')) {
ret.push_back(pathPart);
}
// Debug
for (int i = 0; i < ret.size(); i++) {
ESP_LOGD(LOG_TAG, "part[%d]: %s", i, ret[i].c_str());
}
return ret;
} // pathSplit
示例15: ESP_LOGD
// A request Line is built from:
// <method> <sp> <request-target> <sp> <HTTP-version>
//
void HttpParser::parseRequestLine(std::string &line) {
ESP_LOGD(LOG_TAG, ">> parseRequestLine: %s [%d]", line.c_str(), line.length());
std::string::iterator it = line.begin();
// Get the method
m_method = toCharToken(it, line, ' ');
// Get the url
m_url = toCharToken(it, line, ' ');
// Get the version
m_version = toCharToken(it, line, ' ');
} // parseRequestLine