mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-24 22:58:13 +00:00
Partial implementation of time_t in the Python wrapper.
This commit is contained in:
parent
90c0306f66
commit
719b507b9f
4 changed files with 42 additions and 3 deletions
|
|
@ -40,11 +40,9 @@ blacklisted_events = [
|
|||
blacklisted_functions = [
|
||||
'linphone_call_log_get_local_stats', # missing rtp_stats_t
|
||||
'linphone_call_log_get_remote_stats', # missing rtp_stats_t
|
||||
'linphone_call_log_get_start_date', # missing time_t
|
||||
'linphone_call_params_get_privacy', # missing LinphonePrivacyMask
|
||||
'linphone_call_params_set_privacy', # missing LinphonePrivacyMask
|
||||
'linphone_chat_message_get_file_transfer_information', # missing LinphoneContent
|
||||
'linphone_chat_message_get_time', # missing time_t
|
||||
'linphone_chat_message_start_file_download', # to be handwritten because of callback
|
||||
'linphone_chat_message_state_to_string', # There is no use to wrap this function
|
||||
'linphone_chat_room_create_file_transfer_message', # missing LinphoneContent
|
||||
|
|
@ -70,7 +68,6 @@ blacklisted_functions = [
|
|||
'linphone_event_send_subscribe', # missing LinphoneContent
|
||||
'linphone_event_update_publish', # missing LinphoneContent
|
||||
'linphone_event_update_subscribe', # missing LinphoneContent
|
||||
'linphone_presence_model_get_timestamp', # missing time_t
|
||||
'linphone_proxy_config_get_privacy', # missing LinphonePrivacyMask
|
||||
'linphone_proxy_config_normalize_number', # to be handwritten because of result via arguments
|
||||
'linphone_proxy_config_set_file_transfer_server', # defined but not implemented in linphone core
|
||||
|
|
|
|||
|
|
@ -10,3 +10,5 @@ typedef struct {
|
|||
int PyLinphoneVideoSize_Check(PyObject *p);
|
||||
MSVideoSize PyLinphoneVideoSize_AsMSVideoSize(PyObject *obj);
|
||||
PyObject * PyLinphoneVideoSize_FromMSVideoSize(MSVideoSize vs);
|
||||
time_t PyDateTime_As_time_t(PyObject *obj);
|
||||
PyObject * PyDateTime_From_time_t(time_t t);
|
||||
|
|
|
|||
|
|
@ -393,6 +393,39 @@ PyObject * PyLinphoneVideoSize_FromMSVideoSize(MSVideoSize vs) {
|
|||
}
|
||||
|
||||
|
||||
time_t PyDateTime_As_time_t(PyObject *obj) {
|
||||
}
|
||||
|
||||
PyObject * PyDateTime_From_time_t(time_t t) {
|
||||
PyObject *pyret = NULL;
|
||||
PyObject *datetime_module;
|
||||
PyObject *datetime_class;
|
||||
if (t == -1) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
datetime_module = PyImport_ImportModule("datetime");
|
||||
if (datetime_module != NULL) {
|
||||
PyObject *datetime_class = PyObject_GetAttrString(datetime_module, "datetime");
|
||||
if (datetime_class != NULL) {
|
||||
PyObject *utcfromtimestamp = PyObject_GetAttrString(datetime_class, "utcfromtimestamp");
|
||||
if (utcfromtimestamp != NULL) {
|
||||
pyret = PyEval_CallObject(utcfromtimestamp, Py_BuildValue("(f)", (float)t));
|
||||
if (pyret == NULL) {
|
||||
PyErr_Print();
|
||||
}
|
||||
Py_DECREF(utcfromtimestamp);
|
||||
}
|
||||
Py_DECREF(datetime_class);
|
||||
}
|
||||
Py_DECREF(datetime_module);
|
||||
}
|
||||
if (pyret == NULL) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
return pyret;
|
||||
}
|
||||
|
||||
|
||||
static PyObject * pylinphone_PayloadTypeType_module_method_string(PyObject *self, PyObject *args) {
|
||||
const char *value_str = "[invalid]";
|
||||
int value;
|
||||
|
|
|
|||
|
|
@ -139,6 +139,13 @@ class ArgumentType:
|
|||
self.convert_func = 'PyInt_AsLong'
|
||||
self.fmt_str = 'i'
|
||||
self.cfmt_str = '%d'
|
||||
elif self.basic_type == 'time_t':
|
||||
self.type_str = 'DateTime'
|
||||
self.check_func = 'PyDateTime_Check'
|
||||
self.convert_func = 'PyDateTime_As_time_t'
|
||||
self.convert_from_func = 'PyDateTime_From_time_t'
|
||||
self.fmt_str = 'O'
|
||||
self.cfmt_str = '%p'
|
||||
elif self.basic_type == 'MSList':
|
||||
self.type_str = 'list of linphone.' + self.contained_type
|
||||
self.check_func = 'PyList_Check'
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue