/* Copyright © 2015-2016 Gluzskiy Alexandr (sss) This file is part of Unknown Download Manager (UDM). UDM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. UDM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with UDM. If not, see . */ syntax = "proto2"; import "ui.proto"; //TODO: rework message subscription_download_ui_info { optional client_download_ui_data_request download_ui_data = 1; optional bool one_shot = 3 [default = false]; required int64 interval = 4; } message unsubscription_download_ui_info { required int32 id = 1; //ui element id } //subscription type enum SUBSCRIPTION_TYPE { ST_UI_CHANGE = 0; ST_SETTING_CHANGE = 1; ST_DOWNLOAD_STATE_CHANGE = 2; ST_DOWNLOAD_ADDED = 3; ST_DOWNLOAD_DELETED = 4; } enum SUBSCRIPTION_MODE { SM_EVENT = 0; SM_REPEATED = 1; } //download state subscription for download state changes (can be module defined) enum SUBSCRIPTION_DOWNLOAD_STATE { SDS_STARTED = 0; SDS_STOPPED = 1; SDS_DELETED = 2; SDS_COMPLETED = 3; } message subscription_download_state_change { repeated SUBSCRIPTION_DOWNLOAD_STATE states = 1; //list of states on which event should be sent } //information about subscription request message client_event_subscription_request { required SUBSCRIPTION_TYPE type = 1; //type must be set required SUBSCRIPTION_MODE mode = 2; //mode must be set required string module_name = 3; //module name must be set, can be "" for all installed modules supported subscription type optional int64 interval = 4 [default = 5000]; //event fire interval in milliseconds, valid for repeated event mode optional bool one_time = 5 [default = false]; //is event should fire only once ? optional subscription_download_ui_info download_ui_info = 6; optional subscription_download_state_change download_state_change = 7; } //unsubscript from events of specified type //here is two variants of unsubscription //1. can be customized to unsubscript from few aubscriptions at once message client_event_unsubscription_request { required SUBSCRIPTION_TYPE type = 1; //type must be set required string module_name = 2; //module name must be set, can be "" for all installed modules supported subscription type optional unsubscription_download_ui_info ui_info = 3; optional subscription_download_state_change download_state_change = 4; //reusing defined structure to avoid code duplication } //2. unsubscript by id given in "server_event_subscription_reply" message client_event_unsubscription_by_id_request { required int32 subscription_id = 1; } message server_event_subscription_reply { required SUBSCRIPTION_TYPE type = 1; required string module_name = 2; optional subscription_download_ui_info ui_info = 3; required bool status = 1000; optional string status_description = 1001; optional int32 subscription_id = 1002 [default = -1]; } message server_event_unsubscription_reply { required SUBSCRIPTION_TYPE type = 1; required string module_name = 2; optional unsubscription_download_ui_info ui_info = 3; required bool status = 1000; optional string status_description = 1001; optional int32 subscription_id = 1002; }