From ab5da3422543c4574b7b1e66c50db4f33c161b27 Mon Sep 17 00:00:00 2001 From: Chumva Date: Sat, 20 Apr 2019 12:36:04 +0300 Subject: [PATCH] Update tracker aidl methods --- .../net/osmand/aidl/IOsmAndAidlCallback.aidl | 27 +- .../net/osmand/aidl/IOsmAndAidlInterface.aidl | 527 +++++++++++++++++- .../osmand/aidl/copyfile/CopyFileParams.aidl | 3 + .../osmand/aidl/copyfile/CopyFileParams.java | 78 +++ .../src/net/osmand/aidl/gpx/AGpxBitmap.java | 4 - .../net/osmand/aidl/gpx/ASelectedGpxFile.java | 42 +- .../net/osmand/aidl/maplayer/AMapLayer.java | 4 + .../osmand/aidl/maplayer/point/AMapPoint.java | 3 +- .../aidl/navigation/ADirectionInfo.aidl | 3 + .../aidl/navigation/ADirectionInfo.java | 73 +++ .../navigation/ANavigationUpdateParams.aidl | 4 + .../navigation/ANavigationUpdateParams.java | 57 ++ .../aidl/navigation/NavigateSearchParams.java | 20 +- .../net/osmand/aidl/search/SearchParams.java | 14 +- .../telegram/helpers/OsmandAidlHelper.kt | 8 +- 15 files changed, 844 insertions(+), 23 deletions(-) create mode 100644 OsmAnd-telegram/src/net/osmand/aidl/copyfile/CopyFileParams.aidl create mode 100644 OsmAnd-telegram/src/net/osmand/aidl/copyfile/CopyFileParams.java create mode 100644 OsmAnd-telegram/src/net/osmand/aidl/navigation/ADirectionInfo.aidl create mode 100644 OsmAnd-telegram/src/net/osmand/aidl/navigation/ADirectionInfo.java create mode 100644 OsmAnd-telegram/src/net/osmand/aidl/navigation/ANavigationUpdateParams.aidl create mode 100644 OsmAnd-telegram/src/net/osmand/aidl/navigation/ANavigationUpdateParams.java diff --git a/OsmAnd-telegram/src/net/osmand/aidl/IOsmAndAidlCallback.aidl b/OsmAnd-telegram/src/net/osmand/aidl/IOsmAndAidlCallback.aidl index 6f0cb8f65b..87f6de79c4 100644 --- a/OsmAnd-telegram/src/net/osmand/aidl/IOsmAndAidlCallback.aidl +++ b/OsmAnd-telegram/src/net/osmand/aidl/IOsmAndAidlCallback.aidl @@ -2,13 +2,38 @@ package net.osmand.aidl; import net.osmand.aidl.search.SearchResult; import net.osmand.aidl.gpx.AGpxBitmap; +import net.osmand.aidl.navigation.ADirectionInfo; interface IOsmAndAidlCallback { + + /** + * Callback for search requests. + * + * @return resultSet - set of SearchResult + */ void onSearchComplete(in List resultSet); - + + /** + * Callback for {@link IOsmAndAidlInterface} registerForUpdates() method. + */ void onUpdate(); + /** + * Callback for {@link IOsmAndAidlInterface} registerForOsmandInitListener() method. + */ void onAppInitialized(); + /** + * Callback for {@link IOsmAndAidlInterface} getBitmapForGpx() method. + * + * @return bitmap - snapshot image of gpx track on map + */ void onGpxBitmapCreated(in AGpxBitmap bitmap); + + /** + * Callback for {@link IOsmAndAidlInterface} registerForNavigationUpdates() method. + * + * @return directionInfo - update on distance to next turn and turns type. + */ + void updateNavigationInfo(in ADirectionInfo directionInfo); } \ No newline at end of file diff --git a/OsmAnd-telegram/src/net/osmand/aidl/IOsmAndAidlInterface.aidl b/OsmAnd-telegram/src/net/osmand/aidl/IOsmAndAidlInterface.aidl index 59fd213ab6..1ac8569bfc 100644 --- a/OsmAnd-telegram/src/net/osmand/aidl/IOsmAndAidlInterface.aidl +++ b/OsmAnd-telegram/src/net/osmand/aidl/IOsmAndAidlInterface.aidl @@ -54,7 +54,6 @@ import net.osmand.aidl.gpx.RemoveGpxParams; import net.osmand.aidl.maplayer.point.ShowMapPointParams; import net.osmand.aidl.navdrawer.SetNavDrawerItemsParams; - import net.osmand.aidl.navdrawer.NavDrawerFooterParams; import net.osmand.aidl.navdrawer.NavDrawerHeaderParams; @@ -76,104 +75,620 @@ import net.osmand.aidl.customization.OsmandSettingsParams; import net.osmand.aidl.gpx.AGpxFile; import net.osmand.aidl.gpx.AGpxFileDetails; import net.osmand.aidl.gpx.CreateGpxBitmapParams; + import net.osmand.aidl.tiles.ASqliteDbFile; import net.osmand.aidl.plugins.PluginParams; +import net.osmand.aidl.copyfile.CopyFileParams; + +import net.osmand.aidl.navigation.ANavigationUpdateParams; + // NOTE: Add new methods at the end of file!!! interface IOsmAndAidlInterface { + /** + * Add map marker at given location. + * + * @param lat (double) - latitude. + * @param lon (double) - longitude. + * @param name (String)- name of marker. + */ boolean addMapMarker(in AddMapMarkerParams params); + + /** + * Add map marker at given location. + * + * @param lat (double) - latitude. + * @param lon (double) - longitude. + * @param name (String)- name of marker. + */ boolean removeMapMarker(in RemoveMapMarkerParams params); + + /** + * Update map marker at given location with name. + * + * @param latPrev (double) - latitude (current marker). + * @param lonPrev (double) - longitude (current marker). + * @param namePrev (String) - name (current marker). + * @param latNew (double) - latitude (new marker). + * @param lonNew (double) - longitude (new marker). + * @param nameNew (String) - name (new marker). + */ boolean updateMapMarker(in UpdateMapMarkerParams params); + /** + * Add map widget to the right side of the main screen. + * Note: any specified icon should exist in OsmAnd app resources. + * + * @param id (String) - widget id. + * @param menuIconName (String) - icon name (configure map menu). + * @param menuTitle (String) - widget name (configure map menu). + * @param lightIconName (String) - icon name for the light theme (widget). + * @param darkIconName (String) - icon name for the dark theme (widget). + * @param text (String) - main widget text. + * @param description (String) - sub text, like "km/h". + * @param order (int) - order position in the widgets list. + * @param intentOnClick (String) - onClick intent. Called after click on widget as startActivity(Intent intent). + */ boolean addMapWidget(in AddMapWidgetParams params); + + /** + * Remove map widget. + * + * @param (String) id - widget id. + */ boolean removeMapWidget(in RemoveMapWidgetParams params); + + /** + * Update map widget. + * Note: any specified icon should exist in OsmAnd app resources. + * + * @param id (String) - widget id. + * @param menuIconName (String) - icon name (configure map menu). + * @param menuTitle (String) - widget name (configure map menu). + * @param lightIconName (String) - icon name for the light theme (widget). + * @param darkIconName (String) - icon name for the dark theme (widget). + * @param text (String) - main widget text. + * @param description (String) - sub text, like "km/h". + * @param order (int) - order position in the widgets list. + * @param intentOnClick (String) - onClick intent. Called after click on widget as startActivity(Intent intent). + */ boolean updateMapWidget(in UpdateMapWidgetParams params); + /** + * Add point to user layer. + * + * @param layerId (String) - layer id. Note: layer should be added first. + * @param pointId (String) - point id. + * @param shortName (String) - short name (single char). Displayed on the map. + * @param fullName (String) - full name. Displayed in the context menu on first row. + * @param typeName (String) - type name. Displayed in context menu on second row. + * @param color (int) - color of circle's background. + * @param location (ALatLon) - location of the point. + * @param details (List)- list of details. Displayed under context menu. + * @param params (Map) - optional map of params for point. + */ boolean addMapPoint(in AddMapPointParams params); + + + /** + * Remove point. + * + * @param layerId (String) - layer id. + * @param pointId (String) - point id. + */ boolean removeMapPoint(in RemoveMapPointParams params); + + /** + * Update point. + * + * @param layerId (String) - layer id. + * @param pointId (String) - point id. + * @param shortName (String) - short name (single char). Displayed on the map. + * @param fullName (String) - full name. Displayed in the context menu on first row. + * @param typeName (String) - type name. Displayed in context menu on second row. + * @param color (String) - color of circle's background. + * @param location (ALatLon)- location of the point. + * @param details (List) - list of details. Displayed under context menu. + * @param params (Map) - optional map of params for point. + */ boolean updateMapPoint(in UpdateMapPointParams params); + /** + * Add user layer on the map. + * + * @param id (String) - layer id. + * @param name (String) - layer name. + * @param zOrder (float) - z-order position of layer. Default value is 5.5f + * @param points Map - initial list of points. Nullable. + * @param imagePoints (boolean) - use new style for points on map or not. Also default zoom bounds for new style can be edited. + */ boolean addMapLayer(in AddMapLayerParams params); + + /** + * Remove user layer. + * + * @param id (String) - layer id. + */ boolean removeMapLayer(in RemoveMapLayerParams params); + + /** + * Update user layer. + * + * @param id (String) - layer id. + * @param name (String) - layer name. + * @param zOrder (float) - z-order position of layer. Default value is 5.5f + * @param points Map - list of points. Nullable. + * @param imagePoints (boolean) - use new style for points on map or not. Also default zoom bounds for new style can be edited. + */ boolean updateMapLayer(in UpdateMapLayerParams params); - boolean importGpx(in ImportGpxParams params); - boolean showGpx(in ShowGpxParams params); - boolean hideGpx(in HideGpxParams params); - boolean getActiveGpx(out List files); + /** + * Import GPX file to OsmAnd (from URI or file). + * + * @param gpxUri (Uri) - URI created by FileProvider (preferable method). + * @param file (File) - File which represents GPX track (not recomended, OsmAnd should have rights to access file location). + * @param fileName (String) - Destination file name. May contain dirs. + * @param color (String) - color of gpx. Can be one of: "red", "orange", "lightblue", "blue", "purple", + * "translucent_red", "translucent_orange", "translucent_lightblue", + * "translucent_blue", "translucent_purple" + * @param show (boolean) - show track on the map after import + */ + boolean importGpx(in ImportGpxParams params); + + /** + * Show GPX file on map. + * + * @param fileName (String) - file name to show. Must be imported first. + */ + boolean showGpx(in ShowGpxParams params); + + /** + * Hide GPX file. + * + * @param fileName (String) - file name to hide. + */ + boolean hideGpx(in HideGpxParams params); + + /** + * Get list of active GPX files. + * + * @return list of active gpx files. + */ + boolean getActiveGpx(out List files); + + /** + * Set map view to current location. + * + * @param latitude (double) - latitude of new map center. + * @param longitude (double) - longitude of new map center. + * @param zoom (float) - map zoom level. Set 0 to keep zoom unchanged. + * @param animated (boolean) - set true to animate changes. + */ + boolean setMapLocation(in SetMapLocationParams params); + - boolean setMapLocation(in SetMapLocationParams params); boolean calculateRoute(in CalculateRouteParams params); + /** + * Refresh the map (UI) + */ boolean refreshMap(); + /** + * Add favorite group with given params. + * + * @param name (String) - group name. + * @param color (String) - group color. Can be one of: "red", "orange", "yellow", + * "lightgreen", "green", "lightblue", "blue", "purple", "pink", "brown". + * @param visible (boolean) - group visibility. + */ boolean addFavoriteGroup(in AddFavoriteGroupParams params); + + /** + * Update favorite group with given params. + * + * @param namePrev (String) - group name (current). + * @param colorPrev (String) - group color (current). + * @param visiblePrev (boolean) - group visibility (current). + * @param nameNew (String) - group name (new). + * @param colorNew (String) - group color (new). + * @param visibleNew (boolean) - group visibility (new). + */ boolean removeFavoriteGroup(in RemoveFavoriteGroupParams params); + + /** + * Remove favorite group with given name. + * + * @param name (String) - name of favorite group. + */ boolean updateFavoriteGroup(in UpdateFavoriteGroupParams params); + /** + * Add favorite at given location with given params. + * + * @param lat (double) - latitude. + * @param lon (double) - longitude. + * @param name (String) - name of favorite item. + * @param description (String) - description of favorite item. + * @param category (String) - category of favorite item. + * @param color (String) - color of favorite item. Can be one of: "red", "orange", "yellow", + * "lightgreen", "green", "lightblue", "blue", "purple", "pink", "brown". + * @param visible (boolean) - should favorite item be visible after creation. + */ boolean addFavorite(in AddFavoriteParams params); + + /** + * Update favorite at given location with given params. + * + * @param latPrev (double) - latitude (current favorite). + * @param lonPrev (double) - longitude (current favorite). + * @param namePrev (String) - name of favorite item (current favorite). + * @param categoryPrev (String) - category of favorite item (current favorite). + * @param latNew (double) - latitude (new favorite). + * @param lonNew (double) - longitude (new favorite). + * @param nameNew (String) - name of favorite item (new favorite). + * @param descriptionNew (String) - description of favorite item (new favorite). + * @param categoryNew (String) - category of favorite item (new favorite). Use only to create a new category, + * not to update an existing one. If you want to update an existing category, + * use the {@link #updateFavoriteGroup(String, String, boolean, String, String, boolean)} method. + * @param colorNew (String) - color of new category. Can be one of: "red", "orange", "yellow", + * "lightgreen", "green", "lightblue", "blue", "purple", "pink", "brown". + * @param visibleNew (boolean) - should new category be visible after creation. + */ boolean removeFavorite(in RemoveFavoriteParams params); + + /** + * Remove favorite at given location with given params. + * + * @param lat (double) - latitude. + * @param lon (double) - longitude. + * @param name (String) - name of favorite item. + * @param category (String) - category of favorite item. + */ boolean updateFavorite(in UpdateFavoriteParams params); + /** + * Start gpx recording. + */ boolean startGpxRecording(in StartGpxRecordingParams params); + + /** + * Stop gpx recording. + */ boolean stopGpxRecording(in StopGpxRecordingParams params); + /** + * Take photo note. + * + * @param lat (double) - latutude of photo note. + * @param lon (double) - longitude of photo note. + */ boolean takePhotoNote(in TakePhotoNoteParams params); + + /** + * Start video note recording. + * + * @param lat (double) - latutude of video note point. + * @param lon (double) - longitude of video note point. + */ boolean startVideoRecording(in StartVideoRecordingParams params); + + /** + * Start audio note recording. + * + * @param lat (double) - latutude of audio note point. + * @param lon (double) - longitude of audio note point. + */ boolean startAudioRecording(in StartAudioRecordingParams params); + + /** + * Stop Audio/Video recording. + */ boolean stopRecording(in StopRecordingParams params); + /** + * Start navigation. + * + * @param startName (String) - name of the start point as it displays in OsmAnd's UI. Nullable. + * @param startLat (double) - latitude of the start point. If 0 - current location is used. + * @param startLon (double) - longitude of the start point. If 0 - current location is used. + * @param destName (String) - name of the start point as it displays in OsmAnd's UI. + * @param destLat (double) - latitude of a destination point. + * @param destLon (double) - longitude of a destination point. + * @param profile (String) - One of: "default", "car", "bicycle", "pedestrian", "aircraft", "boat", "hiking", "motorcycle", "truck". Nullable (default). + * @param force (boolean) - ask to stop current navigation if any. False - ask. True - don't ask. + */ boolean navigate(in NavigateParams params); + + /** + * Start navigation using gpx file. User need to grant Uri permission to OsmAnd. + * + * @param gpxUri (Uri) - URI created by FileProvider. + * @param force (boolean) - ask to stop current navigation if any. False - ask. True - don't ask. + */ boolean navigateGpx(in NavigateGpxParams params); + /** + * Remove GPX file. + * + * @param fileName (String) - file name to remove; + */ boolean removeGpx(in RemoveGpxParams params); + + /** + * Show AMapPoint on map in OsmAnd. + * + * @param layerId (String) - layer id. Note: layer should be added first. + * @param pointId (String) - point id. + * @param shortName (String) - short name (single char). Displayed on the map. + * @param fullName (String) - full name. Displayed in the context menu on first row. + * @param typeName (String) - type name. Displayed in context menu on second row. + * @param color (int) - color of circle's background. + * @param location (ALatLon) - location of the point. + * @param details List - list of details. Displayed under context menu. + * @param params Map - optional map of params for point. + */ boolean showMapPoint(in ShowMapPointParams params); + /** + * Method for adding up to 3 items to the OsmAnd navigation drawer. + * + * @param appPackage - current application package. + * @param names - list of names for items. + * @param uris - list of uris for intents. + * @param iconNames - list of icon names for items. + * @param flags - list of flags for intents. Use -1 if no flags needed. + */ boolean setNavDrawerItems(in SetNavDrawerItemsParams params); + /** + * Put navigation on pause. + */ boolean pauseNavigation(in PauseNavigationParams params); + + /** + * Resume navigation if it was paused before. + */ boolean resumeNavigation(in ResumeNavigationParams params); + + /** + * Stop navigation. Removes target / intermediate points and route path from the map. + */ boolean stopNavigation(in StopNavigationParams params); + + + /** + * Mute voice guidance. Stays muted until unmute manually or via the api. + */ boolean muteNavigation(in MuteNavigationParams params); + + /** + * Unmute voice guidance. + */ boolean unmuteNavigation(in UnmuteNavigationParams params); + /** + * Run search for POI / Address. + * + * @param searchQuery (String) - search query string. + * @param searchType (int) - type of search. Values: + * SearchParams.SEARCH_TYPE_ALL - all kind of search + * SearchParams.SEARCH_TYPE_POI - POIs only + * SearchParams.SEARCH_TYPE_ADDRESS - addresses only + * + * @param latitude (double) - latitude of original search location. + * @param longitude (double) - longitude of original search location. + * @param radiusLevel (int) - value from 1 to 7. Default value = 1. + * @param totalLimit (int) - limit of returned search result rows. Default value = -1 (unlimited). + */ boolean search(in SearchParams params, IOsmAndAidlCallback callback); + + /** + * Do search and start navigation. + * + * @param startName (String) - name of the start point as it displays in OsmAnd's UI. Nullable. + * @param startLat (double) - latitude of the start point. If 0 - current location is used. + * @param startLon (double) - longitude of the start point. If 0 - current location is used. + * @param searchQuery (String) - Text of a query for searching a destination point. Sent as URI parameter. + * @param searchLat (double) - original location of search (latitude). Sent as URI parameter. + * @param searchLon (double) - original location of search (longitude). Sent as URI parameter. + * @param profile (String) - one of: "default", "car", "bicycle", "pedestrian", "aircraft", "boat", "hiking", "motorcycle", "truck". Nullable (default). + * @param force (boolean) - ask to stop current navigation if any. False - ask. True - don't ask. + */ boolean navigateSearch(in NavigateSearchParams params); + /** + * Method to register for periodical callbacks from OsmAnd + * + * @param updateTimeMS (long)- period of time in millisecond after which callback is triggered + * @param callback (IOsmAndCallback)- create and provide instance of {@link IOsmAndAidlCallback} interface + * @return id (long) - id of callback in OsmAnd. Needed to unsubscribe from updates. + */ long registerForUpdates(in long updateTimeMS, IOsmAndAidlCallback callback); + + /** + * Method to unregister from periodical callbacks from OsmAnd + * + * @param callbackId (long)- id of registered callback (provided by OsmAnd + * in {@link OsmAndAidlHelper#registerForUpdates(long, IOsmAndAidlCallback)}) + */ boolean unregisterFromUpdates(in long callbackId); + /** + * Method for adding image to the top of Osmand's NavDrawer. + * + * @param imageUri (String)- image's URI.toString + * + * @deprecated + * Use the {@link #setNavDrawerLogoWithParams(NavDrawerHeaderParams params)} method. + */ boolean setNavDrawerLogo(in String imageUri); + /** + * Method for selected UI elements (like QuickSearch button) to show. + * + * @param ids (List)- list of menu items keys from {@link OsmAndCustomizationConstants} + */ boolean setEnabledIds(in List ids); + + /** + * Method for selected UI elements (like QuickSearch button) to hide. + * + * @param ids (List)- list of menu items keys from {@link OsmAndCustomizationConstants} + */ boolean setDisabledIds(in List ids); + + /** + * Method to show selected NavDrawer's menu items. + * + * @param patterns (List) - list of menu items names from {@link OsmAndCustomizationConstants} + */ boolean setEnabledPatterns(in List patterns); + + /** + * Method to hide selected NavDrawer's menu items. + * + * @param patterns (List)- list of menu items names from {@link OsmAndCustomizationConstants} + */ boolean setDisabledPatterns(in List patterns); + /** + * Register OsmAnd widgets for visibility. + * + * @param widgetKey ()- widget id. + * @param appModKeys - list of OsmAnd Application modes widget active with. Could be "null" for all modes. + */ boolean regWidgetVisibility(in SetWidgetsParams params); + + /** + * Register OsmAnd widgets for availability. + * + * @param widgetKey (String) - widget id. + * @param appModKeys (List)- ist of OsmAnd Application modes widget active with. Could be "null" for all modes. + */ boolean regWidgetAvailability(in SetWidgetsParams params); + /** + * Add custom parameters for OsmAnd settings to associate with client app. + * + * @param sharedPreferencesName (String)- string with name of clint's app for shared preferences key + * @param bundle (Bundle)- bundle with keys from Settings IDs {@link OsmAndCustomizationConstants} and Settings params + */ boolean customizeOsmandSettings(in OsmandSettingsParams params); + /** + * Method to get list of gpx files currently registered (imported or created) in OsmAnd; + * + * @return list of gpx files + */ boolean getImportedGpx(out List files); + /** + * Method to get list of sqlitedb files registered in OsmAnd; + * + * @return list of sqlitedb files + */ boolean getSqliteDbFiles(out List files); + + /** + * Method to get list of currently active sqlitedb files + * + * @return list of sqlitedb files + */ boolean getActiveSqliteDbFiles(out List files); + + /** + * Method to show selected sqlitedb file as map overlay. + * + * @param fileName (String) - name of sqlitedb file + */ boolean showSqliteDbFile(String fileName); + + /** + * Method to hide sqlitedb file from map overlay. + * + * @param fileName (String) - name of sqlitedb file + */ boolean hideSqliteDbFile(String fileName); + /** + * Method for adding image to the top of OsmAnd's NavDrawer with additional params + * + * @param imageUri (String) - image's URI.toString + * @param packageName (String) - client's app package name + * @param intent (String) - intent for additional functionality on image click + * + */ boolean setNavDrawerLogoWithParams(in NavDrawerHeaderParams params); + + /** + * Method for adding functionality to "Powered by Osmand" logo in NavDrawer's footer + * (reset OsmAnd settings to pre-clinet app's state) + * + * @param packageName (String) - package name + * @param intent (String) - intent + * @param appName (String) - client's app name + */ boolean setNavDrawerFooterWithParams(in NavDrawerFooterParams params); + /** + * Restore default (pre-client) OsmAnd settings and state: + * clears features, widgets and settings customization, NavDraw logo. + */ boolean restoreOsmand(); + /** + * Method to change state of plug-ins in OsmAnd. + * + * @param pluginId (String) - id (name) of plugin. + * @param newState (int) - new state (0 - off, 1 - on). + */ boolean changePluginState(in PluginParams params); + /** + * Method to register for callback on OsmAnd initialization + * @param callback (IOsmAndAidlCallback) - create and provide instance of {@link IOsmAndAidlCallback} interface + */ boolean registerForOsmandInitListener(in IOsmAndAidlCallback callback); + /** + * Requests bitmap snap-shot of map with GPX file from provided URI in its center. + * You can set bitmap size, density and GPX lines color, but you need + * to manually download appropriate map in OsmAnd or background will be empty. + * Bitmap will be returned through callback {@link IOsmAndAidlCallback#onGpxBitmapCreated(AGpxBitmap)} + * + * @param gpxUri (Uri/File) - Uri for gpx file + * @param density (float) - image density. Recommended to use default metrics for device's display. + * @param widthPixels (int) - width of bitmap + * @param heightPixels (int) - height of bitmap + * @param color (int) - color in ARGB format + * @param callback (IOsmAndAidlCallback) - instance of callback from OsmAnd. + */ boolean getBitmapForGpx(in CreateGpxBitmapParams file, IOsmAndAidlCallback callback); + + /** + * Method to copy files to OsmAnd part by part. For now supports only sqlitedb format. + * Part size (bytearray) should not exceed 256k. + * + * @param fileName (String) - name of file + * @param filePartData (byte[]) - parts of file, byte[] with size 256k or less. + * @param startTime (long) - timestamp of copying start. + * @param isDone (boolean) - boolean to mark end of copying. + * @return number of last successfully received file part or error(-1). + */ + int copyFile(in CopyFileParams filePart); + + + /** + * Method to register for updates during navgation. Notifies user about distance to the next turn and its type. + * + * @params subscribeToUpdates (boolean) - boolean flag to subscribe or unsubscribe from updates + * @params callbackId (long) - id of callback, needed to unsubscribe from updates + * @params callback (IOsmAndAidlCallback) - callback to notify user on navigation data change + */ + long registerForNavigationUpdates(in ANavigationUpdateParams params, IOsmAndAidlCallback callback); } \ No newline at end of file diff --git a/OsmAnd-telegram/src/net/osmand/aidl/copyfile/CopyFileParams.aidl b/OsmAnd-telegram/src/net/osmand/aidl/copyfile/CopyFileParams.aidl new file mode 100644 index 0000000000..a786325e98 --- /dev/null +++ b/OsmAnd-telegram/src/net/osmand/aidl/copyfile/CopyFileParams.aidl @@ -0,0 +1,3 @@ +package net.osmand.aidl.copyfile; + +parcelable CopyFileParams; diff --git a/OsmAnd-telegram/src/net/osmand/aidl/copyfile/CopyFileParams.java b/OsmAnd-telegram/src/net/osmand/aidl/copyfile/CopyFileParams.java new file mode 100644 index 0000000000..e795d5b7b7 --- /dev/null +++ b/OsmAnd-telegram/src/net/osmand/aidl/copyfile/CopyFileParams.java @@ -0,0 +1,78 @@ +package net.osmand.aidl.copyfile; + +import android.os.Parcel; +import android.os.Parcelable; +import android.support.annotation.NonNull; + +public class CopyFileParams implements Parcelable { + private String fileName; + private byte[] filePartData; + private long startTime; + private boolean done; + + public CopyFileParams(@NonNull String fileName, @NonNull byte[] filePartData, long startTime, boolean done) { + this.fileName = fileName; + this.filePartData = filePartData; + this.startTime = startTime; + this.done = done; + } + + public String getFileName() { + return fileName; + } + + public byte[] getFilePartData() { + return filePartData; + } + + public boolean isDone() { + return done; + } + + public long getStartTime() { + return startTime; + } + + protected CopyFileParams(Parcel in) { + fileName = in.readString(); + filePartData = in.createByteArray(); + startTime = in.readLong(); + done = in.readByte() == 0; + } + + public static final Creator CREATOR = new Creator() { + @Override + public CopyFileParams createFromParcel(Parcel in) { + return new CopyFileParams(in); + } + + @Override + public CopyFileParams[] newArray(int size) { + return new CopyFileParams[size]; + } + }; + + + @Override + public int describeContents() { + return 0; + } + + @Override + public String toString() { + return "CopyFileParams {" + + " fileName=" + fileName + + ", filePartData size=" + filePartData.length + + ", startTime=" + startTime + + ", done=" + done + + " }"; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeString(fileName); + dest.writeByteArray(filePartData); + dest.writeLong(startTime); + dest.writeByte((byte) (done ? 0 : 1)); + } +} diff --git a/OsmAnd-telegram/src/net/osmand/aidl/gpx/AGpxBitmap.java b/OsmAnd-telegram/src/net/osmand/aidl/gpx/AGpxBitmap.java index 2f423e126e..f4bdef433d 100644 --- a/OsmAnd-telegram/src/net/osmand/aidl/gpx/AGpxBitmap.java +++ b/OsmAnd-telegram/src/net/osmand/aidl/gpx/AGpxBitmap.java @@ -21,10 +21,6 @@ public class AGpxBitmap implements Parcelable { return bitmap; } - public void setBitmap(Bitmap bitmap) { - this.bitmap = bitmap; - } - public static final Creator CREATOR = new Creator() { public AGpxBitmap createFromParcel(Parcel in) { diff --git a/OsmAnd-telegram/src/net/osmand/aidl/gpx/ASelectedGpxFile.java b/OsmAnd-telegram/src/net/osmand/aidl/gpx/ASelectedGpxFile.java index 54d51bf882..6ffc6e2a70 100644 --- a/OsmAnd-telegram/src/net/osmand/aidl/gpx/ASelectedGpxFile.java +++ b/OsmAnd-telegram/src/net/osmand/aidl/gpx/ASelectedGpxFile.java @@ -2,15 +2,27 @@ package net.osmand.aidl.gpx; import android.os.Parcel; import android.os.Parcelable; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; public class ASelectedGpxFile implements Parcelable { private String fileName; + private long modifiedTime; + private long fileSize; + private AGpxFileDetails details; - public ASelectedGpxFile(String fileName) { + public ASelectedGpxFile(@NonNull String fileName) { this.fileName = fileName; } + public ASelectedGpxFile(@NonNull String fileName, long modifiedTime, long fileSize, @Nullable AGpxFileDetails details) { + this.fileName = fileName; + this.modifiedTime = modifiedTime; + this.fileSize = fileSize; + this.details = details; + } + public ASelectedGpxFile(Parcel in) { readFromParcel(in); } @@ -30,12 +42,40 @@ public class ASelectedGpxFile implements Parcelable { return fileName; } + public long getModifiedTime() { + return modifiedTime; + } + + public long getFileSize() { + return fileSize; + } + + public AGpxFileDetails getDetails() { + return details; + } + public void writeToParcel(Parcel out, int flags) { out.writeString(fileName); + out.writeLong(modifiedTime); + out.writeLong(fileSize); + + out.writeByte((byte) (details != null ? 1 : 0)); + if (details != null) { + out.writeParcelable(details, flags); + } } private void readFromParcel(Parcel in) { fileName = in.readString(); + modifiedTime = in.readLong(); + fileSize = in.readLong(); + + boolean hasDetails= in.readByte() != 0; + if (hasDetails) { + details = in.readParcelable(AGpxFileDetails.class.getClassLoader()); + } else { + details = null; + } } public int describeContents() { diff --git a/OsmAnd-telegram/src/net/osmand/aidl/maplayer/AMapLayer.java b/OsmAnd-telegram/src/net/osmand/aidl/maplayer/AMapLayer.java index 8ab1b0ee26..f1c982fa3c 100644 --- a/OsmAnd-telegram/src/net/osmand/aidl/maplayer/AMapLayer.java +++ b/OsmAnd-telegram/src/net/osmand/aidl/maplayer/AMapLayer.java @@ -66,6 +66,10 @@ public class AMapLayer implements Parcelable { return new ArrayList<>(points.values()); } + public AMapPoint getPoint(String pointId) { + return points.get(pointId); + } + public boolean hasPoint(String pointId) { return points.containsKey(pointId); } diff --git a/OsmAnd-telegram/src/net/osmand/aidl/maplayer/point/AMapPoint.java b/OsmAnd-telegram/src/net/osmand/aidl/maplayer/point/AMapPoint.java index cda77501c5..b61ec928c7 100644 --- a/OsmAnd-telegram/src/net/osmand/aidl/maplayer/point/AMapPoint.java +++ b/OsmAnd-telegram/src/net/osmand/aidl/maplayer/point/AMapPoint.java @@ -11,8 +11,9 @@ import java.util.List; import java.util.Map; public class AMapPoint implements Parcelable { - public static final int POINT_IMAGE_SIZE_PX = 160; public static final String POINT_IMAGE_URI_PARAM = "point_image_uri_param"; + public static final String POINT_SPEED_PARAM = "point_speed_param"; + public static final String POINT_TYPE_ICON_NAME_PARAM = "point_type_icon_name_param"; public static final String POINT_STALE_LOC_PARAM = "point_stale_loc_param"; private String id; diff --git a/OsmAnd-telegram/src/net/osmand/aidl/navigation/ADirectionInfo.aidl b/OsmAnd-telegram/src/net/osmand/aidl/navigation/ADirectionInfo.aidl new file mode 100644 index 0000000000..b0793d6e1a --- /dev/null +++ b/OsmAnd-telegram/src/net/osmand/aidl/navigation/ADirectionInfo.aidl @@ -0,0 +1,3 @@ +package net.osmand.aidl.navigation; + +parcelable ADirectionInfo; diff --git a/OsmAnd-telegram/src/net/osmand/aidl/navigation/ADirectionInfo.java b/OsmAnd-telegram/src/net/osmand/aidl/navigation/ADirectionInfo.java new file mode 100644 index 0000000000..a5e7074f0e --- /dev/null +++ b/OsmAnd-telegram/src/net/osmand/aidl/navigation/ADirectionInfo.java @@ -0,0 +1,73 @@ +package net.osmand.aidl.navigation; + +import android.os.Parcel; +import android.os.Parcelable; + +public class ADirectionInfo implements Parcelable { + + private int distanceTo; //distance to next turn + private int turnType; //turn type + private boolean isLeftSide; //is movement left-sided + + public ADirectionInfo(int distanceTo, int turnType, boolean isLeftSide) { + this.distanceTo = distanceTo; + this.turnType = turnType; + this.isLeftSide = isLeftSide; + } + + protected ADirectionInfo(Parcel in) { + distanceTo = in.readInt(); + turnType = in.readInt(); + isLeftSide = in.readByte() != 0; + } + + public static final Creator CREATOR = new Creator() { + @Override + public ADirectionInfo createFromParcel(Parcel in) { + return new ADirectionInfo(in); + } + + @Override + public ADirectionInfo[] newArray(int size) { + return new ADirectionInfo[size]; + } + }; + + public int getDistanceTo() { + return distanceTo; + } + + public int getTurnType() { + return turnType; + } + + public boolean isLeftSide() { + return isLeftSide; + } + + public void setDistanceTo(int distanceTo) { + this.distanceTo = distanceTo; + } + + public void setTurnType(int turnType) { + this.turnType = turnType; + } + + public void setLeftSide(boolean leftSide) { + isLeftSide = leftSide; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(distanceTo); + dest.writeInt(turnType); + dest.writeByte((byte) (isLeftSide ? 1 : 0)); + } + + +} diff --git a/OsmAnd-telegram/src/net/osmand/aidl/navigation/ANavigationUpdateParams.aidl b/OsmAnd-telegram/src/net/osmand/aidl/navigation/ANavigationUpdateParams.aidl new file mode 100644 index 0000000000..43f370d024 --- /dev/null +++ b/OsmAnd-telegram/src/net/osmand/aidl/navigation/ANavigationUpdateParams.aidl @@ -0,0 +1,4 @@ + +package net.osmand.aidl.navigation; + +parcelable ANavigationUpdateParams; \ No newline at end of file diff --git a/OsmAnd-telegram/src/net/osmand/aidl/navigation/ANavigationUpdateParams.java b/OsmAnd-telegram/src/net/osmand/aidl/navigation/ANavigationUpdateParams.java new file mode 100644 index 0000000000..38c8f5ffe4 --- /dev/null +++ b/OsmAnd-telegram/src/net/osmand/aidl/navigation/ANavigationUpdateParams.java @@ -0,0 +1,57 @@ +package net.osmand.aidl.navigation; + +import android.os.Parcel; +import android.os.Parcelable; + +public class ANavigationUpdateParams implements Parcelable { + + private boolean subscribeToUpdates = true; + private long callbackId = -1L; + + public ANavigationUpdateParams() { + } + + public long getCallbackId() { + return callbackId; + } + + public void setCallbackId(long callbackId) { + this.callbackId = callbackId; + } + + public void setSubscribeToUpdates(boolean subscribeToUpdates) { + this.subscribeToUpdates = subscribeToUpdates; + } + + public boolean isSubscribeToUpdates() { + return subscribeToUpdates; + } + + protected ANavigationUpdateParams(Parcel in) { + callbackId = in.readLong(); + subscribeToUpdates = in.readByte() != 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeLong(callbackId); + dest.writeByte((byte) (subscribeToUpdates ? 1 : 0)); + } + + @Override + public int describeContents() { + return 0; + } + + public static final Creator CREATOR = new Creator() { + @Override + public ANavigationUpdateParams createFromParcel(Parcel in) { + return new ANavigationUpdateParams(in); + } + + @Override + public ANavigationUpdateParams[] newArray(int size) { + return new ANavigationUpdateParams[size]; + } + }; +} diff --git a/OsmAnd-telegram/src/net/osmand/aidl/navigation/NavigateSearchParams.java b/OsmAnd-telegram/src/net/osmand/aidl/navigation/NavigateSearchParams.java index 1c539d08cc..b092bcd4eb 100644 --- a/OsmAnd-telegram/src/net/osmand/aidl/navigation/NavigateSearchParams.java +++ b/OsmAnd-telegram/src/net/osmand/aidl/navigation/NavigateSearchParams.java @@ -9,14 +9,20 @@ public class NavigateSearchParams implements Parcelable { private double startLat; private double startLon; private String searchQuery; + private double searchLat; + private double searchLon; private String profile; private boolean force; - public NavigateSearchParams(String startName, double startLat, double startLon, String searchQuery, String profile, boolean force) { + public NavigateSearchParams(String startName, double startLat, double startLon, + String searchQuery, double searchLat, double searchLon, + String profile, boolean force) { this.startName = startName; this.startLat = startLat; this.startLon = startLon; this.searchQuery = searchQuery; + this.searchLat = searchLat; + this.searchLon = searchLon; this.profile = profile; this.force = force; } @@ -53,6 +59,14 @@ public class NavigateSearchParams implements Parcelable { return searchQuery; } + public double getSearchLat() { + return searchLat; + } + + public double getSearchLon() { + return searchLon; + } + public String getProfile() { return profile; } @@ -69,6 +83,8 @@ public class NavigateSearchParams implements Parcelable { out.writeString(searchQuery); out.writeString(profile); out.writeByte((byte) (force ? 1 : 0)); + out.writeDouble(searchLat); + out.writeDouble(searchLon); } private void readFromParcel(Parcel in) { @@ -78,6 +94,8 @@ public class NavigateSearchParams implements Parcelable { searchQuery = in.readString(); profile = in.readString(); force = in.readByte() != 0; + searchLat = in.readDouble(); + searchLon = in.readDouble(); } @Override diff --git a/OsmAnd-telegram/src/net/osmand/aidl/search/SearchParams.java b/OsmAnd-telegram/src/net/osmand/aidl/search/SearchParams.java index 32447f4b45..303cecb25c 100644 --- a/OsmAnd-telegram/src/net/osmand/aidl/search/SearchParams.java +++ b/OsmAnd-telegram/src/net/osmand/aidl/search/SearchParams.java @@ -11,15 +11,15 @@ public class SearchParams implements Parcelable { private String searchQuery; private int searchType; - private double latutude; + private double latitude; private double longitude; private int radiusLevel = 1; private int totalLimit = -1; - public SearchParams(String searchQuery, int searchType, double latutude, double longitude, int radiusLevel, int totalLimit) { + public SearchParams(String searchQuery, int searchType, double latitude, double longitude, int radiusLevel, int totalLimit) { this.searchQuery = searchQuery; this.searchType = searchType; - this.latutude = latutude; + this.latitude = latitude; this.longitude = longitude; this.radiusLevel = radiusLevel; this.totalLimit = totalLimit; @@ -49,8 +49,8 @@ public class SearchParams implements Parcelable { return searchType; } - public double getLatutude() { - return latutude; + public double getLatitude() { + return latitude; } public double getLongitude() { @@ -69,7 +69,7 @@ public class SearchParams implements Parcelable { public void writeToParcel(Parcel out, int flags) { out.writeString(searchQuery); out.writeInt(searchType); - out.writeDouble(latutude); + out.writeDouble(latitude); out.writeDouble(longitude); out.writeInt(radiusLevel); out.writeInt(totalLimit); @@ -78,7 +78,7 @@ public class SearchParams implements Parcelable { private void readFromParcel(Parcel in) { searchQuery = in.readString(); searchType = in.readInt(); - latutude = in.readDouble(); + latitude = in.readDouble(); longitude = in.readDouble(); radiusLevel = in.readInt(); totalLimit = in.readInt(); diff --git a/OsmAnd-telegram/src/net/osmand/telegram/helpers/OsmandAidlHelper.kt b/OsmAnd-telegram/src/net/osmand/telegram/helpers/OsmandAidlHelper.kt index 9608affa9e..47576a96c2 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/helpers/OsmandAidlHelper.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/helpers/OsmandAidlHelper.kt @@ -106,6 +106,10 @@ class OsmandAidlHelper(private val app: TelegramApplication) { gpxBitmapCreatedListener!!.onGpxBitmapCreated(bitmap) } } + + override fun updateNavigationInfo(directionInfo: ADirectionInfo?) { + + } } fun setSearchCompleteListener(mSearchCompleteListener: SearchCompleteListener) { @@ -939,10 +943,10 @@ class OsmandAidlHelper(private val app: TelegramApplication) { return false } - fun navigateSearch(startName: String, startLat: Double, startLon: Double, searchQuery: String, profile: String, force: Boolean): Boolean { + fun navigateSearch(startName: String, startLat: Double, startLon: Double, searchQuery: String, searchLat: Double, searchLon: Double, profile: String, force: Boolean): Boolean { if (mIOsmAndAidlInterface != null) { try { - return mIOsmAndAidlInterface!!.navigateSearch(NavigateSearchParams(startName, startLat, startLon, searchQuery, profile, force)) + return mIOsmAndAidlInterface!!.navigateSearch(NavigateSearchParams(startName, startLat, startLon, searchQuery, searchLat, searchLon, profile, force)) } catch (e: RemoteException) { e.printStackTrace() }