2022-09-16 14:15:52 +02:00
|
|
|
/* Spa Bluez5 ModemManager proxy
|
|
|
|
|
*
|
|
|
|
|
* Copyright © 2022 Collabora
|
|
|
|
|
*
|
|
|
|
|
* 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 (including the next
|
|
|
|
|
* paragraph) 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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef SPA_BLUEZ5_MODEMMANAGER_H_
|
|
|
|
|
#define SPA_BLUEZ5_MODEMMANAGER_H_
|
|
|
|
|
|
2022-09-23 16:26:07 +02:00
|
|
|
#include <spa/utils/list.h>
|
|
|
|
|
|
2022-09-16 14:15:52 +02:00
|
|
|
#include "defs.h"
|
|
|
|
|
|
2022-09-23 09:27:23 +02:00
|
|
|
enum cmee_error {
|
|
|
|
|
CMEE_AG_FAILURE = 0,
|
|
|
|
|
CMEE_NO_CONNECTION_TO_PHONE = 1,
|
|
|
|
|
CMEE_OPERATION_NOT_ALLOWED = 3,
|
|
|
|
|
CMEE_OPERATION_NOT_SUPPORTED = 4,
|
|
|
|
|
CMEE_INVALID_CHARACTERS_TEXT_STRING = 25,
|
|
|
|
|
CMEE_INVALID_CHARACTERS_DIAL_STRING = 27,
|
|
|
|
|
CMEE_NO_NETWORK_SERVICE = 30
|
|
|
|
|
};
|
|
|
|
|
|
2022-09-16 15:02:25 +02:00
|
|
|
enum call_setup {
|
|
|
|
|
CIND_CALLSETUP_NONE = 0,
|
|
|
|
|
CIND_CALLSETUP_INCOMING,
|
|
|
|
|
CIND_CALLSETUP_DIALING,
|
|
|
|
|
CIND_CALLSETUP_ALERTING
|
|
|
|
|
};
|
|
|
|
|
|
2022-09-23 16:26:07 +02:00
|
|
|
enum call_direction {
|
|
|
|
|
CALL_OUTGOING,
|
|
|
|
|
CALL_INCOMING
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum call_state {
|
|
|
|
|
CLCC_ACTIVE,
|
|
|
|
|
CLCC_HELD,
|
|
|
|
|
CLCC_DIALING,
|
|
|
|
|
CLCC_ALERTING,
|
|
|
|
|
CLCC_INCOMING,
|
|
|
|
|
CLCC_WAITING,
|
|
|
|
|
CLCC_RESPONSE_AND_HOLD
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct call {
|
|
|
|
|
struct spa_list link;
|
|
|
|
|
unsigned int index;
|
|
|
|
|
struct impl *this;
|
|
|
|
|
DBusPendingCall *pending;
|
|
|
|
|
|
|
|
|
|
char *path;
|
|
|
|
|
char *number;
|
|
|
|
|
bool call_indicator;
|
|
|
|
|
enum call_direction direction;
|
|
|
|
|
enum call_state state;
|
|
|
|
|
bool multiparty;
|
|
|
|
|
};
|
|
|
|
|
|
2022-09-16 14:15:52 +02:00
|
|
|
struct mm_ops {
|
2022-09-16 15:17:04 +02:00
|
|
|
void (*send_cmd_result)(bool success, enum cmee_error error, void *user_data);
|
2022-09-16 14:15:52 +02:00
|
|
|
void (*set_modem_service)(bool available, void *user_data);
|
|
|
|
|
void (*set_modem_signal_strength)(unsigned int strength, void *user_data);
|
2022-09-16 14:43:37 +02:00
|
|
|
void (*set_modem_operator_name)(const char *name, void *user_data);
|
2022-09-16 15:45:00 +02:00
|
|
|
void (*set_modem_own_number)(const char *number, void *user_data);
|
2022-09-16 14:43:37 +02:00
|
|
|
void (*set_modem_roaming)(bool is_roaming, void *user_data);
|
2022-09-16 15:02:25 +02:00
|
|
|
void (*set_call_active)(bool active, void *user_data);
|
|
|
|
|
void (*set_call_setup)(enum call_setup value, void *user_data);
|
2022-09-16 14:15:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_BLUEZ_5_BACKEND_NATIVE_MM
|
2022-09-26 15:17:43 +02:00
|
|
|
void *mm_register(struct spa_log *log, void *dbus_connection, const struct spa_dict *info,
|
|
|
|
|
const struct mm_ops *ops, void *user_data);
|
2022-09-16 14:15:52 +02:00
|
|
|
void mm_unregister(void *data);
|
2022-09-16 15:17:04 +02:00
|
|
|
bool mm_is_available(void *modemmanager);
|
|
|
|
|
unsigned int mm_supported_features();
|
|
|
|
|
bool mm_answer_call(void *modemmanager, void *user_data, enum cmee_error *error);
|
|
|
|
|
bool mm_hangup_call(void *modemmanager, void *user_data, enum cmee_error *error);
|
2022-09-16 15:30:52 +02:00
|
|
|
bool mm_do_call(void *modemmanager, const char* number, void *user_data, enum cmee_error *error);
|
2022-09-16 15:46:34 +02:00
|
|
|
bool mm_send_dtmf(void *modemmanager, const char *dtmf, void *user_data, enum cmee_error *error);
|
2022-09-16 15:23:42 +02:00
|
|
|
const char *mm_get_incoming_call_number(void *modemmanager);
|
2022-09-23 16:26:07 +02:00
|
|
|
struct spa_list *mm_get_calls(void *modemmanager);
|
2022-09-16 14:15:52 +02:00
|
|
|
#else
|
2022-09-26 15:17:43 +02:00
|
|
|
void *mm_register(struct spa_log *log, void *dbus_connection, const struct spa_dict *info,
|
|
|
|
|
const struct mm_ops *ops, void *user_data)
|
2022-09-16 14:15:52 +02:00
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mm_unregister(void *data)
|
|
|
|
|
{
|
|
|
|
|
}
|
2022-09-16 15:17:04 +02:00
|
|
|
|
|
|
|
|
bool mm_is_available(void *modemmanager)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-10 17:49:57 +03:00
|
|
|
unsigned int mm_supported_features(void)
|
2022-09-16 15:17:04 +02:00
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool mm_answer_call(void *modemmanager, void *user_data, enum cmee_error *error)
|
|
|
|
|
{
|
|
|
|
|
if (error)
|
|
|
|
|
*error = CMEE_OPERATION_NOT_SUPPORTED;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool mm_hangup_call(void *modemmanager, void *user_data, enum cmee_error *error)
|
|
|
|
|
{
|
|
|
|
|
if (error)
|
|
|
|
|
*error = CMEE_OPERATION_NOT_SUPPORTED;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2022-09-16 15:23:42 +02:00
|
|
|
|
2022-09-16 15:30:52 +02:00
|
|
|
bool mm_do_call(void *modemmanager, const char* number, void *user_data, enum cmee_error *error)
|
|
|
|
|
{
|
|
|
|
|
if (error)
|
|
|
|
|
*error = CMEE_OPERATION_NOT_SUPPORTED;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-16 15:46:34 +02:00
|
|
|
bool mm_send_dtmf(void *modemmanager, const char *dtmf, void *user_data, enum cmee_error *error)
|
|
|
|
|
{
|
|
|
|
|
if (error)
|
|
|
|
|
*error = CMEE_OPERATION_NOT_SUPPORTED;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-16 15:23:42 +02:00
|
|
|
const char *mm_get_incoming_call_number(void *modemmanager)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2022-09-23 16:26:07 +02:00
|
|
|
|
|
|
|
|
struct spa_list *mm_get_calls(void *modemmanager)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2022-09-16 14:15:52 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|