AWS IoT FleetWise 不再向新客戶開放。現有的 AWS IoT FleetWise 客戶可以繼續使用 服務。上的連線行動性指南 AWS
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
使用 MQTT 訊息處理上次已知狀態車輛資料
重要
對特定 AWS IoT FleetWise 功能的存取目前受到鎖定。如需詳細資訊,請參閱AWS AWS IoT FleetWise 中的區域和功能可用性。
若要從您的車輛接收更新並處理其資料,請訂閱下列 MQTT 主題。如需詳細資訊,請參閱《 開發人員指南》中的 MQTT 主題。 AWS IoT Core
$aws/iotfleetwise/vehicles/$vehicle_name/last_known_state/$state_template_name/data
上一個已知狀態訊號更新訊息可能未依順序接收,因為 MQTT 不保證排序。使用 MQTT 接收和處理車輛資料的任何用戶端都必須處理此問題。上次已知狀態訊號更新訊息遵循 MQTT 5 訊息通訊協定。
每個 MQTT 訊息的訊息標頭具有下列使用者屬性:
此外,您可以在更新或建立狀態範本時指定metadataExtraDimensions請求參數,以指定要包含在 MQTT 訊息標頭中的車輛屬性。(請參閱狀態範本。)
MQTT 訊息標頭中的使用者屬性有助於將訊息路由到不同的目的地,而無需檢查承載。
MQTT 訊息承載包含從車輛收集的資料。您可以在建立或更新狀態範本時指定extraDimensions請求參數,以指定要包含在 MQTT 訊息承載中的車輛屬性 (請參閱 建立 an AWS IoT FleetWise 狀態範本)。額外維度會透過將額外維度與車輛建立關聯,來豐富從車輛收集的資料。
MQTT 訊息承載是通訊協定緩衝區 (Protobuf) 編碼,MQTT 訊息標頭包含定義為 application/octet-stream 的內容類型指標。Protobuf 編碼結構描述如下所示:
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 syntax = "proto3"; option java_package = "com.amazonaws.iot.autobahn.schemas.lastknownstate"; package Aws.IoTFleetWise.Schemas.CustomerMessage; message LastKnownState { /* * The absolute timestamp in milliseconds since Unix Epoch of when the event was triggered in vehicle. */ uint64 time_ms = 1; /* * This field is deprecated, use signals instead */ repeated Signal signal = 2 [ deprecated = true ]; repeated Signal signals = 3; repeated ExtraDimension extra_dimensions = 4; } message Signal { /* * The Fully Qualified Name of the signal is the path to the signal plus the signal's name. * For example, Vehicle.Chassis.SteeringWheel.HandsOff.HandsOffSteeringState * The fully qualified name can have up to 150 characters. Valid characters: a-z, A-Z, 0-9, : (colon), and _ (underscore). */ string name = 1; /* * The FWE reported signal value can be one of the following data types. */ oneof SignalValue { double double_value = 2; bool boolean_value = 3; sint32 int8_value = 4; uint32 uint8_value = 5; sint32 int16_value = 6; uint32 uint16_value = 7; sint32 int32_value = 8; uint32 uint32_value = 9; sint64 int64_value = 10; uint64 uint64_value = 11; float float_value = 12; /* * An UTF-8 encoded or 7-bit ASCII string */ string string_value = 13; } } message ExtraDimension { /* * The Fully Qualified Name of the attribute is the path to the attribute plus the attribute's name. * For example, Vehicle.Model.Color * The fully qualified name can have up to 150 characters. Valid characters: a-z, A-Z, 0-9, : (colon), and _ (underscore). */ string name = 1; oneof ExtraDimensionValue { /* * An UTF-8 encoded or 7-bit ASCII string */ string string_value = 2; } }
其中:
-
time_ms:在車輛中觸發事件時的絕對時間戳記 (自 Unix Epoch 起以毫秒為單位)。Edge Agent 軟體會針對此時間戳記,在車輛的時鐘上使用 。
-
signal:Signal包含訊號資訊的 陣列:name(字串)signalValue和 支援下列資料類型 -double、bool、int8、uint8、int16、uint16、int32uint32int64、、uint64、float、、string、。 -
extra_dimensions:ExtraDimensions包含車輛屬性資訊的 陣列:name(字串)extraDimensionValue,目前僅支援string資料類型。