fix: finalize WeatherRuntime host API boundary

This commit is contained in:
OpenAI Codex
2026-09-07 14:10:06 +08:00
parent 01295df4b8
commit 544e4aee3a
8 changed files with 94 additions and 6 deletions

View File

@@ -364,7 +364,7 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
2 -> when (value) { 0.5f -> runtime?.setPlaybackSpeed(WeatherRuntime.PlaybackSpeed.HALF); 1.0f -> runtime?.setPlaybackSpeed(WeatherRuntime.PlaybackSpeed.NORMAL); 2.0f -> runtime?.setPlaybackSpeed(WeatherRuntime.PlaybackSpeed.DOUBLE); else -> null }
else -> null // Existing fixture-only diagnostic commands remain outside the REAL WEATHER Host facade.
}
if (accepted != WeatherRuntime.CommandResult.ACCEPTED && (runtime == null || !maplibreMap.controlRasterArraySourceTimeline(PARTICLE_SOURCE_ID, command, value))) {
if (accepted != WeatherRuntime.CommandResult.ACCEPTED && !realWeatherMode && (runtime == null || !maplibreMap.controlRasterArraySourceTimeline(PARTICLE_SOURCE_ID, command, value))) {
Log.i(TAG, "ParticleTimeline: event=REJECTED command=$command")
} else {
timelineState = when (command) { 0 -> "PLAY"; 1 -> "PAUSE"; 6 -> "WAIT"; 7 -> "INVALID"; 8 -> "PAUSE"; else -> timelineState }
@@ -547,7 +547,7 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
}
}
return runtimeResult == WeatherRuntime.CommandResult.ACCEPTED ||
(runtimeResult == null && maplibreMap.setStyleLayerFloatProperty(PARTICLE_LAYER_ID, property, value))
(!realWeatherMode && runtimeResult == null && maplibreMap.setStyleLayerFloatProperty(PARTICLE_LAYER_ID, property, value))
}
private fun resetVisualDefaults() {
@@ -615,16 +615,16 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
val metadata = assets.open(metadataPath).bufferedReader().use { it.readText() }
val payload = assets.open(payloadPath).use { it.readBytes() }
Log.i(TAG, "ParticleField: event=REAL_WEATHER_DATASET_LOAD index=$index metadata=$metadataPath payloadBytes=${payload.size}")
weatherRuntime?.submitWindField(metadata, payload)?.getCode() ?: MapLibreMap.HOST_FIELD_REJECTED_SOURCE_MODE
weatherRuntime?.submitWindField(metadata, payload) ?: WeatherRuntime.FieldSubmitResult.REJECTED_SOURCE_MODE
} catch (error: Exception) {
Log.e(TAG, "ParticleField: event=REAL_WEATHER_SUBMIT_REJECTED index=$index reason=ASSET_READ_FAILED", error)
MapLibreMap.HOST_FIELD_REJECTED_ADAPTER
WeatherRuntime.FieldSubmitResult.REJECTED_ADAPTER
}
}
timelineState = if (results.size == 4 && results.all { it > 0 }) "READY" else "NOT READY"
timelineState = if (results.size == 4 && results.all { it.accepted() }) "READY" else "NOT READY"
fitRealWeatherBounds()
status.text = statusText()
Log.i(TAG, "ParticleField: event=REAL_WEATHER_INITIAL_WINDOW_READY results=${results.joinToString(",")} timeline=$timelineState")
Log.i(TAG, "ParticleField: event=REAL_WEATHER_INITIAL_WINDOW_READY results=${results.joinToString(",") { it.name }} timeline=$timelineState")
Log.i(TAG, "WeatherColorLayer: event=WEATHER_COLOR_FIELD_READY source=$PARTICLE_SOURCE_ID scale=0..30mps")
Log.i(TAG, "ParticleField: event=REAL_WEATHER_COMPOSITE_READY source=$PARTICLE_SOURCE_ID basemap=GSI failSoft=true color=weather-color particle=raster-particle")
}