Manage Plan¶
Control the plan and query its state through the presenter instance.
Overview¶
- Use
IExpoFpPlanPresenter
to send commands and request information from the loaded plan. - All public APIs are available in two forms:
- Coroutine (suspend) functions — recommended.
- Callback functions — for Java or legacy cases.
- Most commands do not return a value. Requests return
ExpoFpResult<T>
.
Step 1. Apply Commands¶
Reload a plan¶
Reload the plan with new or previous settings. If a parameter is null
, the previous value is reused.
presenter.reloadPlan(
planLink = ExpoFpLinkType.ExpoKey("YourExpoKey"),
additionalParams = listOf(URLQueryItem("noOverlay", "true")),
locationProvider = YourLocationProvider(),
messageListener = YourMessageListener()
)
Navigation¶
presenter.activateFloor(floor) // floor: ExpoFpFloor
presenter.findLocation() // show current location if available
presenter.fitBounds() // fit to full plan
Highlight and selection¶
presenter.highlightBooths(listOf("boothExternalId1", "boothExternalId2"))
presenter.highlightExhibitors(listOf("exhibitorExternalId1"))
presenter.selectBooth("BoothNameOrExternalId")
presenter.selectCategory("CategoryName")
presenter.selectExhibitor("ExhibitorNameOrExternalId")
val position = ExpoFpPosition(x = 8490.0, y = 8188.0)
presenter.selectCurrentPosition(position, focus = true)
Routing¶
Use ExpoFpRouteWaypoint
to describe waypoints.
val route = listOf(
ExpoFpRouteWaypoint.Position(ExpoFpPosition(x = 8490.0, y = 8188.0)),
ExpoFpRouteWaypoint.Position(ExpoFpPosition(x = 8515.0, y = 8188.0))
)
presenter.selectRoute(waypoints = route, onlyAccessible = true)
Bookmarks¶
presenter.setBookmarks(
listOf(
ExpoFpBookmark(
name = "BioCycle Africa",
externalId = "RXhoaWJpdG9yXzE4OTc5NDQ=",
isBookmarked = true
)
)
)
UI controls¶
presenter.setElementsVisibility(
ExpoFpElementsVisibility(
controls = false,
levels = false,
header = false,
overlay = false
)
)
presenter.switchView() // toggle 2D/3D
presenter.zoomIn()
presenter.zoomOut()
Step 2. Request Information¶
All requests return ExpoFpResult<T>
.
val booths: ExpoFpResult<List<ExpoFpBooth>> = presenter.boothsList()
val categories: ExpoFpResult<List<ExpoFpCategory>> = presenter.categoriesList()
val exhibitors: ExpoFpResult<List<ExpoFpExhibitor>> = presenter.exhibitorsList()
val visibility: ExpoFpResult<ExpoFpElementsVisibility> = presenter.getElementsVisibility()
val floors: ExpoFpResult<List<ExpoFpFloor>> = presenter.getFloors()
val optimized: ExpoFpResult<List<ExpoFpRouteInfo>> =
presenter.getOptimizedRoutes(
waypoints = listOf(
ExpoFpRouteWaypoint.Position(ExpoFpPosition(x = 8490.0, y = 8188.0)),
ExpoFpRouteWaypoint.Position(ExpoFpPosition(x = 8515.0, y = 8188.0))
)
)
val search: ExpoFpResult<List<ExpoFpSearchModel>> = presenter.search("coffee")
Step 3. Callback Alternatives¶
All requests are also available as callback variants:
presenter.boothsList { result -> /* ... */ }
presenter.categoriesList { result -> /* ... */ }
presenter.exhibitorsList { result -> /* ... */ }
presenter.getElementsVisibility { result -> /* ... */ }
presenter.getFloors { result -> /* ... */ }
presenter.getOptimizedRoutes(route) { result -> /* ... */ }
presenter.search("coffee") { result -> /* ... */ }
Recommended: Prefer coroutine APIs for cleaner cancellation, lifecycle scoping, and easier composition.
Step 4. Debug Helpers¶
For development, you may run arbitrary JS in the plan:
val evalResult: ExpoFpResult<Any?> =
presenter.evaluateCustomScript("console.log('ping')")
Enable debug mode before loading/reloading the plan:
ExpoFpPlan.isDebugModeEnabled = true
Debug mode may slow down initialization. Use it only in debug builds.
Best Practices¶
- Prefer coroutines: cleaner and safer lifecycle integration.
- Check results: always handle both
success
anderror
inExpoFpResult<T>
. - Be null-aware: some responses may be
null
(e.g., direction reset). - Group UI changes: avoid calling multiple UI-affecting commands in very short intervals.
- Debug mode: enable only during development or troubleshooting.