xref: /btstack/src/classic/hfp_gsm_model.h (revision df1e871fcfe703cb03429ba32131851efc0e720f)
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
232fca4dadSMilanka Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
242fca4dadSMilanka Ringwald  * GMBH 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 
38fe5a6c4eSMilanka Ringwald /**
39fe5a6c4eSMilanka Ringwald  * @title HFP GSM Model
40fe5a6c4eSMilanka Ringwald  *
41fe5a6c4eSMilanka Ringwald  */
4274386ee0SMatthias Ringwald 
4374386ee0SMatthias Ringwald #ifndef BTSTACK_HFP_GSM_MODEL_H
4474386ee0SMatthias Ringwald #define BTSTACK_HFP_GSM_MODEL_H
4574386ee0SMatthias Ringwald 
4674386ee0SMatthias Ringwald #include "hci.h"
47efda0b48SMatthias Ringwald #include "sdp_client_rfcomm.h"
4874386ee0SMatthias Ringwald #include "hfp.h"
4974386ee0SMatthias Ringwald 
5074386ee0SMatthias Ringwald #if defined __cplusplus
5174386ee0SMatthias Ringwald extern "C" {
5274386ee0SMatthias Ringwald #endif
5374386ee0SMatthias Ringwald 
5474386ee0SMatthias Ringwald /* API_START */
559cae807eSMatthias Ringwald typedef struct {
56*df1e871fSMatthias Ringwald     bool used_slot;
579cae807eSMatthias Ringwald     hfp_enhanced_call_status_t enhanced_status;
5866a048abSMatthias Ringwald     hfp_enhanced_call_dir_t direction;
599cae807eSMatthias Ringwald     hfp_enhanced_call_mode_t mode;
609cae807eSMatthias Ringwald     hfp_enhanced_call_mpty_t mpty;
619cae807eSMatthias Ringwald     // TODO: sort on drop call, so that index corresponds to table index
629cae807eSMatthias Ringwald     int index;
639cae807eSMatthias Ringwald     uint8_t clip_type;
649cae807eSMatthias Ringwald     char    clip_number[25];
659cae807eSMatthias Ringwald } hfp_gsm_call_t;
669cae807eSMatthias Ringwald 
679cae807eSMatthias Ringwald hfp_callheld_status_t hfp_gsm_callheld_status(void);
689cae807eSMatthias Ringwald hfp_call_status_t hfp_gsm_call_status(void);
699cae807eSMatthias Ringwald hfp_callsetup_status_t hfp_gsm_callsetup_status(void);
709cae807eSMatthias Ringwald 
719cae807eSMatthias Ringwald int hfp_gsm_get_number_of_calls(void);
729cae807eSMatthias Ringwald char * hfp_gsm_last_dialed_number(void);
739cae807eSMatthias Ringwald void hfp_gsm_clear_last_dialed_number(void);
749de679b7SMilanka Ringwald void hfp_gsm_set_last_dialed_number(const char* number);
759cae807eSMatthias Ringwald 
769cae807eSMatthias Ringwald hfp_gsm_call_t * hfp_gsm_call(int index);
7774386ee0SMatthias Ringwald 
78d210d9c4SMatthias Ringwald int hfp_gsm_call_possible(void);
79d210d9c4SMatthias Ringwald 
809cae807eSMatthias Ringwald uint8_t hfp_gsm_clip_type(void);
819cae807eSMatthias Ringwald char *  hfp_gsm_clip_number(void);
82d0c20769SMatthias Ringwald 
83d210d9c4SMatthias Ringwald void hfp_gsm_init(void);
8420b2edb6SMatthias Ringwald void hfp_gsm_deinit(void);
85d210d9c4SMatthias Ringwald 
86f8737b81SMatthias Ringwald void hfp_gsm_handler(hfp_ag_call_event_t event, uint8_t index, uint8_t type, const char * number);
8774386ee0SMatthias Ringwald 
8820b2edb6SMatthias Ringwald 
8974386ee0SMatthias Ringwald /* API_END */
9074386ee0SMatthias Ringwald 
9174386ee0SMatthias Ringwald #if defined __cplusplus
9274386ee0SMatthias Ringwald }
9374386ee0SMatthias Ringwald #endif
9474386ee0SMatthias Ringwald 
9574386ee0SMatthias Ringwald #endif
96