diff options
Diffstat (limited to 'protocol/events.proto')
-rw-r--r-- | protocol/events.proto | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/protocol/events.proto b/protocol/events.proto new file mode 100644 index 0000000..f543577 --- /dev/null +++ b/protocol/events.proto @@ -0,0 +1,107 @@ +/* + Copyright © 2015 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 <http://www.gnu.org/licenses/>. + +*/ + +import "ui.proto"; + +//TODO: extended ui updates subscriptions proto part (ui data messages on timer, e.t.c.) + +// event subscription part begin + +//TODO: rework +//TODO: download state chage events + + +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 { + S_UI_CHANGE = 0; + S_SETTING_CHANGE = 1; + S_DOWNLOAD_STATE_CHANGE = 2; + S_DOWNLOAD_ADDED = 3; + S_DOWNLOAD_DELETED = 4; +} + +//download state subscription for download state changes (can be module defined) +enum SUBSCRIPTION_DOWNLOAD_STATE { + S_D_STARTED = 0; + S_D_STOPPED = 1; +} + +message subscription_download_state_change { + repeated SUBSCRIPTION_DOWNLOAD_STATE states = 1; +} + +//information about subscription request +message client_event_subscription_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 subscription_download_ui_info download_ui_info = 3; + optional subscription_download_state_change download_state_change = 4; +} + + +//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; + required string module_name = 2; + 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; +} + +//event subscription part end |