Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Bluetooth Mobile Device channel driver. More...
#include "asterisk.h"
#include <pthread.h>
#include <signal.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
#include <bluetooth/rfcomm.h>
#include <bluetooth/sco.h>
#include <bluetooth/l2cap.h>
#include "asterisk/compat.h"
#include "asterisk/lock.h"
#include "asterisk/callerid.h"
#include "asterisk/channel.h"
#include "asterisk/config.h"
#include "asterisk/logger.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/options.h"
#include "asterisk/utils.h"
#include "asterisk/linkedlists.h"
#include "asterisk/cli.h"
#include "asterisk/devicestate.h"
#include "asterisk/causes.h"
#include "asterisk/dsp.h"
#include "asterisk/app.h"
#include "asterisk/manager.h"
#include "asterisk/io.h"
#include "asterisk/smoother.h"
#include "asterisk/format_cache.h"
Go to the source code of this file.
Data Structures | |
struct | adapter_pvt |
struct | adapters |
struct | cidinfo |
struct | devices |
struct | hfp_ag |
This struct holds HFP features the AG supports. More... | |
struct | hfp_cind |
This struct holds mappings for indications. More... | |
struct | hfp_hf |
This struct holds HFP features that we support. More... | |
struct | hfp_pvt |
This struct holds state information about the current hfp connection. More... | |
struct | mbl_pvt |
struct | mbl_pvt::msg_queue |
struct | msg_queue_entry |
Macros | |
#define | CHANNEL_FRAME_SIZE 80 |
#define | DEVICE_FRAME_FORMAT ast_format_slin |
#define | DEVICE_FRAME_SIZE 48 |
#define | FORMAT1 "%-15.15s %-17.17s %-5.5s %-15.15s %-9.9s %-10.10s %-3.3s\n" |
#define | FORMAT1 "%-17.17s %-30.30s %-6.6s %-7.7s %-4.4s\n" |
#define | FORMAT2 "%-17.17s %-30.30s %-6.6s %-7.7s %d\n" |
#define | HFP_AG_CONTROL (1 << 7) |
#define | HFP_AG_CW (1 << 0) |
#define | HFP_AG_ECNR (1 << 1) |
#define | HFP_AG_ERRORS (1 << 8) |
#define | HFP_AG_REJECT (1 << 5) |
#define | HFP_AG_RING (1 << 3) |
#define | HFP_AG_STATUS (1 << 6) |
#define | HFP_AG_TAG (1 << 4) |
#define | HFP_AG_VOICE (1 << 2) |
#define | HFP_CIND_BATTCHG 7 |
#define | HFP_CIND_CALL 2 |
#define | HFP_CIND_CALL_ACTIVE 1 |
#define | HFP_CIND_CALL_NONE 0 |
#define | HFP_CIND_CALLHELD 4 |
#define | HFP_CIND_CALLSETUP 3 |
#define | HFP_CIND_CALLSETUP_ALERTING 3 |
#define | HFP_CIND_CALLSETUP_INCOMING 1 |
#define | HFP_CIND_CALLSETUP_NONE 0 |
#define | HFP_CIND_CALLSETUP_OUTGOING 2 |
#define | HFP_CIND_NONE 0 |
#define | HFP_CIND_ROAM 6 |
#define | HFP_CIND_SERVICE 1 |
#define | HFP_CIND_SERVICE_AVAILABLE 1 |
#define | HFP_CIND_SERVICE_NONE 0 |
#define | HFP_CIND_SIGNAL 5 |
#define | HFP_CIND_UNKNOWN -1 |
#define | HFP_HF_CID (1 << 2) |
#define | HFP_HF_CONTROL (1 << 6) |
#define | HFP_HF_CW (1 << 1) |
#define | HFP_HF_ECNR (1 << 0) |
#define | HFP_HF_STATUS (1 << 5) |
#define | HFP_HF_VOICE (1 << 3) |
#define | HFP_HF_VOLUME (1 << 4) |
#define | MBL_CONFIG "chan_mobile.conf" |
#define | MBL_CONFIG_OLD "mobile.conf" |
#define | rfcomm_read_debug(c) |
Enumerations | |
enum | at_message_t { AT_PARSE_ERROR = -2 , AT_READ_ERROR = -1 , AT_UNKNOWN = 0 , AT_OK , AT_ERROR , AT_RING , AT_BRSF , AT_CIND , AT_CIEV , AT_CLIP , AT_CMTI , AT_CMGR , AT_SMS_PROMPT , AT_CMS_ERROR , AT_A , AT_D , AT_CHUP , AT_CKPD , AT_CMGS , AT_VGM , AT_VGS , AT_VTS , AT_CMGF , AT_CNMI , AT_CMER , AT_CIND_TEST , AT_CUSD , AT_BUSY , AT_NO_DIALTONE , AT_NO_CARRIER , AT_ECAM } |
enum | mbl_type { MBL_TYPE_PHONE , MBL_TYPE_HEADSET } |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static int | at_match_prefix (char *buf, char *prefix) |
Match the given buffer with the given prefix. More... | |
static const char * | at_msg2str (at_message_t msg) |
Get the string representation of the given AT message. More... | |
static at_message_t | at_read_full (int rsock, char *buf, size_t count) |
Read an AT message and classify it. More... | |
static int | check_unloading () |
Check if the module is unloading. More... | |
static void | do_alignment_detection (struct mbl_pvt *pvt, char *buf, int buflen) |
static void * | do_discovery (void *data) |
static void * | do_monitor_headset (void *data) |
static void * | do_monitor_phone (void *data) |
static void * | do_sco_listen (void *data) |
Service new and existing SCO connections. This thread accepts new sco connections and handles audio data. There is one do_sco_listen thread for each adapter. More... | |
static char * | handle_cli_mobile_cusd (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_cli_mobile_rfcomm (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_cli_mobile_search (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_cli_mobile_show_devices (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | handle_response_brsf (struct mbl_pvt *pvt, char *buf) |
Handle the BRSF response. More... | |
static int | handle_response_busy (struct mbl_pvt *pvt) |
Handle BUSY messages. More... | |
static int | handle_response_ciev (struct mbl_pvt *pvt, char *buf) |
Handle AT+CIEV messages. More... | |
static int | handle_response_cind (struct mbl_pvt *pvt, char *buf) |
Handle the CIND response. More... | |
static int | handle_response_clip (struct mbl_pvt *pvt, char *buf) |
Handle AT+CLIP messages. More... | |
static int | handle_response_cmgr (struct mbl_pvt *pvt, char *buf) |
Handle AT+CMGR messages. More... | |
static int | handle_response_cmti (struct mbl_pvt *pvt, char *buf) |
Handle AT+CMTI messages. More... | |
static int | handle_response_cusd (struct mbl_pvt *pvt, char *buf) |
Handle CUSD messages. More... | |
static int | handle_response_error (struct mbl_pvt *pvt, char *buf) |
Handle ERROR AT messages. More... | |
static int | handle_response_no_carrier (struct mbl_pvt *pvt, char *buf) |
Handle NO CARRIER messages. More... | |
static int | handle_response_no_dialtone (struct mbl_pvt *pvt, char *buf) |
Handle NO DIALTONE messages. More... | |
static int | handle_response_ok (struct mbl_pvt *pvt, char *buf) |
Handle OK AT messages. More... | |
static int | handle_response_ring (struct mbl_pvt *pvt, char *buf) |
Handle RING messages. More... | |
static int | handle_sms_prompt (struct mbl_pvt *pvt, char *buf) |
Send an SMS message from the queue. More... | |
static int | headset_send_ring (const void *data) |
static int | hfp_brsf2int (struct hfp_hf *hf) |
Convert a hfp_hf struct to a BRSF int. More... | |
static struct hfp_ag * | hfp_int2brsf (int brsf, struct hfp_ag *ag) |
Convert a BRSF int to an hfp_ag struct. More... | |
static int | hfp_parse_brsf (struct hfp_pvt *hfp, const char *buf) |
Parse BRSF data. More... | |
static int | hfp_parse_ciev (struct hfp_pvt *hfp, char *buf, int *value) |
Parse a CIEV event. More... | |
static int | hfp_parse_cind (struct hfp_pvt *hfp, char *buf) |
Read the result of the AT+CIND? command. More... | |
static int | hfp_parse_cind_indicator (struct hfp_pvt *hfp, int group, char *indicator) |
Parse and store the given indicator. More... | |
static int | hfp_parse_cind_test (struct hfp_pvt *hfp, char *buf) |
Parse the result of the AT+CIND=? command. More... | |
static struct cidinfo | hfp_parse_clip (struct hfp_pvt *hfp, char *buf) |
Parse a CLIP event. More... | |
static int | hfp_parse_cmgr (struct hfp_pvt *hfp, char *buf, char **from_number, char **text) |
Parse a CMGR message. More... | |
static int | hfp_parse_cmti (struct hfp_pvt *hfp, char *buf) |
Parse a CMTI notification. More... | |
static char * | hfp_parse_cusd (struct hfp_pvt *hfp, char *buf) |
Parse a CUSD answer. More... | |
static int | hfp_parse_ecav (struct hfp_pvt *hfp, char *buf) |
Parse a ECAV event. More... | |
static int | hfp_send_ata (struct hfp_pvt *hfp) |
Send ATA. More... | |
static int | hfp_send_atd (struct hfp_pvt *hfp, const char *number) |
Send ATD. More... | |
static int | hfp_send_brsf (struct hfp_pvt *hfp, struct hfp_hf *brsf) |
Send a BRSF request. More... | |
static int | hfp_send_chup (struct hfp_pvt *hfp) |
Send AT+CHUP. More... | |
static int | hfp_send_cind (struct hfp_pvt *hfp) |
Send the CIND read command. More... | |
static int | hfp_send_cind_test (struct hfp_pvt *hfp) |
Send the CIND test command. More... | |
static int | hfp_send_clip (struct hfp_pvt *hfp, int status) |
Enable or disable calling line identification. More... | |
static int | hfp_send_cmer (struct hfp_pvt *hfp, int status) |
Enable or disable indicator events reporting. More... | |
static int | hfp_send_cmgf (struct hfp_pvt *hfp, int mode) |
Set the SMS mode. More... | |
static int | hfp_send_cmgr (struct hfp_pvt *hfp, int index) |
Read an SMS message. More... | |
static int | hfp_send_cmgs (struct hfp_pvt *hfp, const char *number) |
Start sending an SMS message. More... | |
static int | hfp_send_cnmi (struct hfp_pvt *hfp) |
Setup SMS new message indication. More... | |
static int | hfp_send_cusd (struct hfp_pvt *hfp, const char *code) |
Send CUSD. More... | |
static int | hfp_send_dtmf (struct hfp_pvt *hfp, char digit) |
Send a DTMF command. More... | |
static int | hfp_send_ecam (struct hfp_pvt *hfp) |
Enable Sony Ericsson extensions / indications. More... | |
static int | hfp_send_sms_text (struct hfp_pvt *hfp, const char *message) |
Send the text of an SMS message. More... | |
static int | hfp_send_vgs (struct hfp_pvt *hfp, int value) |
Send the current speaker gain level. More... | |
static int | hsp_send_error (int rsock) |
Send an ERROR AT response. More... | |
static int | hsp_send_ok (int rsock) |
Send an OK AT response. More... | |
static int | hsp_send_ring (int rsock) |
Send a RING unsolicited AT response. More... | |
static int | hsp_send_vgm (int rsock, int gain) |
Send a microphone gain unsolicited AT response. More... | |
static int | hsp_send_vgs (int rsock, int gain) |
Send a speaker gain unsolicited AT response. More... | |
static int | load_module (void) |
static int | mbl_answer (struct ast_channel *ast) |
static int | mbl_ast_hangup (struct mbl_pvt *pvt) |
static int | mbl_call (struct ast_channel *ast, const char *dest, int timeout) |
static int | mbl_devicestate (const char *data) |
static int | mbl_digit_end (struct ast_channel *ast, char digit, unsigned int duration) |
static int | mbl_fixup (struct ast_channel *oldchan, struct ast_channel *newchan) |
static int | mbl_hangup (struct ast_channel *ast) |
static int | mbl_has_service (struct mbl_pvt *pvt) |
Check if a mobile device has service. More... | |
static struct adapter_pvt * | mbl_load_adapter (struct ast_config *cfg, const char *cat) |
Load an adapter from the configuration file. More... | |
static int | mbl_load_config (void) |
static struct mbl_pvt * | mbl_load_device (struct ast_config *cfg, const char *cat) |
Load a device from the configuration file. More... | |
static struct ast_channel * | mbl_new (int state, struct mbl_pvt *pvt, struct cidinfo *cidinfo, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor) |
static int | mbl_queue_control (struct mbl_pvt *pvt, enum ast_control_frame_type control) |
static int | mbl_queue_hangup (struct mbl_pvt *pvt) |
static struct ast_frame * | mbl_read (struct ast_channel *ast) |
static struct ast_channel * | mbl_request (const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause) |
static int | mbl_sendsms_exec (struct ast_channel *ast, const char *data) |
static int | mbl_status_exec (struct ast_channel *ast, const char *data) |
static int | mbl_write (struct ast_channel *ast, struct ast_frame *frame) |
static void | msg_queue_flush (struct mbl_pvt *pvt) |
Remove all items from the queue and free them. More... | |
static void | msg_queue_free_and_pop (struct mbl_pvt *pvt) |
Remove an item from the front of the queue, and free it. More... | |
static struct msg_queue_entry * | msg_queue_head (struct mbl_pvt *pvt) |
Get the head of a queue. More... | |
static struct msg_queue_entry * | msg_queue_pop (struct mbl_pvt *pvt) |
Remove an item from the front of the queue. More... | |
static int | msg_queue_push (struct mbl_pvt *pvt, at_message_t expect, at_message_t response_to) |
Add an item to the back of the queue. More... | |
static int | msg_queue_push_data (struct mbl_pvt *pvt, at_message_t expect, at_message_t response_to, void *data) |
Add an item to the back of the queue with data. More... | |
static int | parse_next_token (char string[], const int start, const char delim) |
Terminate current token and return an index to start of the next token. More... | |
static void | rfcomm_append_buf (char **buf, size_t count, size_t *in_count, char c) |
Append the given character to the given buffer and increase the in_count. More... | |
static int | rfcomm_connect (bdaddr_t src, bdaddr_t dst, int remote_channel) |
static ssize_t | rfcomm_read (int rsock, char *buf, size_t count) |
Read one Hayes AT message from an rfcomm socket. More... | |
static int | rfcomm_read_and_append_char (int rsock, char **buf, size_t count, size_t *in_count, char *result, char expected) |
Read a character from the given stream and append it to the given buffer if it matches the expected character. More... | |
static int | rfcomm_read_and_expect_char (int rsock, char *result, char expected) |
Read a character from the given stream and check if it matches what we expected. More... | |
static int | rfcomm_read_cmgr (int rsock, char **buf, size_t count, size_t *in_count) |
Read the remainder of a +CMGR message. More... | |
static int | rfcomm_read_command (int rsock, char **buf, size_t count, size_t *in_count) |
Read the remainder of an AT command. More... | |
static int | rfcomm_read_result (int rsock, char **buf, size_t count, size_t *in_count) |
Read and AT result code. More... | |
static int | rfcomm_read_sms_prompt (int rsock, char **buf, size_t count, size_t *in_count) |
Read the remainder of an AT SMS prompt. More... | |
static int | rfcomm_read_until_crlf (int rsock, char **buf, size_t count, size_t *in_count) |
Read until. More... | |
static int | rfcomm_read_until_ok (int rsock, char **buf, size_t count, size_t *in_count) |
Read until a. More... | |
static int | rfcomm_wait (int rsock, int *ms) |
Wait for activity on an rfcomm socket. More... | |
static int | rfcomm_write (int rsock, char *buf) |
Write to an rfcomm socket. More... | |
static int | rfcomm_write_full (int rsock, char *buf, size_t count) |
Write to an rfcomm socket. More... | |
static int | sco_accept (int *id, int fd, short events, void *data) |
Accept SCO connections. This function is an ast_io callback function used to accept incoming sco audio connections. More... | |
static int | sco_bind (struct adapter_pvt *adapter) |
Bind an SCO listener socket for the given adapter. More... | |
static int | sco_connect (bdaddr_t src, bdaddr_t dst) |
static int | sco_write (int s, char *buf, int len) |
static sdp_session_t * | sdp_register (void) |
static int | sdp_search (char *addr, int profile) |
static void | set_unloading () |
Set the unloading flag. More... | |
static int | start_monitor (struct mbl_pvt *pvt) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Bluetooth Mobile Device Channel Driver" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_EXTENDED, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_CHANNEL_DRIVER, } |
static struct adapters | adapters = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static char * | app_mblsendsms = "MobileSendSMS" |
static char * | app_mblstatus = "MobileStatus" |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct devices | devices = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static int | discovery_interval = 60 |
static pthread_t | discovery_thread = AST_PTHREADT_NULL |
static struct hfp_hf | hfp_our_brsf |
static struct ast_cli_entry | mbl_cli [] |
static struct ast_channel_tech | mbl_tech |
static char * | mblsendsms_desc |
static char * | mblsendsms_synopsis = "MobileSendSMS(Device,Dest,Message)" |
static char * | mblstatus_desc |
static char * | mblstatus_synopsis = "MobileStatus(Device,Variable)" |
static sdp_session_t * | sdp_session |
static ast_mutex_t | unload_mutex = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
static int | unloading_flag = 0 |
Bluetooth Mobile Device channel driver.
Definition in file chan_mobile.c.
#define CHANNEL_FRAME_SIZE 80 |
Definition at line 83 of file chan_mobile.c.
#define DEVICE_FRAME_FORMAT ast_format_slin |
Definition at line 82 of file chan_mobile.c.
#define DEVICE_FRAME_SIZE 48 |
Definition at line 81 of file chan_mobile.c.
#define FORMAT1 "%-15.15s %-17.17s %-5.5s %-15.15s %-9.9s %-10.10s %-3.3s\n" |
#define FORMAT1 "%-17.17s %-30.30s %-6.6s %-7.7s %-4.4s\n" |
#define FORMAT2 "%-17.17s %-30.30s %-6.6s %-7.7s %d\n" |
#define HFP_AG_CONTROL (1 << 7) |
Definition at line 272 of file chan_mobile.c.
#define HFP_AG_CW (1 << 0) |
Definition at line 265 of file chan_mobile.c.
#define HFP_AG_ECNR (1 << 1) |
Definition at line 266 of file chan_mobile.c.
#define HFP_AG_ERRORS (1 << 8) |
Definition at line 273 of file chan_mobile.c.
#define HFP_AG_REJECT (1 << 5) |
Definition at line 270 of file chan_mobile.c.
#define HFP_AG_RING (1 << 3) |
Definition at line 268 of file chan_mobile.c.
#define HFP_AG_STATUS (1 << 6) |
Definition at line 271 of file chan_mobile.c.
#define HFP_AG_TAG (1 << 4) |
Definition at line 269 of file chan_mobile.c.
#define HFP_AG_VOICE (1 << 2) |
Definition at line 267 of file chan_mobile.c.
#define HFP_CIND_BATTCHG 7 |
Definition at line 283 of file chan_mobile.c.
#define HFP_CIND_CALL 2 |
Definition at line 278 of file chan_mobile.c.
#define HFP_CIND_CALL_ACTIVE 1 |
Definition at line 287 of file chan_mobile.c.
#define HFP_CIND_CALL_NONE 0 |
Definition at line 286 of file chan_mobile.c.
#define HFP_CIND_CALLHELD 4 |
Definition at line 280 of file chan_mobile.c.
#define HFP_CIND_CALLSETUP 3 |
Definition at line 279 of file chan_mobile.c.
#define HFP_CIND_CALLSETUP_ALERTING 3 |
Definition at line 293 of file chan_mobile.c.
#define HFP_CIND_CALLSETUP_INCOMING 1 |
Definition at line 291 of file chan_mobile.c.
#define HFP_CIND_CALLSETUP_NONE 0 |
Definition at line 290 of file chan_mobile.c.
#define HFP_CIND_CALLSETUP_OUTGOING 2 |
Definition at line 292 of file chan_mobile.c.
#define HFP_CIND_NONE 0 |
Definition at line 276 of file chan_mobile.c.
#define HFP_CIND_ROAM 6 |
Definition at line 282 of file chan_mobile.c.
#define HFP_CIND_SERVICE 1 |
Definition at line 277 of file chan_mobile.c.
#define HFP_CIND_SERVICE_AVAILABLE 1 |
Definition at line 297 of file chan_mobile.c.
#define HFP_CIND_SERVICE_NONE 0 |
Definition at line 296 of file chan_mobile.c.
#define HFP_CIND_SIGNAL 5 |
Definition at line 281 of file chan_mobile.c.
#define HFP_CIND_UNKNOWN -1 |
Definition at line 275 of file chan_mobile.c.
#define HFP_HF_CID (1 << 2) |
Definition at line 259 of file chan_mobile.c.
#define HFP_HF_CONTROL (1 << 6) |
Definition at line 263 of file chan_mobile.c.
#define HFP_HF_CW (1 << 1) |
Definition at line 258 of file chan_mobile.c.
#define HFP_HF_ECNR (1 << 0) |
Definition at line 257 of file chan_mobile.c.
#define HFP_HF_STATUS (1 << 5) |
Definition at line 262 of file chan_mobile.c.
#define HFP_HF_VOICE (1 << 3) |
Definition at line 260 of file chan_mobile.c.
#define HFP_HF_VOLUME (1 << 4) |
Definition at line 261 of file chan_mobile.c.
#define MBL_CONFIG "chan_mobile.conf" |
Definition at line 78 of file chan_mobile.c.
#define MBL_CONFIG_OLD "mobile.conf" |
Definition at line 79 of file chan_mobile.c.
#define rfcomm_read_debug | ( | c | ) |
Definition at line 1501 of file chan_mobile.c.
enum at_message_t |
Definition at line 419 of file chan_mobile.c.
enum mbl_type |
Enumerator | |
---|---|
MBL_TYPE_PHONE | |
MBL_TYPE_HEADSET |
Definition at line 94 of file chan_mobile.c.
|
static |
Definition at line 4840 of file chan_mobile.c.
|
static |
Definition at line 4840 of file chan_mobile.c.
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 4840 of file chan_mobile.c.
|
static |
Match the given buffer with the given prefix.
buf | the buffer to match |
prefix | the prefix to match |
Definition at line 2003 of file chan_mobile.c.
Referenced by at_read_full().
|
inlinestatic |
Get the string representation of the given AT message.
msg | the message to process |
Definition at line 2076 of file chan_mobile.c.
References AT_A, AT_BRSF, AT_BUSY, AT_CHUP, AT_CIEV, AT_CIND, AT_CIND_TEST, AT_CKPD, AT_CLIP, AT_CMER, AT_CMGF, AT_CMGR, AT_CMGS, AT_CMS_ERROR, AT_CMTI, AT_CNMI, AT_CUSD, AT_D, AT_ECAM, AT_ERROR, AT_NO_CARRIER, AT_NO_DIALTONE, AT_OK, AT_PARSE_ERROR, AT_READ_ERROR, AT_RING, AT_SMS_PROMPT, AT_UNKNOWN, AT_VGM, AT_VGS, and AT_VTS.
Referenced by do_monitor_headset(), do_monitor_phone(), handle_response_brsf(), handle_response_cind(), handle_response_error(), and handle_response_ok().
|
static |
Read an AT message and classify it.
rsock | an rfcomm socket |
buf | the buffer to store the result in |
count | the size of the buffer or the maximum number of characters to read |
Definition at line 2017 of file chan_mobile.c.
References AT_BRSF, AT_BUSY, AT_CIEV, AT_CIND, AT_CKPD, AT_CLIP, AT_CMGR, AT_CMS_ERROR, AT_CMTI, AT_CUSD, AT_ECAM, AT_ERROR, at_match_prefix(), AT_NO_CARRIER, AT_NO_DIALTONE, AT_OK, AT_RING, AT_SMS_PROMPT, AT_UNKNOWN, AT_VGM, AT_VGS, buf, and rfcomm_read().
Referenced by do_monitor_headset(), and do_monitor_phone().
|
inlinestatic |
Check if the module is unloading.
0 | not unloading |
1 | unloading |
Definition at line 4684 of file chan_mobile.c.
References ast_mutex_lock, ast_mutex_unlock, unload_mutex, and unloading_flag.
Referenced by do_discovery(), do_monitor_headset(), do_monitor_phone(), and do_sco_listen().
|
static |
Definition at line 1281 of file chan_mobile.c.
References a, abs, mbl_pvt::alignment_count, mbl_pvt::alignment_detection_triggered, mbl_pvt::alignment_samples, ast_debug, buf, and mbl_pvt::do_alignment_detection.
Referenced by mbl_read().
|
static |
Definition at line 4284 of file chan_mobile.c.
References mbl_pvt::adapter, adapter_pvt::addr, mbl_pvt::addr, ast_mutex_lock, ast_mutex_unlock, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_verb, check_unloading(), mbl_pvt::connected, discovery_interval, EVENT_FLAG_SYSTEM, adapter_pvt::id, mbl_pvt::id, adapter_pvt::inuse, mbl_pvt::lock, manager_event, NULL, rfcomm_connect(), mbl_pvt::rfcomm_port, mbl_pvt::rfcomm_socket, and start_monitor().
Referenced by load_module().
|
static |
Definition at line 4121 of file chan_mobile.c.
References mbl_pvt::adapter, adapter_pvt::addr, mbl_pvt::addr, mbl_pvt::answered, ast_channel_exten_set(), ast_channel_set_fd(), AST_CONTROL_ANSWER, ast_debug, ast_hangup(), ast_log, ast_mutex_lock, ast_mutex_unlock, ast_pbx_start(), ast_sched_runq(), ast_sched_wait(), AST_STATE_UP, ast_verb, AT_CKPD, at_msg2str(), at_read_full(), AT_VGM, AT_VGS, buf, check_unloading(), mbl_pvt::connected, errno, EVENT_FLAG_SYSTEM, hsp_send_error(), hsp_send_ok(), hsp_send_vgm(), hsp_send_vgs(), mbl_pvt::id, mbl_pvt::incoming, adapter_pvt::inuse, mbl_pvt::lock, LOG_ERROR, manager_event, mbl_new(), mbl_queue_control(), mbl_queue_hangup(), mbl_pvt::needring, NULL, mbl_pvt::outgoing, mbl_pvt::owner, mbl_pvt::rfcomm_socket, rfcomm_wait(), mbl_pvt::sched, sco_connect(), and mbl_pvt::sco_socket.
Referenced by start_monitor().
|
static |
Definition at line 3872 of file chan_mobile.c.
References mbl_pvt::adapter, ast_debug, ast_mutex_lock, ast_mutex_unlock, ast_verb, AT_BRSF, AT_BUSY, AT_CIEV, AT_CIND, AT_CIND_TEST, AT_CLIP, AT_CMER, AT_CMGR, AT_CMS_ERROR, AT_CMTI, AT_CUSD, AT_ECAM, AT_ERROR, at_msg2str(), AT_NO_CARRIER, AT_NO_DIALTONE, AT_OK, AT_PARSE_ERROR, AT_READ_ERROR, at_read_full(), AT_RING, AT_SMS_PROMPT, AT_UNKNOWN, mbl_pvt::blackberry, buf, check_unloading(), mbl_pvt::connected, msg_queue_entry::entry, errno, EVENT_FLAG_SYSTEM, handle_response_brsf(), handle_response_busy(), handle_response_ciev(), handle_response_cind(), handle_response_clip(), handle_response_cmgr(), handle_response_cmti(), handle_response_cusd(), handle_response_error(), handle_response_no_carrier(), handle_response_no_dialtone(), handle_response_ok(), handle_response_ring(), handle_sms_prompt(), mbl_pvt::hfp, hfp_our_brsf, hfp_parse_ecav(), hfp_send_brsf(), mbl_pvt::id, hfp_pvt::initialized, adapter_pvt::inuse, mbl_pvt::lock, manager_event, mbl_queue_hangup(), msg_queue_flush(), msg_queue_head(), msg_queue_push(), mbl_pvt::needchup, NULL, mbl_pvt::owner, hfp_pvt::owner, mbl_pvt::rfcomm_socket, rfcomm_wait(), hfp_pvt::rsock, mbl_pvt::sco_socket, and mbl_pvt::timeout.
Referenced by start_monitor().
|
static |
Service new and existing SCO connections. This thread accepts new sco connections and handles audio data. There is one do_sco_listen thread for each adapter.
Definition at line 4328 of file chan_mobile.c.
References adapter_pvt::accept_io, ast_io_wait(), ast_log, check_unloading(), adapter_pvt::id, adapter_pvt::io, LOG_ERROR, and NULL.
Referenced by mbl_load_adapter().
|
static |
Definition at line 659 of file chan_mobile.c.
References a, ast_cli(), ast_mutex_lock, ast_mutex_unlock, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AT_CUSD, AT_OK, buf, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, mbl_pvt::connected, mbl_pvt::hfp, hfp_send_cusd(), mbl_pvt::id, mbl_pvt::lock, msg_queue_push(), NULL, and ast_cli_entry::usage.
|
static |
Definition at line 611 of file chan_mobile.c.
References a, ast_cli(), ast_mutex_lock, ast_mutex_unlock, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AT_OK, AT_UNKNOWN, buf, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, mbl_pvt::connected, mbl_pvt::id, mbl_pvt::lock, msg_queue_push(), NULL, mbl_pvt::rfcomm_socket, rfcomm_write(), and ast_cli_entry::usage.
|
static |
Definition at line 541 of file chan_mobile.c.
References a, adapter_pvt::addr, ast_alloca, ast_cli(), AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, adapter_pvt::dev_id, FORMAT1, FORMAT2, adapter_pvt::hci_socket, adapter_pvt::inuse, len(), name, NULL, sdp_search(), and ast_cli_entry::usage.
|
static |
Definition at line 495 of file chan_mobile.c.
References a, mbl_pvt::adapter, mbl_pvt::addr, ast_cli(), ast_mutex_lock, ast_mutex_unlock, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, mbl_pvt::connected, FORMAT1, mbl_pvt::group, mbl_pvt::has_sms, adapter_pvt::id, mbl_pvt::id, mbl_pvt::incoming_sms, mbl_pvt::lock, mbl_has_service(), NULL, mbl_pvt::outgoing_sms, mbl_pvt::owner, and ast_cli_entry::usage.
|
static |
Handle the BRSF response.
pvt | a mbl_pvt structure |
buf | a null terminated buffer containing an AT message |
0 | success |
-1 | error |
Definition at line 3198 of file chan_mobile.c.
References ast_debug, AT_BRSF, at_msg2str(), AT_OK, buf, msg_queue_entry::entry, mbl_pvt::hfp, hfp_parse_brsf(), mbl_pvt::id, msg_queue_free_and_pop(), msg_queue_head(), and msg_queue_push().
Referenced by do_monitor_phone().
|
static |
Handle BUSY messages.
pvt | a mbl_pvt structure |
0 | success |
-1 | error |
Definition at line 3833 of file chan_mobile.c.
References AST_CAUSE_USER_BUSY, AST_CONTROL_BUSY, mbl_pvt::hangupcause, mbl_queue_control(), and mbl_pvt::needchup.
Referenced by do_monitor_phone(), and handle_response_ciev().
|
static |
Handle AT+CIEV messages.
pvt | a mbl_pvt structure |
buf | a null terminated buffer containing an AT message |
0 | success |
-1 | error |
Definition at line 3561 of file chan_mobile.c.
References mbl_pvt::answered, AST_CONTROL_ANSWER, AST_CONTROL_RINGING, ast_debug, ast_log, ast_setstate(), AST_STATE_UP, ast_verb, buf, hfp_cind::call, hfp_pvt::cind_map, hfp_pvt::cind_state, handle_response_busy(), mbl_pvt::hfp, HFP_CIND_CALL, HFP_CIND_CALL_ACTIVE, HFP_CIND_CALL_NONE, HFP_CIND_CALLSETUP, HFP_CIND_CALLSETUP_ALERTING, HFP_CIND_CALLSETUP_INCOMING, HFP_CIND_CALLSETUP_NONE, HFP_CIND_CALLSETUP_OUTGOING, HFP_CIND_NONE, hfp_parse_ciev(), mbl_pvt::id, mbl_pvt::incoming, LOG_ERROR, mbl_queue_control(), mbl_queue_hangup(), mbl_pvt::needcallerid, mbl_pvt::needchup, mbl_pvt::outgoing, mbl_pvt::owner, and hfp_pvt::sent_alerting.
Referenced by do_monitor_phone().
|
static |
Handle the CIND response.
pvt | a mbl_pvt structure |
buf | a null terminated buffer containing an AT message |
0 | success |
-1 | error |
Definition at line 3233 of file chan_mobile.c.
References ast_debug, AT_CIND, AT_CIND_TEST, at_msg2str(), AT_OK, buf, msg_queue_entry::entry, mbl_pvt::hfp, hfp_parse_cind(), hfp_parse_cind_test(), mbl_pvt::id, msg_queue_free_and_pop(), msg_queue_head(), and msg_queue_push().
Referenced by do_monitor_phone().
|
static |
Handle AT+CLIP messages.
pvt | a mbl_pvt structure |
buf | a null terminated buffer containing an AT message |
0 | success |
-1 | error |
Definition at line 3653 of file chan_mobile.c.
References ast_log, ast_pbx_start(), AST_STATE_RING, AT_CHUP, AT_CLIP, AT_OK, buf, msg_queue_entry::expected, mbl_pvt::hfp, hfp_parse_clip(), hfp_send_chup(), mbl_pvt::id, LOG_ERROR, mbl_ast_hangup(), mbl_new(), msg_queue_free_and_pop(), msg_queue_head(), msg_queue_push(), mbl_pvt::needcallerid, mbl_pvt::needchup, and NULL.
Referenced by do_monitor_phone().
|
static |
Handle AT+CMGR messages.
pvt | a mbl_pvt structure |
buf | a null terminated buffer containing an AT message |
0 | success |
-1 | error |
Definition at line 3737 of file chan_mobile.c.
References ast_channel_exten_set(), ast_debug, ast_log, ast_pbx_start(), AST_STATE_DOWN, AT_CMGR, buf, msg_queue_entry::expected, mbl_pvt::hfp, hfp_parse_cmgr(), mbl_pvt::id, mbl_pvt::incoming_sms, LOG_ERROR, mbl_ast_hangup(), mbl_new(), msg_queue_free_and_pop(), msg_queue_head(), NULL, pbx_builtin_setvar_helper(), and text.
Referenced by do_monitor_phone().
|
static |
Handle AT+CMTI messages.
pvt | a mbl_pvt structure |
buf | a null terminated buffer containing an AT message |
0 | success |
-1 | error |
Definition at line 3710 of file chan_mobile.c.
References ast_debug, AT_CMGR, buf, mbl_pvt::hfp, hfp_parse_cmti(), hfp_send_cmgr(), mbl_pvt::id, mbl_pvt::incoming_sms, and msg_queue_push().
Referenced by do_monitor_phone().
|
static |
Handle CUSD messages.
pvt | a mbl_pvt structure |
buf | a null terminated buffer containing an AT message |
0 | success |
-1 | error |
Definition at line 3813 of file chan_mobile.c.
References ast_verb, buf, mbl_pvt::hfp, hfp_parse_cusd(), and mbl_pvt::id.
Referenced by do_monitor_phone().
|
static |
Handle ERROR AT messages.
pvt | a mbl_pvt structure |
buf | a null terminated buffer containing an AT message |
0 | success |
-1 | error |
Definition at line 3444 of file chan_mobile.c.
References AST_CONTROL_CONGESTION, ast_debug, ast_verb, AT_A, AT_BRSF, AT_CHUP, AT_CIND, AT_CIND_TEST, AT_CLIP, AT_CMER, AT_CMGF, AT_CMGR, AT_CMGS, AT_CMS_ERROR, AT_CNMI, AT_CUSD, AT_D, AT_ECAM, AT_ERROR, at_msg2str(), AT_OK, AT_SMS_PROMPT, AT_UNKNOWN, AT_VGS, AT_VTS, msg_queue_entry::entry, mbl_pvt::has_sms, mbl_pvt::hfp, hfp_send_cmgf(), hfp_send_vgs(), mbl_pvt::id, mbl_pvt::incoming_sms, hfp_pvt::initialized, mbl_queue_control(), mbl_queue_hangup(), msg_queue_free_and_pop(), msg_queue_head(), msg_queue_push(), mbl_pvt::needchup, mbl_pvt::outgoing_sms, and mbl_pvt::timeout.
Referenced by do_monitor_phone().
|
static |
Handle NO CARRIER messages.
pvt | a mbl_pvt structure |
buf | a null terminated buffer containing an AT message |
0 | success |
-1 | error |
Definition at line 3863 of file chan_mobile.c.
References AST_CONTROL_CONGESTION, ast_verb, mbl_pvt::id, mbl_queue_control(), and mbl_pvt::needchup.
Referenced by do_monitor_phone().
|
static |
Handle NO DIALTONE messages.
pvt | a mbl_pvt structure |
buf | a null terminated buffer containing an AT message |
0 | success |
-1 | error |
Definition at line 3848 of file chan_mobile.c.
References AST_CONTROL_CONGESTION, ast_verb, mbl_pvt::id, mbl_queue_control(), and mbl_pvt::needchup.
Referenced by do_monitor_phone().
|
static |
Handle OK AT messages.
pvt | a mbl_pvt structure |
buf | a null terminated buffer containing an AT message |
0 | success |
-1 | error |
Definition at line 3275 of file chan_mobile.c.
References AST_CONTROL_PROGRESS, ast_debug, ast_verb, AT_A, AT_BRSF, AT_CHUP, AT_CIND, AT_CIND_TEST, AT_CLIP, AT_CMER, AT_CMGF, AT_CMGS, AT_CNMI, AT_CUSD, AT_D, AT_ECAM, at_msg2str(), AT_OK, AT_UNKNOWN, AT_VGS, AT_VTS, mbl_pvt::blackberry, hfp_cind::call, hfp_cind::callsetup, hfp_pvt::cind_map, hfp_pvt::cind_state, msg_queue_entry::entry, mbl_pvt::has_sms, mbl_pvt::hfp, hfp_send_cind(), hfp_send_cind_test(), hfp_send_clip(), hfp_send_cmer(), hfp_send_cmgf(), hfp_send_cnmi(), hfp_send_ecam(), hfp_send_vgs(), mbl_pvt::id, hfp_pvt::initialized, mbl_queue_control(), msg_queue_free_and_pop(), msg_queue_head(), msg_queue_push(), mbl_pvt::needchup, mbl_pvt::outgoing, mbl_pvt::outgoing_sms, hfp_cind::service, and mbl_pvt::timeout.
Referenced by do_monitor_phone().
|
static |
Handle RING messages.
pvt | a mbl_pvt structure |
buf | a null terminated buffer containing an AT message |
0 | success |
-1 | error |
Definition at line 3693 of file chan_mobile.c.
References ast_debug, AT_CLIP, AT_UNKNOWN, mbl_pvt::id, msg_queue_push(), and mbl_pvt::needcallerid.
Referenced by do_monitor_phone().
|
static |
Send an SMS message from the queue.
pvt | a mbl_pvt structure |
buf | a null terminated buffer containing an AT message |
0 | success |
-1 | error |
Definition at line 3782 of file chan_mobile.c.
References ast_debug, AT_CMGS, AT_OK, AT_SMS_PROMPT, msg_queue_entry::data, msg_queue_entry::expected, mbl_pvt::hfp, hfp_send_sms_text(), mbl_pvt::id, msg_queue_free_and_pop(), msg_queue_head(), and msg_queue_push().
Referenced by do_monitor_phone().
|
static |
Definition at line 4104 of file chan_mobile.c.
References ast_debug, ast_mutex_lock, ast_mutex_unlock, hsp_send_ring(), mbl_pvt::id, mbl_pvt::lock, mbl_pvt::needring, and mbl_pvt::rfcomm_socket.
Referenced by mbl_call().
|
static |
Convert a hfp_hf struct to a BRSF int.
hf | an hfp_hf brsf object |
Definition at line 2470 of file chan_mobile.c.
References hfp_hf::cid, hfp_hf::control, hfp_hf::cw, hfp_hf::ecnr, HFP_HF_CID, HFP_HF_CONTROL, HFP_HF_CW, HFP_HF_ECNR, HFP_HF_STATUS, HFP_HF_VOICE, HFP_HF_VOLUME, hfp_hf::status, hfp_hf::voice, and hfp_hf::volume.
Referenced by hfp_send_brsf().
Convert a BRSF int to an hfp_ag struct.
brsf | a brsf integer |
ag | a AG (hfp_ag) brsf object |
Definition at line 2492 of file chan_mobile.c.
References hfp_ag::control, hfp_ag::cw, hfp_ag::ecnr, hfp_ag::errors, HFP_AG_CONTROL, HFP_AG_CW, HFP_AG_ECNR, HFP_AG_ERRORS, HFP_AG_REJECT, HFP_AG_RING, HFP_AG_STATUS, HFP_AG_TAG, HFP_AG_VOICE, hfp_ag::reject, hfp_ag::ring, hfp_ag::status, hfp_ag::tag, and hfp_ag::voice.
Referenced by hfp_parse_brsf().
|
static |
Parse BRSF data.
hfp | an hfp_pvt struct |
buf | the buffer to parse (null terminated) |
Definition at line 2726 of file chan_mobile.c.
References hfp_pvt::brsf, buf, and hfp_int2brsf().
Referenced by handle_response_brsf().
|
static |
Parse a CIEV event.
hfp | an hfp_pvt struct |
buf | the buffer to parse (null terminated) |
value | a pointer to an int to store the event value in (can be NULL) |
Definition at line 2197 of file chan_mobile.c.
References ARRAY_LEN, ast_debug, buf, hfp_pvt::cind_index, hfp_pvt::cind_state, HFP_CIND_NONE, mbl_pvt::id, hfp_pvt::owner, and value.
Referenced by handle_response_ciev().
|
static |
Read the result of the AT+CIND? command.
hfp | an hfp_pvt struct |
buf | the buffer to parse (null terminated) |
Definition at line 2770 of file chan_mobile.c.
References buf, hfp_parse_cind_indicator(), indicator, NULL, and state.
Referenced by handle_response_cind().
|
static |
Parse and store the given indicator.
hfp | an hfp_pvt struct |
group | the indicator group |
indicator | the indicator to parse |
Definition at line 2744 of file chan_mobile.c.
References ARRAY_LEN, ast_debug, hfp_pvt::cind_state, indicator, and value.
Referenced by hfp_parse_cind().
|
static |
Parse the result of the AT+CIND=? command.
hfp | an hfp_pvt struct |
buf | the buffer to parse (null terminated) |
Definition at line 2820 of file chan_mobile.c.
References ast_debug, hfp_cind::battchg, buf, hfp_cind::call, hfp_cind::callheld, hfp_cind::callsetup, hfp_pvt::cind_index, hfp_pvt::cind_map, HFP_CIND_BATTCHG, HFP_CIND_CALL, HFP_CIND_CALLHELD, HFP_CIND_CALLSETUP, HFP_CIND_ROAM, HFP_CIND_SERVICE, HFP_CIND_SIGNAL, HFP_CIND_UNKNOWN, indicator, mbl_pvt::no_callsetup, hfp_pvt::nocallsetup, NULL, hfp_pvt::owner, hfp_cind::roam, hfp_cind::service, hfp_cind::signal, and state.
Referenced by handle_response_cind().
Parse a CLIP event.
hfp | an hfp_pvt struct |
buf | the buffer to parse (null terminated) |
Definition at line 2226 of file chan_mobile.c.
References ARRAY_LEN, ast_debug, ast_isphonenumber(), ast_strip_quoted(), buf, cidinfo::cnam, cidinfo::cnum, NULL, and parse_next_token().
Referenced by handle_response_clip().
|
static |
Parse a CMGR message.
hfp | an hfp_pvt struct |
buf | the buffer to parse (null terminated) |
from_number | a pointer to a char pointer which will store the from number |
text | a pointer to a char pointer which will store the message text |
-1 | parse error |
0 | success |
Definition at line 2354 of file chan_mobile.c.
References buf, state, and text.
Referenced by handle_response_cmgr().
|
static |
Parse a CMTI notification.
hfp | an hfp_pvt struct |
buf | the buffer to parse (null terminated) |
Definition at line 2328 of file chan_mobile.c.
References ast_debug, buf, mbl_pvt::id, and hfp_pvt::owner.
Referenced by handle_response_cmti().
|
static |
Parse a CUSD answer.
hfp | an hfp_pvt struct |
buf | the buffer to parse (null terminated) |
Definition at line 2418 of file chan_mobile.c.
Referenced by handle_response_cusd().
|
static |
Parse a ECAV event.
hfp | an hfp_pvt struct |
buf | the buffer to parse (null terminated) |
Example:
*ECAV: <ccid>,<ccstatus>,<calltype>[,<processid>] [,exitcause][,<number>,<type>]
Example indicating busy:
*ECAV: 1,7,1
Definition at line 2166 of file chan_mobile.c.
References ast_debug, buf, mbl_pvt::id, and hfp_pvt::owner.
Referenced by do_monitor_phone().
|
static |
Send ATA.
hfp | an hfp_pvt struct |
Definition at line 2704 of file chan_mobile.c.
References rfcomm_write(), and hfp_pvt::rsock.
Referenced by mbl_answer().
|
static |
Send ATD.
hfp | an hfp_pvt struct |
number | the number to send |
Definition at line 2693 of file chan_mobile.c.
References rfcomm_write(), and hfp_pvt::rsock.
Referenced by mbl_call().
Send a BRSF request.
0 | on success |
-1 | on error |
Definition at line 2516 of file chan_mobile.c.
References hfp_brsf2int(), rfcomm_write(), and hfp_pvt::rsock.
Referenced by do_monitor_phone().
|
static |
Send AT+CHUP.
hfp | an hfp_pvt struct |
Definition at line 2683 of file chan_mobile.c.
References rfcomm_write(), and hfp_pvt::rsock.
Referenced by handle_response_clip(), and mbl_hangup().
|
static |
Send the CIND read command.
hfp | an hfp_pvt struct |
Definition at line 2527 of file chan_mobile.c.
References rfcomm_write(), and hfp_pvt::rsock.
Referenced by handle_response_ok().
|
static |
Send the CIND test command.
hfp | an hfp_pvt struct |
Definition at line 2536 of file chan_mobile.c.
References rfcomm_write(), and hfp_pvt::rsock.
Referenced by handle_response_ok().
|
static |
Enable or disable calling line identification.
hfp | an hfp_pvt struct |
status | enable or disable calling line identification (should be 1 or 0) |
Definition at line 2585 of file chan_mobile.c.
References rfcomm_write(), hfp_pvt::rsock, and status.
Referenced by handle_response_ok().
|
static |
Enable or disable indicator events reporting.
hfp | an hfp_pvt struct |
status | enable or disable events reporting (should be 1 or 0) |
Definition at line 2546 of file chan_mobile.c.
References rfcomm_write(), hfp_pvt::rsock, and status.
Referenced by handle_response_ok().
|
static |
Set the SMS mode.
hfp | an hfp_pvt struct |
mode | the sms mode (0 = PDU, 1 = Text) |
Definition at line 2627 of file chan_mobile.c.
References rfcomm_write(), and hfp_pvt::rsock.
Referenced by handle_response_error(), and handle_response_ok().
|
static |
Read an SMS message.
hfp | an hfp_pvt struct |
index | the location of the requested message |
Definition at line 2648 of file chan_mobile.c.
References rfcomm_write(), and hfp_pvt::rsock.
Referenced by handle_response_cmti().
|
static |
Start sending an SMS message.
hfp | an hfp_pvt struct |
number | the destination of the message |
Definition at line 2660 of file chan_mobile.c.
References rfcomm_write(), and hfp_pvt::rsock.
Referenced by mbl_sendsms_exec().
|
static |
Setup SMS new message indication.
hfp | an hfp_pvt struct |
Definition at line 2638 of file chan_mobile.c.
References rfcomm_write(), and hfp_pvt::rsock.
Referenced by handle_response_ok().
|
static |
Send CUSD.
hfp | an hfp_pvt struct |
code | the CUSD code to send |
Definition at line 2714 of file chan_mobile.c.
References rfcomm_write(), and hfp_pvt::rsock.
Referenced by handle_cli_mobile_cusd().
|
static |
Send a DTMF command.
hfp | an hfp_pvt struct |
digit | the dtmf digit to send |
Definition at line 2598 of file chan_mobile.c.
References digit, rfcomm_write(), and hfp_pvt::rsock.
Referenced by mbl_digit_end().
|
static |
Enable Sony Ericsson extensions / indications.
hfp | an hfp_pvt struct |
Definition at line 2184 of file chan_mobile.c.
References rfcomm_write(), and hfp_pvt::rsock.
Referenced by handle_response_ok().
|
static |
Send the text of an SMS message.
hfp | an hfp_pvt struct |
message | the text of the message |
Definition at line 2672 of file chan_mobile.c.
References rfcomm_write(), and hfp_pvt::rsock.
Referenced by handle_sms_prompt().
|
static |
Send the current speaker gain level.
hfp | an hfp_pvt struct |
value | the value to send (must be between 0 and 15) |
Definition at line 2558 of file chan_mobile.c.
References rfcomm_write(), hfp_pvt::rsock, and value.
Referenced by handle_response_error(), and handle_response_ok().
|
static |
Send an ERROR AT response.
rsock | the rfcomm socket to use |
Definition at line 2935 of file chan_mobile.c.
References rfcomm_write().
Referenced by do_monitor_headset().
|
static |
Send an OK AT response.
rsock | the rfcomm socket to use |
Definition at line 2926 of file chan_mobile.c.
References rfcomm_write().
Referenced by do_monitor_headset().
|
static |
Send a RING unsolicited AT response.
rsock | the rfcomm socket to use |
Definition at line 2968 of file chan_mobile.c.
References rfcomm_write().
Referenced by headset_send_ring(), and mbl_call().
|
static |
Send a microphone gain unsolicited AT response.
rsock | the rfcomm socket to use |
gain | the microphone gain value |
Definition at line 2957 of file chan_mobile.c.
References rfcomm_write().
Referenced by do_monitor_headset().
|
static |
Send a speaker gain unsolicited AT response.
rsock | the rfcomm socket to use |
gain | the speaker gain value |
Definition at line 2945 of file chan_mobile.c.
References rfcomm_write().
Referenced by do_monitor_headset().
|
static |
Definition at line 4778 of file chan_mobile.c.
References ao2_ref, app_mblsendsms, app_mblstatus, ast_channel_register(), ast_cli_register_multiple, ast_format_cap_alloc, ast_format_cap_append, AST_FORMAT_CAP_FLAG_DEFAULT, ast_log, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_pthread_create_background, ast_register_application, ast_channel_tech::capabilities, adapter_pvt::dev_id, DEVICE_FRAME_FORMAT, discovery_thread, do_discovery(), LOG_ERROR, mbl_cli, MBL_CONFIG, mbl_load_config(), mbl_sendsms_exec(), mbl_status_exec(), mbl_tech, mblsendsms_desc, mblsendsms_synopsis, mblstatus_desc, mblstatus_synopsis, NULL, sdp_register(), sdp_session, and unload_module().
|
static |
Definition at line 1066 of file chan_mobile.c.
References mbl_pvt::answered, ast_channel_tech_pvt(), ast_mutex_lock, ast_mutex_unlock, AT_A, AT_OK, mbl_pvt::hfp, hfp_send_ata(), mbl_pvt::incoming, mbl_pvt::lock, MBL_TYPE_HEADSET, msg_queue_push(), and mbl_pvt::type.
|
static |
Definition at line 1354 of file chan_mobile.c.
References ast_hangup(), and mbl_pvt::owner.
Referenced by handle_response_clip(), and handle_response_cmgr().
|
static |
Definition at line 970 of file chan_mobile.c.
References ast_channel_name(), ast_channel_tech_pvt(), ast_debug, ast_log, ast_mutex_lock, ast_mutex_unlock, ast_sched_add(), AST_STATE_DOWN, AST_STATE_RESERVED, ast_strdupa, AT_D, AT_OK, mbl_pvt::hangupcause, headset_send_ring(), mbl_pvt::hfp, hfp_send_atd(), hsp_send_ring(), mbl_pvt::id, mbl_pvt::lock, LOG_ERROR, LOG_WARNING, MBL_TYPE_PHONE, msg_queue_push(), mbl_pvt::needchup, mbl_pvt::needring, NULL, mbl_pvt::outgoing, mbl_pvt::rfcomm_socket, mbl_pvt::ring_sched_id, mbl_pvt::sched, and mbl_pvt::type.
|
static |
Definition at line 1214 of file chan_mobile.c.
References ast_debug, AST_DEVICE_INUSE, AST_DEVICE_INVALID, AST_DEVICE_NOT_INUSE, AST_DEVICE_UNAVAILABLE, ast_mutex_lock, ast_mutex_unlock, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_strdupa, mbl_pvt::connected, mbl_pvt::id, mbl_pvt::lock, mbl_has_service(), mbl_pvt::owner, and S_OR.
|
static |
Definition at line 1088 of file chan_mobile.c.
References ast_channel_tech_pvt(), ast_debug, ast_mutex_lock, ast_mutex_unlock, AT_OK, AT_VTS, digit, mbl_pvt::hfp, hfp_send_dtmf(), mbl_pvt::id, mbl_pvt::lock, MBL_TYPE_HEADSET, msg_queue_push(), and mbl_pvt::type.
|
static |
Definition at line 1195 of file chan_mobile.c.
References ast_channel_tech_pvt(), ast_debug, ast_mutex_lock, ast_mutex_unlock, mbl_pvt::lock, and mbl_pvt::owner.
|
static |
Definition at line 1028 of file chan_mobile.c.
References ast_channel_set_fd(), ast_channel_tech_pvt(), ast_channel_tech_pvt_set(), ast_debug, ast_log, ast_mutex_lock, ast_mutex_unlock, ast_setstate(), AST_STATE_DOWN, AT_CHUP, AT_OK, mbl_pvt::hfp, hfp_send_chup(), mbl_pvt::id, mbl_pvt::incoming, mbl_pvt::lock, LOG_WARNING, msg_queue_push(), mbl_pvt::needchup, mbl_pvt::needring, NULL, mbl_pvt::outgoing, mbl_pvt::owner, and mbl_pvt::sco_socket.
|
static |
Check if a mobile device has service.
pvt | a mbl_pvt struct |
1 | this device has service |
0 | no service |
Definition at line 1369 of file chan_mobile.c.
References hfp_pvt::cind_map, hfp_pvt::cind_state, mbl_pvt::hfp, HFP_CIND_SERVICE_AVAILABLE, MBL_TYPE_PHONE, hfp_cind::service, and mbl_pvt::type.
Referenced by handle_cli_mobile_show_devices(), mbl_devicestate(), and mbl_request().
|
static |
Load an adapter from the configuration file.
cfg | the config to load the adapter from |
cat | the adapter to load |
This function loads the given adapter and starts the sco listener thread for that adapter.
Definition at line 4366 of file chan_mobile.c.
References adapter_pvt::accept_io, adapter_pvt::addr, adapter_pvt::alignment_detection, ast_calloc, ast_copy_string(), ast_debug, ast_free, ast_io_add(), AST_IO_IN, ast_io_remove(), ast_log, ast_pthread_create_background, AST_RWLIST_INSERT_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strlen_zero(), ast_true(), ast_variable_browse(), ast_variable_retrieve(), adapter_pvt::dev_id, do_sco_listen(), dr, adapter_pvt::hci_socket, adapter_pvt::id, id, adapter_pvt::io, io_context_create(), io_context_destroy(), LOG_ERROR, LOG_WARNING, ast_variable::name, ast_variable::next, NULL, sco_accept(), sco_bind(), adapter_pvt::sco_id, adapter_pvt::sco_listener_thread, adapter_pvt::sco_socket, and ast_variable::value.
Referenced by mbl_load_config().
|
static |
Definition at line 4626 of file chan_mobile.c.
References ast_category_browse(), ast_config_destroy(), ast_config_load, ast_log, AST_RWLIST_EMPTY, ast_variable_browse(), discovery_interval, LOG_ERROR, LOG_NOTICE, MBL_CONFIG, MBL_CONFIG_OLD, mbl_load_adapter(), mbl_load_device(), ast_variable::name, ast_variable::next, NULL, and ast_variable::value.
Referenced by load_module().
|
static |
Load a device from the configuration file.
cfg | the config to load the device from |
cat | the device to load |
Definition at line 4482 of file chan_mobile.c.
References mbl_pvt::adapter, mbl_pvt::addr, ast_calloc, ast_copy_string(), ast_debug, ast_dsp_free(), ast_dsp_new(), ast_dsp_set_digitmode(), ast_dsp_set_features(), ast_free, AST_LIST_HEAD_INIT_NOLOCK, ast_log, ast_mutex_init, AST_PTHREADT_NULL, AST_RWLIST_INSERT_HEAD, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_sched_context_create(), ast_sched_context_destroy(), ast_smoother_free(), ast_smoother_new(), ast_strlen_zero(), ast_true(), ast_variable_browse(), ast_variable_retrieve(), mbl_pvt::blackberry, mbl_pvt::bt_in_smoother, mbl_pvt::bt_out_smoother, CHANNEL_FRAME_SIZE, mbl_pvt::context, DEVICE_FRAME_SIZE, mbl_pvt::dsp, DSP_DIGITMODE_DTMF, DSP_DIGITMODE_RELAXDTMF, DSP_FEATURE_DIGIT_DETECT, mbl_pvt::group, mbl_pvt::has_sms, mbl_pvt::hfp, adapter_pvt::id, mbl_pvt::id, mbl_pvt::lock, LOG_ERROR, MBL_TYPE_HEADSET, MBL_TYPE_PHONE, mbl_pvt::monitor_thread, mbl_pvt::msg_queue, ast_variable::name, ast_variable::next, mbl_pvt::no_callsetup, hfp_pvt::nocallsetup, NULL, hfp_pvt::owner, mbl_pvt::rfcomm_port, mbl_pvt::rfcomm_socket, mbl_pvt::ring_sched_id, hfp_pvt::rport, mbl_pvt::sched, mbl_pvt::sco_socket, mbl_pvt::timeout, mbl_pvt::type, and ast_variable::value.
Referenced by mbl_load_config().
|
static |
Definition at line 847 of file chan_mobile.c.
References mbl_pvt::adapter, mbl_pvt::alignment_count, adapter_pvt::alignment_detection, mbl_pvt::alignment_detection_triggered, mbl_pvt::answered, ast_channel_alloc, ast_channel_nativeformats_set(), ast_channel_rings_set(), ast_channel_set_fd(), ast_channel_set_rawreadformat(), ast_channel_set_rawwriteformat(), ast_channel_set_readformat(), ast_channel_set_writeformat(), ast_channel_tech_pvt_set(), ast_channel_tech_set(), ast_channel_unlock, ast_dsp_digitreset(), ast_random(), ast_smoother_reset(), AST_STATE_RING, mbl_pvt::bt_in_smoother, mbl_pvt::bt_out_smoother, ast_channel_tech::capabilities, CHANNEL_FRAME_SIZE, cidinfo::cnam, cidinfo::cnum, mbl_pvt::context, DEVICE_FRAME_FORMAT, DEVICE_FRAME_SIZE, mbl_pvt::do_alignment_detection, mbl_pvt::dsp, mbl_pvt::id, mbl_tech, NULL, mbl_pvt::owner, and mbl_pvt::sco_socket.
Referenced by do_monitor_headset(), handle_response_clip(), handle_response_cmgr(), and mbl_request().
|
static |
Definition at line 1317 of file chan_mobile.c.
References ast_channel_trylock, ast_channel_unlock, ast_queue_control(), DEADLOCK_AVOIDANCE, mbl_pvt::lock, and mbl_pvt::owner.
Referenced by do_monitor_headset(), handle_response_busy(), handle_response_ciev(), handle_response_error(), handle_response_no_carrier(), handle_response_no_dialtone(), and handle_response_ok().
|
static |
Definition at line 1334 of file chan_mobile.c.
References ast_channel_hangupcause_set(), ast_channel_trylock, ast_channel_unlock, ast_queue_hangup(), DEADLOCK_AVOIDANCE, mbl_pvt::hangupcause, mbl_pvt::lock, and mbl_pvt::owner.
Referenced by do_monitor_headset(), do_monitor_phone(), handle_response_ciev(), and handle_response_error().
|
static |
Definition at line 1109 of file chan_mobile.c.
References ast_channel_set_fd(), ast_channel_tech_pvt(), ast_debug, ast_dsp_process(), AST_FRAME_VOICE, AST_FRIENDLY_OFFSET, ast_mutex_trylock, ast_mutex_unlock, ast_null_frame, ast_smoother_feed, ast_smoother_read(), mbl_pvt::bt_in_smoother, CHANNEL_DEADLOCK_AVOIDANCE, ast_frame::data, ast_frame::datalen, ast_frame::delivery, DEVICE_FRAME_FORMAT, DEVICE_FRAME_SIZE, mbl_pvt::do_alignment_detection, do_alignment_detection(), mbl_pvt::dsp, errno, ast_frame_subclass::format, mbl_pvt::fr, ast_frame::frametype, mbl_pvt::id, mbl_pvt::io_buf, mbl_pvt::lock, ast_frame::mallocd, NULL, ast_frame::offset, mbl_pvt::owner, ast_frame::ptr, ast_frame::samples, mbl_pvt::sco_socket, ast_frame::src, and ast_frame::subclass.
|
static |
Definition at line 898 of file chan_mobile.c.
References AST_CAUSE_FACILITY_NOT_IMPLEMENTED, AST_CAUSE_INCOMPATIBLE_DESTINATION, AST_CAUSE_REQUESTED_CHAN_UNAVAIL, ast_format_cap_get_names(), ast_format_cap_iscompatible_format(), AST_FORMAT_CAP_NAMES_LEN, AST_FORMAT_CMP_NOT_EQUAL, ast_log, ast_mutex_lock, ast_mutex_unlock, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_STATE_DOWN, ast_str_alloca, ast_strdupa, mbl_pvt::connected, DEVICE_FRAME_FORMAT, mbl_pvt::group, mbl_pvt::id, mbl_pvt::lock, LOG_WARNING, mbl_has_service(), mbl_new(), MBL_TYPE_PHONE, NULL, mbl_pvt::owner, and mbl_pvt::type.
|
static |
Definition at line 763 of file chan_mobile.c.
References args, AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_free, ast_log, ast_mutex_lock, ast_mutex_unlock, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_STANDARD_APP_ARGS, ast_strdup, ast_strdupa, ast_strlen_zero(), AT_CMGS, AT_SMS_PROMPT, mbl_pvt::connected, mbl_pvt::has_sms, mbl_pvt::hfp, hfp_send_cmgs(), mbl_pvt::id, mbl_pvt::lock, LOG_ERROR, and msg_queue_push_data().
Referenced by load_module().
|
static |
Definition at line 715 of file chan_mobile.c.
References args, AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_mutex_lock, ast_mutex_unlock, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), mbl_pvt::connected, mbl_pvt::id, mbl_pvt::lock, mbl_pvt::owner, pbx_builtin_setvar_helper(), and status.
Referenced by load_module().
|
static |
Definition at line 1167 of file chan_mobile.c.
References ast_channel_tech_pvt(), ast_debug, AST_FRAME_VOICE, ast_mutex_trylock, ast_mutex_unlock, ast_smoother_feed, ast_smoother_read(), mbl_pvt::bt_out_smoother, CHANNEL_DEADLOCK_AVOIDANCE, ast_frame::data, ast_frame::datalen, ast_frame::frametype, mbl_pvt::lock, ast_frame::ptr, mbl_pvt::sco_socket, and sco_write().
|
static |
Remove all items from the queue and free them.
pvt | a mbl_pvt structure |
Definition at line 3048 of file chan_mobile.c.
References msg_queue_free_and_pop(), and msg_queue_head().
Referenced by do_monitor_phone(), and unload_module().
|
static |
Remove an item from the front of the queue, and free it.
pvt | a mbl_pvt structure |
Definition at line 3034 of file chan_mobile.c.
References ast_free, msg_queue_entry::data, and msg_queue_pop().
Referenced by handle_response_brsf(), handle_response_cind(), handle_response_clip(), handle_response_cmgr(), handle_response_error(), handle_response_ok(), handle_sms_prompt(), and msg_queue_flush().
|
static |
Get the head of a queue.
pvt | a mbl_pvt structure |
Definition at line 3060 of file chan_mobile.c.
References AST_LIST_FIRST, and mbl_pvt::msg_queue.
Referenced by do_monitor_phone(), handle_response_brsf(), handle_response_cind(), handle_response_clip(), handle_response_cmgr(), handle_response_error(), handle_response_ok(), handle_sms_prompt(), and msg_queue_flush().
|
static |
Remove an item from the front of the queue.
pvt | a mbl_pvt structure |
Definition at line 3025 of file chan_mobile.c.
References AST_LIST_REMOVE_HEAD, and mbl_pvt::msg_queue.
Referenced by msg_queue_free_and_pop().
|
static |
Add an item to the back of the queue.
pvt | a mbl_pvt structure |
expect | the msg we expect to receive |
response_to | the message that was sent to generate the expected response |
Definition at line 2984 of file chan_mobile.c.
References ast_calloc, AST_LIST_INSERT_TAIL, msg_queue_entry::expected, mbl_pvt::msg_queue, and msg_queue_entry::response_to.
Referenced by do_monitor_phone(), handle_cli_mobile_cusd(), handle_cli_mobile_rfcomm(), handle_response_brsf(), handle_response_cind(), handle_response_clip(), handle_response_cmti(), handle_response_error(), handle_response_ok(), handle_response_ring(), handle_sms_prompt(), mbl_answer(), mbl_call(), mbl_digit_end(), and mbl_hangup().
|
static |
Add an item to the back of the queue with data.
pvt | a mbl_pvt structure |
expect | the msg we expect to receive |
response_to | the message that was sent to generate the expected response |
data | data associated with this message, it will be freed when the message is freed |
Definition at line 3006 of file chan_mobile.c.
References ast_calloc, AST_LIST_INSERT_TAIL, msg_queue_entry::data, msg_queue_entry::expected, mbl_pvt::msg_queue, and msg_queue_entry::response_to.
Referenced by mbl_sendsms_exec().
|
static |
Terminate current token and return an index to start of the next token.
string | the null-terminated string being parsed (will be altered!) |
start | where the current token starts |
delim | the token termination delimiter. \0 is also considered a terminator. |
Definition at line 2299 of file chan_mobile.c.
Referenced by hfp_parse_clip().
|
inlinestatic |
Append the given character to the given buffer and increase the in_count.
Definition at line 1508 of file chan_mobile.c.
References c.
Referenced by rfcomm_read(), rfcomm_read_and_append_char(), rfcomm_read_cmgr(), rfcomm_read_command(), rfcomm_read_result(), rfcomm_read_until_crlf(), and rfcomm_read_until_ok().
|
static |
Definition at line 1390 of file chan_mobile.c.
References ast_debug, and errno.
Referenced by do_discovery().
|
static |
Read one Hayes AT message from an rfcomm socket.
rsock | the rfcomm socket to read from |
buf | the buffer to store the result in |
count | the size of the buffer or the maximum number of characters to read |
Here we need to read complete Hayes AT messages. The AT message formats we support are listed below.
* \r\n<result code>\r\n * <at command>\r * \r\n> *
These formats correspond to AT result codes, AT commands, and the AT SMS prompt respectively. When messages are read the leading and trailing
'\r'
and
'\n'
characters are discarded. If the given buffer is not large enough to hold the response, what does not fit in the buffer will be dropped.
0 | end of file |
-1 | read error |
-2 | parse error |
other | the number of characters added to buf |
Definition at line 1808 of file chan_mobile.c.
References buf, c, rfcomm_append_buf(), rfcomm_read_and_expect_char(), rfcomm_read_command(), and rfcomm_read_result().
Referenced by at_read_full().
|
static |
Read a character from the given stream and append it to the given buffer if it matches the expected character.
Definition at line 1544 of file chan_mobile.c.
References buf, c, result, rfcomm_append_buf(), and rfcomm_read_and_expect_char().
Referenced by rfcomm_read_result(), and rfcomm_read_sms_prompt().
|
static |
Read a character from the given stream and check if it matches what we expected.
Definition at line 1520 of file chan_mobile.c.
References c, result, and rfcomm_read_debug.
Referenced by rfcomm_read(), rfcomm_read_and_append_char(), rfcomm_read_result(), rfcomm_read_until_crlf(), and rfcomm_read_until_ok().
|
static |
Read the remainder of a +CMGR message.
'+CMGR: ...\r\n...\r\n...\r\n...\r\nOK\r\n'
Definition at line 1706 of file chan_mobile.c.
References ast_log, buf, LOG_ERROR, rfcomm_append_buf(), and rfcomm_read_until_ok().
Referenced by rfcomm_read_result().
|
static |
Read the remainder of an AT command.
'<at command>\r'
Definition at line 1763 of file chan_mobile.c.
References buf, c, rfcomm_append_buf(), and rfcomm_read_debug.
Referenced by rfcomm_read().
|
static |
Read and AT result code.
'\r\n<result code>\r\n'
Definition at line 1725 of file chan_mobile.c.
References ast_log, buf, c, LOG_ERROR, rfcomm_append_buf(), rfcomm_read_and_append_char(), rfcomm_read_and_expect_char(), rfcomm_read_cmgr(), rfcomm_read_sms_prompt(), and rfcomm_read_until_crlf().
Referenced by rfcomm_read().
|
static |
Read the remainder of an AT SMS prompt.
'\r\n> '
By the time this function is executed, only a ' ' is left to read.
Definition at line 1593 of file chan_mobile.c.
References ast_log, buf, LOG_ERROR, NULL, and rfcomm_read_and_append_char().
Referenced by rfcomm_read_result().
|
static |
Read until.
'\r\n'.
This function consumes the
'\r\n'
but does not add it to buf.
Definition at line 1564 of file chan_mobile.c.
References buf, c, rfcomm_append_buf(), rfcomm_read_and_expect_char(), and rfcomm_read_debug.
Referenced by rfcomm_read_result(), and rfcomm_read_until_ok().
|
static |
Read until a.
\r\nOK\r\n
message.
Definition at line 1609 of file chan_mobile.c.
References buf, c, rfcomm_append_buf(), rfcomm_read_and_expect_char(), and rfcomm_read_until_crlf().
Referenced by rfcomm_read_cmgr().
|
static |
Wait for activity on an rfcomm socket.
rsock | the socket to watch |
ms | a pointer to an int containing a timeout in ms |
0 | timeout |
Definition at line 1479 of file chan_mobile.c.
References ast_waitfor_n_fd().
Referenced by do_monitor_headset(), and do_monitor_phone().
|
static |
Write to an rfcomm socket.
rsock | the socket to write to |
buf | the null terminated buffer to write |
This function will write characters from buf. The buffer must be null terminated.
-1 | error |
0 | success |
Definition at line 1436 of file chan_mobile.c.
References buf, and rfcomm_write_full().
Referenced by handle_cli_mobile_rfcomm(), hfp_send_ata(), hfp_send_atd(), hfp_send_brsf(), hfp_send_chup(), hfp_send_cind(), hfp_send_cind_test(), hfp_send_clip(), hfp_send_cmer(), hfp_send_cmgf(), hfp_send_cmgr(), hfp_send_cmgs(), hfp_send_cnmi(), hfp_send_cusd(), hfp_send_dtmf(), hfp_send_ecam(), hfp_send_sms_text(), hfp_send_vgs(), hsp_send_error(), hsp_send_ok(), hsp_send_ring(), hsp_send_vgm(), and hsp_send_vgs().
|
static |
Write to an rfcomm socket.
rsock | the socket to write to |
buf | the buffer to write |
count | the number of characters from the buffer to write |
This function will write count characters from buf. It will always write count chars unless it encounters an error.
-1 | error |
0 | success |
Definition at line 1454 of file chan_mobile.c.
References ast_debug, buf, and errno.
Referenced by rfcomm_write().
|
static |
Accept SCO connections. This function is an ast_io callback function used to accept incoming sco audio connections.
Definition at line 1898 of file chan_mobile.c.
References mbl_pvt::addr, ast_channel_set_fd(), ast_debug, ast_log, ast_mutex_lock, ast_mutex_unlock, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, adapter_pvt::id, len(), mbl_pvt::lock, LOG_ERROR, LOG_WARNING, NULL, mbl_pvt::owner, and mbl_pvt::sco_socket.
Referenced by mbl_load_adapter().
|
static |
Bind an SCO listener socket for the given adapter.
adapter | an adapter_pvt |
Definition at line 1958 of file chan_mobile.c.
References adapter_pvt::addr, ast_log, errno, adapter_pvt::id, LOG_ERROR, and adapter_pvt::sco_socket.
Referenced by mbl_load_adapter().
|
static |
Definition at line 1833 of file chan_mobile.c.
References ast_debug, and errno.
Referenced by do_monitor_headset().
|
static |
Definition at line 1871 of file chan_mobile.c.
References ast_debug, buf, errno, and len().
Referenced by mbl_write().
|
static |
Definition at line 3121 of file chan_mobile.c.
References ast_log, errno, LOG_WARNING, NULL, and session.
Referenced by load_module().
|
static |
Definition at line 3073 of file chan_mobile.c.
References ast_debug, if(), session, and status.
Referenced by handle_cli_mobile_search().
|
inlinestatic |
Set the unloading flag.
Definition at line 4697 of file chan_mobile.c.
References ast_mutex_lock, ast_mutex_unlock, unload_mutex, and unloading_flag.
Referenced by unload_module().
|
static |
Definition at line 4263 of file chan_mobile.c.
References ast_pthread_create_background, AST_PTHREADT_NULL, do_monitor_headset(), do_monitor_phone(), mbl_pvt::hfp, MBL_TYPE_PHONE, mbl_pvt::monitor_thread, NULL, mbl_pvt::rfcomm_socket, hfp_pvt::rsock, and mbl_pvt::type.
Referenced by do_discovery().
|
static |
Definition at line 4704 of file chan_mobile.c.
References adapter_pvt::accept_io, ao2_ref, app_mblsendsms, app_mblstatus, ast_channel_unregister(), ast_cli_unregister_multiple(), ast_dsp_free(), ast_free, AST_PTHREADT_NULL, AST_RWLIST_REMOVE_HEAD, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_sched_context_destroy(), ast_smoother_free(), ast_unregister_application(), mbl_pvt::bt_in_smoother, mbl_pvt::bt_out_smoother, ast_channel_tech::capabilities, discovery_thread, mbl_pvt::dsp, adapter_pvt::hci_socket, mbl_pvt::hfp, adapter_pvt::io, io_context_destroy(), mbl_cli, mbl_tech, mbl_pvt::monitor_thread, msg_queue_flush(), NULL, mbl_pvt::rfcomm_socket, mbl_pvt::sched, adapter_pvt::sco_listener_thread, adapter_pvt::sco_socket, mbl_pvt::sco_socket, sdp_session, and set_unloading().
Referenced by load_module().
|
static |
Definition at line 4840 of file chan_mobile.c.
|
static |
|
static |
Definition at line 209 of file chan_mobile.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 201 of file chan_mobile.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 4840 of file chan_mobile.c.
|
static |
|
static |
Definition at line 85 of file chan_mobile.c.
Referenced by do_discovery(), and mbl_load_config().
|
static |
Definition at line 86 of file chan_mobile.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 361 of file chan_mobile.c.
Referenced by do_monitor_phone().
|
static |
Definition at line 193 of file chan_mobile.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 479 of file chan_mobile.c.
Referenced by load_module(), mbl_new(), and unload_module().
|
static |
Definition at line 211 of file chan_mobile.c.
Referenced by load_module().
|
static |
Definition at line 210 of file chan_mobile.c.
Referenced by load_module().
|
static |
Definition at line 203 of file chan_mobile.c.
Referenced by load_module().
|
static |
Definition at line 202 of file chan_mobile.c.
Referenced by load_module().
|
static |
Definition at line 87 of file chan_mobile.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 89 of file chan_mobile.c.
Referenced by check_unloading(), and set_unloading().
|
static |
Definition at line 90 of file chan_mobile.c.
Referenced by check_unloading(), and set_unloading().