uv-k5-firmware-custom/app/dtmf.h

118 lines
3.1 KiB
C
Raw Normal View History

2023-09-09 07:03:56 +00:00
/* Copyright 2023 Dual Tachyon
* https://github.com/DualTachyon
*
* 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.
*/
#ifndef DTMF_H
#define DTMF_H
#include <stdbool.h>
#include <stdint.h>
#define MAX_DTMF_CONTACTS 16
2023-09-09 07:03:56 +00:00
enum DTMF_State_t {
DTMF_STATE_0 = 0,
DTMF_STATE_TX_SUCC,
DTMF_STATE_CALL_OUT_RSP
2023-09-09 07:03:56 +00:00
};
typedef enum DTMF_State_t DTMF_State_t;
enum DTMF_CallState_t {
DTMF_CALL_STATE_NONE = 0,
DTMF_CALL_STATE_CALL_OUT,
DTMF_CALL_STATE_RECEIVED,
DTMF_CALL_STATE_RECEIVED_STAY
2023-09-09 07:03:56 +00:00
};
2023-09-30 10:22:19 +00:00
enum DTMF_DecodeResponse_t {
DTMF_DEC_RESPONSE_NONE = 0,
DTMF_DEC_RESPONSE_RING,
DTMF_DEC_RESPONSE_REPLY,
DTMF_DEC_RESPONSE_BOTH
};
2023-09-09 07:03:56 +00:00
typedef enum DTMF_CallState_t DTMF_CallState_t;
enum DTMF_ReplyState_t {
DTMF_REPLY_NONE = 0,
DTMF_REPLY_ANI,
DTMF_REPLY_AB,
DTMF_REPLY_AAAAA
2023-09-09 07:03:56 +00:00
};
typedef enum DTMF_ReplyState_t DTMF_ReplyState_t;
enum DTMF_CallMode_t {
DTMF_CALL_MODE_NOT_GROUP = 0,
DTMF_CALL_MODE_GROUP,
DTMF_CALL_MODE_DTMF
2023-09-09 07:03:56 +00:00
};
enum { // seconds
DTMF_HOLD_MIN = 5,
DTMF_HOLD_MAX = 60
};
2023-09-09 07:03:56 +00:00
typedef enum DTMF_CallMode_t DTMF_CallMode_t;
extern char gDTMF_String[15];
2023-09-16 22:08:57 +00:00
2023-09-30 10:22:19 +00:00
extern char gDTMF_InputBox[15];
extern uint8_t gDTMF_InputBox_Index;
2023-09-30 10:22:19 +00:00
extern bool gDTMF_InputMode;
2023-09-16 22:08:57 +00:00
extern uint8_t gDTMF_PreviousIndex;
2023-09-30 10:22:19 +00:00
extern char gDTMF_RX_live[20];
extern uint8_t gDTMF_RX_live_timeout;
#ifdef ENABLE_DTMF_CALLING
2023-09-30 10:22:19 +00:00
extern char gDTMF_RX[17];
extern uint8_t gDTMF_RX_index;
extern uint8_t gDTMF_RX_timeout;
extern bool gDTMF_RX_pending;
2023-09-16 22:08:57 +00:00
extern bool gIsDtmfContactValid;
extern char gDTMF_ID[4];
extern char gDTMF_Caller[4];
extern char gDTMF_Callee[4];
extern DTMF_State_t gDTMF_State;
extern uint8_t gDTMF_DecodeRingCountdown_500ms;
2023-10-04 20:29:35 +00:00
extern uint8_t gDTMF_chosen_contact;
extern uint8_t gDTMF_auto_reset_time_500ms;
extern DTMF_CallState_t gDTMF_CallState;
extern DTMF_CallMode_t gDTMF_CallMode;
extern bool gDTMF_IsTx;
extern uint8_t gDTMF_TxStopCountdown_500ms;
#endif
extern DTMF_ReplyState_t gDTMF_ReplyState;
2023-09-09 07:03:56 +00:00
2023-09-30 10:22:19 +00:00
bool DTMF_ValidateCodes(char *pCode, const unsigned int size);
char DTMF_GetCharacter(const unsigned int code);
void DTMF_clear_input_box(void);
2023-09-30 10:22:19 +00:00
void DTMF_Append(const char vode);
2023-09-09 07:03:56 +00:00
void DTMF_Reply(void);
#ifdef ENABLE_DTMF_CALLING
void DTMF_clear_RX(void);
DTMF_CallMode_t DTMF_CheckGroupCall(const char *pDTMF, const unsigned int size);
bool DTMF_GetContact(const int Index, char *pContact);
bool DTMF_FindContact(const char *pContact, char *pResult);
void DTMF_HandleRequest(void);
#endif
2023-09-09 07:03:56 +00:00
#endif