arduino-esp32/tools/sdk/include/bluedroid/bta/utl.h
Me No Dev a59eafbc9d
Update IDF to aaf1239 (#1539)
* fix sdmmc config

* Fix warnings in EEPROM

from @Curclamas

* remove leftover TAG in EEPROM

* Initial add of @stickbreaker i2c

* Add log_n

* fix warnings when log is off

* i2c code clean up and reorganization

* add flags to interrupt allocator

* fix sdmmc config

* Fix warnings in EEPROM

from @Curclamas

* remove leftover TAG in EEPROM

* fix errors with latest IDF

* fix debug optimization (#1365)

incorrect optimization for debugging tick markers.

* Fix some missing BT header

* Change BTSerial log calls

* Update BLE lib

* Arduino-ESP32 release management scripted (#1515)

* Calculate an absolute path for a custom partitions table (#1452)

* * Arduino-ESP32 release management scripted
(ready-to-merge)

* * secure env for espressif/arduino-esp32

* * build tests enabled
* gitter webhook enabled

* * gitter room link fixed
* better comment

* * filepaths fixed

* BT Serial adjustments

* * don't run sketch builds & tests for tagged builds

* Return false from WiFi.hostByName() if hostname is not resolved

* Free BT Memory when BT is not used

* WIFI_MODE_NULL is not supported anymore

* Select some key examples to build with PlatformIO to save some time

* Update BLE lib

* Fixed BLE lib

* Major WiFi overhaul

- auto reconnect on connection loss now works
- moved to event groups
- some code clean up and procedure optimizations
- new methods to get a more elaborate system ststus

* Add cmake tests to travis

* Add initial AsyncUDP

* Add NetBIOS lib and fix CMake includes

* Add Initial WebServer

* Fix WebServer and examples

* travis not quiting on build fail

* Try different travis build

* Update IDF to aaf1239

* Fix WPS Example

* fix script permission and add some fail tests to sketch builder

* Add missing space in WiFiClient::write(Stream &stream)
2018-06-27 09:01:06 +02:00

185 lines
6.5 KiB
C

/******************************************************************************
*
* Copyright (C) 2003-2012 Broadcom Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************/
/******************************************************************************
*
* Basic utility functions.
*
******************************************************************************/
#ifndef UTL_H
#define UTL_H
#include "stack/bt_types.h"
// #include "bt_utils.h"
/*****************************************************************************
** Constants
*****************************************************************************/
/*** class of device settings ***/
#define BTA_UTL_SET_COD_MAJOR_MINOR 0x01
#define BTA_UTL_SET_COD_SERVICE_CLASS 0x02 /* only set the bits in the input */
#define BTA_UTL_CLR_COD_SERVICE_CLASS 0x04
#define BTA_UTL_SET_COD_ALL 0x08 /* take service class as the input (may clear some set bits!!) */
#define BTA_UTL_INIT_COD 0x0a
/*****************************************************************************
** Type Definitions
*****************************************************************************/
/** for utl_set_device_class() **/
typedef struct {
UINT8 minor;
UINT8 major;
UINT16 service;
} tBTA_UTL_COD;
#ifdef __cplusplus
extern "C"
{
#endif
/*****************************************************************************
** External Function Declarations
*****************************************************************************/
/*******************************************************************************
**
** Function utl_str2int
**
** Description This utility function converts a character string to an
** integer. Acceptable values in string are 0-9. If invalid
** string or string value too large, -1 is returned.
**
**
** Returns Integer value or -1 on error.
**
*******************************************************************************/
extern INT16 utl_str2int(const char *p_s);
/*******************************************************************************
**
** Function utl_strucmp
**
** Description This utility function compares two strings in uppercase.
** String p_s must be uppercase. String p_t is converted to
** uppercase if lowercase. If p_s ends first, the substring
** match is counted as a match.
**
**
** Returns 0 if strings match, nonzero otherwise.
**
*******************************************************************************/
extern int utl_strucmp(const char *p_s, const char *p_t);
/*******************************************************************************
**
** Function utl_itoa
**
** Description This utility function converts a UINT16 to a string. The
** string is NULL-terminated. The length of the string is
** returned.
**
**
** Returns Length of string.
**
*******************************************************************************/
extern UINT8 utl_itoa(UINT16 i, char *p_s);
/*******************************************************************************
**
** Function utl_freebuf
**
** Description This function calls osi_free to free the buffer passed
** in, if buffer pointer is not NULL, and also initializes
** buffer pointer to NULL.
**
**
** Returns Nothing.
**
*******************************************************************************/
extern void utl_freebuf(void **p);
/*******************************************************************************
**
** Function utl_set_device_class
**
** Description This function updates the local Device Class.
**
** Parameters:
** p_cod - Pointer to the device class to set to
**
** cmd - the fields of the device class to update.
** BTA_UTL_SET_COD_MAJOR_MINOR, - overwrite major, minor class
** BTA_UTL_SET_COD_SERVICE_CLASS - set the bits in the input
** BTA_UTL_CLR_COD_SERVICE_CLASS - clear the bits in the input
** BTA_UTL_SET_COD_ALL - overwrite major, minor, set the bits in service class
** BTA_UTL_INIT_COD - overwrite major, minor, and service class
**
** Returns TRUE if successful, Otherwise FALSE
**
*******************************************************************************/
extern BOOLEAN utl_set_device_class(tBTA_UTL_COD *p_cod, UINT8 cmd);
/*******************************************************************************
**
** Function utl_get_device_class
**
** Description This function get the local Device Class.
**
** Parameters:
** p_cod - Pointer to the device class to get to
**
**
** Returns TRUE if successful, Otherwise FALSE
**
*******************************************************************************/
extern BOOLEAN utl_get_device_class(tBTA_UTL_COD *p_cod);
/*******************************************************************************
**
** Function utl_isintstr
**
** Description This utility function checks if the given string is an
** integer string or not
**
**
** Returns TRUE if successful, Otherwise FALSE
**
*******************************************************************************/
extern BOOLEAN utl_isintstr(const char *p_s);
/*******************************************************************************
**
** Function utl_isdialstr
**
** Description This utility function checks if the given string contains
** only dial digits or not
**
**
** Returns TRUE if successful, Otherwise FALSE
**
*******************************************************************************/
extern BOOLEAN utl_isdialstr(const char *p_s);
#ifdef __cplusplus
}
#endif
#endif /* UTL_H */