Serial API file. More...
Go to the source code of this file.
Defines | |
#define | _DN_EXP_COM |
Functions | |
_DN_EXP_COM HRESULT | com_clear (int sock, uint32_t timeout) |
Clears the received buffer. | |
_DN_EXP_COM HRESULT | com_close (int *sock) |
Closes the socket. | |
_DN_EXP_COM HRESULT | com_get_modem_state (int sock, uint32_t *state) |
Gets the serial port pin status. | |
_DN_EXP_COM HRESULT | com_get_state (int sock, COM_STATE *state) |
Gets the serial socket parameters. | |
_DN_EXP_COM HRESULT | com_open (void *param, int *sock) |
Opens serial port. | |
_DN_EXP_COM HRESULT | com_recv (int sock, char *buf, uint32_t len_buf, uint32_t *len_recved, uint32_t timeout, void *arg) |
Receives serial packet. | |
_DN_EXP_COM HRESULT | com_send (int sock, const char *buf, uint32_t len_buf, void *arg) |
Sends serial packet. | |
_DN_EXP_COM HRESULT | com_set_state (int sock, COM_STATE *state) |
Puts the serial socket parameters. | |
_DN_EXP_COM HRESULT | com_set_timeout (int sock, uint32_t timeout) |
Sets timeout value to the serial socket. |
Serial API file.
Defines Serial APIs.
Software License Agreement (MIT License)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Definition in file dn_com.h.
#define _DN_EXP_COM |
Clears the received buffer.
[in] | sock | The socket to be cleared. |
[in] | timeout | Timeout value. |
HRESULT com_close | ( | int * | sock | ) |
Closes the socket.
[in,out] | sock | The socket to be closed. |
HRESULT com_get_modem_state | ( | int | sock, |
uint32_t * | state | ||
) |
Gets the serial port pin status.
[in] | sock | The socket to be gotten. |
[in] | state | The gotten serial port pin status. |
HRESULT com_get_state | ( | int | sock, |
COM_STATE * | state | ||
) |
Gets the serial socket parameters.
[in] | sock | The socket to be gotten. |
[out] | state | The gotten parameters. |
HRESULT com_open | ( | void * | param, |
int * | sock | ||
) |
Opens serial port.
[in] | param | The pointer of serial connection parameters: CONN_PARAM_COM. |
[out] | sock | The created socket. |
HRESULT com_recv | ( | int | sock, |
char * | buf, | ||
uint32_t | len_buf, | ||
uint32_t * | len_recved, | ||
uint32_t | timeout, | ||
void * | arg | ||
) |
Receives serial packet.
[in] | sock | The socket to receive. |
[out] | buf | The buffer to be received. |
[in] | len_buf | The allocated size of received buffer. |
[out] | len_recved | The size of received buffer. |
[in] | arg | Special parameter. Do not use. |
Sends serial packet.
[in] | sock | The socket to send. |
[in] | buf | The buffer to be sent. |
[in] | len_buf | The size of sent buffer. |
[in] | arg | Special parameter. Do not use. |
HRESULT com_set_state | ( | int | sock, |
COM_STATE * | state | ||
) |
Puts the serial socket parameters.
[in] | sock | The socket to be set. |
[in] | state | The setting parameters. |
HRESULT com_set_timeout | ( | int | sock, |
uint32_t | timeout | ||
) |
Sets timeout value to the serial socket.
[in] | sock | The socket to be set. |
[in] | timeout | Timeout value. |