xref: /btstack/src/classic/hfp_gsm_model.h (revision 9cae807ed43e0ab5921240d65e041e665d97c7b1)
174386ee0SMatthias Ringwald /*
274386ee0SMatthias Ringwald  * Copyright (C) 2014 BlueKitchen GmbH
374386ee0SMatthias Ringwald  *
474386ee0SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
574386ee0SMatthias Ringwald  * modification, are permitted provided that the following conditions
674386ee0SMatthias Ringwald  * are met:
774386ee0SMatthias Ringwald  *
874386ee0SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
974386ee0SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
1074386ee0SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
1174386ee0SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
1274386ee0SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
1374386ee0SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
1474386ee0SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
1574386ee0SMatthias Ringwald  *    from this software without specific prior written permission.
1674386ee0SMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
1774386ee0SMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
1874386ee0SMatthias Ringwald  *    monetary gain.
1974386ee0SMatthias Ringwald  *
2074386ee0SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
2174386ee0SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2274386ee0SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
2374386ee0SMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
2474386ee0SMatthias Ringwald  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2574386ee0SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2674386ee0SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
2774386ee0SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
2874386ee0SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2974386ee0SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
3074386ee0SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3174386ee0SMatthias Ringwald  * SUCH DAMAGE.
3274386ee0SMatthias Ringwald  *
3374386ee0SMatthias Ringwald  * Please inquire about commercial licensing options at
3474386ee0SMatthias Ringwald  * [email protected]
3574386ee0SMatthias Ringwald  *
3674386ee0SMatthias Ringwald  */
3774386ee0SMatthias Ringwald 
3874386ee0SMatthias Ringwald // *****************************************************************************
3974386ee0SMatthias Ringwald //
40*9cae807eSMatthias Ringwald //  GSM model
4174386ee0SMatthias Ringwald //
4274386ee0SMatthias Ringwald // *****************************************************************************
4374386ee0SMatthias Ringwald 
4474386ee0SMatthias Ringwald 
4574386ee0SMatthias Ringwald #ifndef BTSTACK_HFP_GSM_MODEL_H
4674386ee0SMatthias Ringwald #define BTSTACK_HFP_GSM_MODEL_H
4774386ee0SMatthias Ringwald 
4874386ee0SMatthias Ringwald #include "hci.h"
4974386ee0SMatthias Ringwald #include "sdp_query_rfcomm.h"
5074386ee0SMatthias Ringwald #include "hfp.h"
5174386ee0SMatthias Ringwald 
5274386ee0SMatthias Ringwald #if defined __cplusplus
5374386ee0SMatthias Ringwald extern "C" {
5474386ee0SMatthias Ringwald #endif
5574386ee0SMatthias Ringwald 
5674386ee0SMatthias Ringwald /* API_START */
5774386ee0SMatthias Ringwald 
58*9cae807eSMatthias Ringwald typedef enum{
59*9cae807eSMatthias Ringwald     CALL_NONE,
60*9cae807eSMatthias Ringwald     CALL_INITIATED,
61*9cae807eSMatthias Ringwald     CALL_RESPONSE_HOLD,
62*9cae807eSMatthias Ringwald     CALL_ACTIVE,
63*9cae807eSMatthias Ringwald     CALL_HELD
64*9cae807eSMatthias Ringwald } hfp_gsm_call_status_t;
6574386ee0SMatthias Ringwald 
66*9cae807eSMatthias Ringwald typedef struct {
67*9cae807eSMatthias Ringwald     // TODO: use enhanced_status instead of status
68*9cae807eSMatthias Ringwald     hfp_gsm_call_status_t status;
69*9cae807eSMatthias Ringwald     hfp_enhanced_call_dir_t direction;
70*9cae807eSMatthias Ringwald     hfp_enhanced_call_status_t enhanced_status;
71*9cae807eSMatthias Ringwald     hfp_enhanced_call_mode_t mode;
72*9cae807eSMatthias Ringwald     hfp_enhanced_call_mpty_t mpty;
73*9cae807eSMatthias Ringwald     // TODO: sort on drop call, so that index corresponds to table index
74*9cae807eSMatthias Ringwald     int index;
75*9cae807eSMatthias Ringwald     uint8_t clip_type;
76*9cae807eSMatthias Ringwald     char    clip_number[25];
77*9cae807eSMatthias Ringwald } hfp_gsm_call_t;
78*9cae807eSMatthias Ringwald 
79*9cae807eSMatthias Ringwald hfp_callheld_status_t hfp_gsm_callheld_status(void);
80*9cae807eSMatthias Ringwald hfp_call_status_t hfp_gsm_call_status(void);
81*9cae807eSMatthias Ringwald hfp_callsetup_status_t hfp_gsm_callsetup_status(void);
82*9cae807eSMatthias Ringwald 
83*9cae807eSMatthias Ringwald int hfp_gsm_get_number_of_calls(void);
84*9cae807eSMatthias Ringwald char * hfp_gsm_last_dialed_number(void);
85*9cae807eSMatthias Ringwald void hfp_gsm_clear_last_dialed_number(void);
86*9cae807eSMatthias Ringwald 
87*9cae807eSMatthias Ringwald 
88*9cae807eSMatthias Ringwald hfp_gsm_call_t * hfp_gsm_call(int index);
8974386ee0SMatthias Ringwald 
90d210d9c4SMatthias Ringwald int hfp_gsm_call_possible(void);
91d210d9c4SMatthias Ringwald 
92*9cae807eSMatthias Ringwald uint8_t hfp_gsm_clip_type(void);
93*9cae807eSMatthias Ringwald char *  hfp_gsm_clip_number(void);
94d0c20769SMatthias Ringwald 
95d210d9c4SMatthias Ringwald void hfp_gsm_init(void);
96d210d9c4SMatthias Ringwald 
97d0c20769SMatthias Ringwald void hfp_gsm_handle_event_with_clip(hfp_ag_call_event_t event, uint8_t type, const char * number);
98d0c20769SMatthias Ringwald void hfp_gsm_handle_event_with_call_index(hfp_ag_call_event_t event, uint8_t index);
99*9cae807eSMatthias Ringwald void hfp_gsm_handle_event_with_call_number(hfp_ag_call_event_t event, const char * number);
10074386ee0SMatthias Ringwald void hfp_gsm_handle_event(hfp_ag_call_event_t event);
10174386ee0SMatthias Ringwald 
10274386ee0SMatthias Ringwald /* API_END */
10374386ee0SMatthias Ringwald 
10474386ee0SMatthias Ringwald #if defined __cplusplus
10574386ee0SMatthias Ringwald }
10674386ee0SMatthias Ringwald #endif
10774386ee0SMatthias Ringwald 
10874386ee0SMatthias Ringwald #endif