Commit 639fb3b0 authored by Sylvain Berfini's avatar Sylvain Berfini

Improved callback for logs upload

parent 97de48d1
......@@ -166,7 +166,7 @@ namespace Linphone.Agents
/// <summary>
/// Callback for LinphoneCoreListener
/// </summary>
public void LogUploadStatusChanged(bool uploadComplete, string info)
public void LogUploadStatusChanged(LinphoneCoreLogCollectionUploadState state, string info)
{
}
......
......@@ -180,5 +180,12 @@ namespace Linphone
LinphoneTransportTLS = 2,
LinphoneTransportDTLS = 3
};
public enum class LinphoneCoreLogCollectionUploadState : int
{
LinphoneCoreLogCollectionUploadStateInProgress = 0, /**< Delivery in progress */
LinphoneCoreLogCollectionUploadStateDelivered = 1, /**< Log collection upload successfully delivered and acknowledged by remote end point */
LinphoneCoreLogCollectionUploadStateNotDelivered = 2
};
}
}
\ No newline at end of file
......@@ -1634,12 +1634,12 @@ void log_collection_upload_progress_indication(LinphoneCore *lc, size_t progress
Linphone::Core::gApiLock.LeaveListener();
}
void log_collection_upload_state_changed(LinphoneCore *lc, LinphoneCoreLogCollectionUploadState state, const char *info) {
void log_collection_upload_state_changed(LinphoneCore *lc, ::LinphoneCoreLogCollectionUploadState state, const char *info) {
Linphone::Core::gApiLock.EnterListener();
Linphone::Core::LinphoneCoreListener^ listener = Linphone::Core::Globals::Instance->LinphoneCore->CoreListener;
if (listener != nullptr)
{
listener->LogUploadStatusChanged(state == LinphoneCoreLogCollectionUploadState::LinphoneCoreLogCollectionUploadStateDelivered, info ? Linphone::Core::Utils::cctops(info) : nullptr);
listener->LogUploadStatusChanged((Linphone::Core::LinphoneCoreLogCollectionUploadState)state, info ? Linphone::Core::Utils::cctops(info) : nullptr);
}
Linphone::Core::gApiLock.LeaveListener();
}
......
......@@ -87,9 +87,9 @@ namespace Linphone
/// <summary>
/// Callback method called when the status of the current log upload changes.
/// </summary>
/// <param name="uploadComplete">Tells whether or not the upload is complete</param>
/// <param name="state">Tells the state of the upload</param>
/// <param name="info">An error message if the upload went wrong, the url of the uploaded logs if it went well, null if upload not yet finished</param>
void LogUploadStatusChanged(Platform::Boolean uploadComplete, Platform::String^ info);
void LogUploadStatusChanged(LinphoneCoreLogCollectionUploadState state, Platform::String^ info);
/// <summary>
/// Callback method called when the progress of the current logs upload has changed.
......
......@@ -1013,15 +1013,15 @@ namespace Linphone.Model
/// <summary>
/// Callback for LinphoneCoreListener
/// </summary>
public void LogUploadStatusChanged(bool uploadComplete, string info)
public void LogUploadStatusChanged(LinphoneCoreLogCollectionUploadState state, string info)
{
BaseModel.UIDispatcher.BeginInvoke(() =>
{
if (uploadComplete)
if (state == LinphoneCoreLogCollectionUploadState.LinphoneCoreLogCollectionUploadStateDelivered)
{
SendEmail(info);
}
else if (info != null)
}
else if (state == LinphoneCoreLogCollectionUploadState.LinphoneCoreLogCollectionUploadStateNotDelivered)
{
Logger.Err(String.Format("[LinphoneManager] Logs upload error: {0}", info));
var notif = new CustomMessageBox()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment