פלטפורמת ה-SDV מספקת קבוצה של ממשקי API לשימוש בין חבילות השירות של Diagnostics Manager ו-SDV שסופקו על ידי יצרן הציוד המקורי, וכן כלי עזר ויכולות כלליות של הפלטפורמה לתמיכה בתרחישי שימוש באבחון של יצרן הציוד המקורי. אבחון הוא חיוני למאמצי ה-SDV, לשירותים ולטכנולוגיות לרכב שאנחנו מספקים ליצרני ציוד מקורי (OEM), כי מחסנית האבחון היא רכיב חיוני בכל מערכת הפעלה לרכב.
יצרני ציוד מקורי (OEM) פורסים מופעים של Diagnostics Manager (בדרך כלל אחד לכל ECU או אחד לכל מכונה וירטואלית) כדי לטפל בבקשות מלקוחות אבחון באמצעות תקשורת עם חבילות השירות של SDV במערכת. לשם כך, SDV מספקת קבוצה של ממשקי API סטנדרטיים לאבחון, כלי עזר ותמיכה כללית בפלטפורמה לתרחישי שימוש באבחון OEM. המטרה שלנו היא:
- לאפשר ליצרני ציוד מקורי (OEM) להטמיע את הכלי לניהול אבחון בהתאם לתקן UDS.
- מתן הרשאה ל-Diagnostics Manager להעביר בקשות של בודקים לחבילות שירות SDV.
- לאפשר לחבילות שירותי SDV לחשוף נתוני אבחון באופן אגנוסטי לרכב.
כדי להשיג זאת, SDV מספקת קבוצה של ממשקי API לתקנון האינטראקציות בין חבילות שירות של SDV (שעשויות להיות מסופקות על ידי צדדים שלישיים) לבין ההטמעה של יצרן ה-OEM של חבילת האבחון.
חבילות שירות SDV יכולות לחשוף נתוני אבחון וישויות, להטמיע פונקציונליות של אבחון ולדווח על תקלות ל-Diagnostics Manager.
אנחנו מספקים API סטנדרטי של אבחון בכל פלטפורמת SDV, וכך מפשטים את ההטמעה של חבילות שירותי SDV. כך אין צורך להטמיע מחדש אבחון כדי להריץ אותו בכלי רכב שונים מיצרני OEM שונים.
Diagnostics Services API
SDV Diagnostics API מגדיר את השירותים הבאים, שמתאימים לשירותים ספציפיים של UDS (ISO 14229-1):
-
service AuthenticationService: 0x29 (אימות). הוא מספק ללקוח מנגנון להוכחת הזהות שלו כדי לגשת לנתונים או לשירותים מוגבלים. -
service DataItemService: 0x22 (ReadDataByIdentifier) ו-0x2E (WriteDataByIdentifier). היא מאפשרת קריאה וכתיבה של רכיבי נתונים שמזוהים על ידי מזהי נתונים (DIDs). -
service EcuResetService: 0x11 (ECUReset). הוא מאפשר לבוחן לבקש איפוס של יחידת הבקרה האלקטרונית (ECU). service FileTransferService: 0x34 (RequestDownload), 0x35 (RequestUpload), 0x36 (TransferData), 0x37 (RequestTransferExit), and 0x38 (RequestFileTransfer). הוא מטפל בהתחלה ובעיבוד של הורדות והעלאות של קבצים.-
service IoControlService: 0x2F (InputOutputControlByIdentifier). היא מאפשרת לבודקים חיצוניים לשלוט בקלט ופלט של המערכת למטרות בדיקה. -
service RoutineControlService: 0x31 (RoutineControl). הוא מאפשר לבוחן להתחיל ולסיים שגרות (פונקציות) ספציפיות שהוטמעו על ידי שירותי SDV, ולבקש תוצאות לגביהן. -
service SecurityAccessService: 0x27 (SecurityAccess). הוא מנהל את חילופי הזרעים והמפתחות שנדרשים כדי לפתוח רמות אבטחה ספציפיות.
בנוסף, SDV Diagnostics API מגדיר את service FaultListenerService ו-message Event על סמך Diagnostic Event Manager (מנהל אירועים לאבחון) של AUTOSAR (AUTOSAR_SWS_DiagnosticEventManager), שמאפשר לאפליקציות לדווח על אירועים אבחוניים ועל תקלות.
בנוסף, service DiagnosticsManagerService מגדיר שירות פלטפורמת SDV שמאפשר לשירותים אחרים לשלוח שאילתות לגבי הפרמטרים הנוכחיים של חיבור האבחון (כתובת מקור, כתובת יעד) וסוג הסשן.
מדריך למפתחים בנושא חבילות שירותים
אם אתם מפתחים חבילות שירות, אתם יכולים להגדיר את diagnostics_declaration ואת השרתים הבאים בקובץ .vsidl המתאים:
service_bundle {
name: "<BUNDLE-NAME>"
...
server {
service: "com.sdv.google.diagnostics.data_item.DataItemService"
}
server {
service: "com.sdv.google.diagnostics.routine_control.RoutineControlService"
}
server {
service: "com.sdv.google.diagnostics.io_control.IoControlService"
}
server {
service: "com.sdv.google.diagnostics.fault.FaultListenerService"
}
...
diagnostics_declaration {
data_item {
...
}
routine {
...
}
event {
...
}
io_control {
...
}
}
...
}
ההודעה DiagnosticsDeclaration מוגדרת כך:
package sdv.diagnostics.v1;
message DiagnosticsDeclaration {
// Diagnostics data item declaration.
//
// See com.sdv.google.diagnostics.data_item.DataItemService service.
message DataItem {
// Required. Id of the data item.
string id = 1;
// Required. Fully qualified name of the message that defines a structure of
// the data item.
string message_name = 2;
// Flag that indicates whether the data item is writable by the Diagnostics
// Manager.
//
// Effectively, this indicates whether the call to DataItemService::Write,
// is supported for this data item id.
bool is_writable = 3;
}
// Declaration of diagnostics data for input/output control.
//
// See com.sdv.google.diagnostics.io_control.IoControl service.
message InputOutputControlData {
// Id of the input/output control data.
string id = 1;
// Fully qualified name of the message that defines a structure of the data.
string message_name = 2;
}
// Declaration of diagnostics routine.
//
// See com.sdv.google.diagnostics.routine_control.RoutineControl.
message Routine {
// Information about routine control method.
message Method {
// Fully qualified name of the request message.
string request = 1;
// Fully qualified name of the response message.
string response = 2;
}
// Id of the routine.
string id = 1;
// Information about routine start method.
//
// See com.sdv.google.diagnostics.routine_control.RoutineControl::Start.
Method start = 2;
// Information about routine stop method.
//
// See com.sdv.google.diagnostics.routine_control.RoutineControl::Stop.
Method stop = 3;
// Information about routine result method.
//
// See
// com.sdv.google.diagnostics.routine_control.RoutineControl::RequestResult.
Method result = 4;
}
// Declaration of diagnostics event and corresponding fault listener.
//
// See com.sdv.google.diagnostics.event.Event.
// See com.sdv.google.diagnostics.fault.FaultListener.
message Event {
// Id of the event.
string id = 1;
// Fully qualified message name of the event's extended data message.
string extended_data_message_name = 2;
// Fault status changes which service wants to be notified of.
//
// See com.sdv.google.diagnostics.fault.FaultListener.StatusMask.
uint32 fault_listener_mask = 3;
// User-defined service unit name of a corresponding event publisher.
string service_unit_name = 4;
}
// Diagnostic data items exposed by the service bundle.
repeated DataItem data_item = 1;
// Diagnostic data exposed for input/output control by the service bundle.
repeated InputOutputControlData io_control = 2;
// Diagnostic routines exposed by the service bundle.
repeated Routine routine = 3;
// Diagnostic events sent by the service bundle.
repeated Event event = 4;
}
אם הבלוק שלמעלה (service_bundle שמכיל diagnostics_declaration) מוגדר בקטלוגים, vsidl_rc_generator יוצר את יעדי prebuilt_etc לכל חבילת שירות שמצהירה על השרתים שלמעלה ועל diagnostics_declaration:
prebuilt_etc {
name: "<APEX-NAME>.<BUNDLE-NAME>-diag-config.binpb",
filename: "DiagService-diag-config.binpb",
sub_dir: "vsidl_provider",
src: ":generate_vsidl_files_single_bundle_<APEX-NAME>.<BUNDLE-NAME>{diagnostics-config.binpb}",
installable: false,
}
צריך להוסיף את יעדי ההפניה האלה ל-prebuilts של בלוק ההגדרה המתאים של apex
כפי שמצוין
על ידי בלוק התגובות שנוצר אוטומטית מעל בלוק prebuilt_etc {}:
apex {
name: "<APEX-NAME>",
...
prebuilts: [
...
"<APEX-NAME>.<BUNDLE-NAME>-diag-config.binpb",
...
],
...
}
בנוסף, צריך להוסיף את היעדים האלה בשדה diagnostics_config_path של רשומת sdv_service_bundle_metadata בחבילה בקובץ sdv_service_bundles_manifest.textproto המתאים. בנוסף, צריך לציין מדיניות הרשאות כדי לאפשר תקשורת RPC בין חבילת השירות לבין שירות ניהול האבחון:
sdv_service_bundle_metadata {
name: "<BUNDLE-NAME>"
...
diagnostics_config_path: "etc/vsidl_provider/<BUNDLE-NAME>-diag-config.binpb"
authorization_policy_path: "etc/authz/permissions.textproto"
...
}
ההרשאות בקובץ permissions.textproto צריכות להגדיר את תפקידי הלקוח או השרת. לדוגמה, אם חבילת השירותים מטמיעה פריט של נתוני ניתוח:
server {
service: "com.sdv.google.diagnostics.data_item.DataItemService"
allow_all_channels: true
}
מדריך למפתחים של הפלטפורמה
מפתחי פלטפורמות, יצרני ציוד מקורי (OEM) חייבים להטמיע סוכן של כלי לניהול אבחון
rust_binary יעד:
rust_binary {
name: "<DIAGNOSTICS-AGENT-BINARY-EXECUTABLE-NAME>",
...
product_specific: true,
...
}
בנוסף, בקובצי ה-build צריך להגדיר או לשנות את המשתנה הבא:
SDV_DIAGNOSTICS_AGENT_MODULE := <DIAGNOSTICS-AGENT-BINARY-EXECUTABLE-NAME>
לנוחותכם, אפשר להשתמש בספרייה libsdv_uds_serde_v1 לתרגום בין Proto ל-UDS, ובספרייה VSIDL Provider Library לרפלקציה.
הקובץ של סוכן האבחון .vsidl צריך להכיל את התוכן הבא:
package: "com.sdv.oem.diagnostics"
service_bundle {
name: "DiagnosticsAgent"
server {
service: "com.sdv.google.diagnostics.DiagnosticsManagerService"
}
client {
service: "com.sdv.google.diagnostics.data_item.DataItemService"
}
client {
service: "com.sdv.google.diagnostics.routine_control.RoutineControlService"
}
client {
service: "com.sdv.google.diagnostics.io_control.IoControlService"
}
client {
service: "com.sdv.google.diagnostics.fault.FaultListenerService"
}
client {
service: "com.sdv.google.diagnostics.ecu_reset.EcuResetService"
}
client {
service: "com.sdv.google.diagnostics.security_access.SecurityAccessService"
}
client {
service: "com.sdv.google.diagnostics.authentication.AuthenticationService"
}
client {
service: "com.sdv.google.diagnostics.file_transfer.FileTransferService"
}
}
הסוכן של הכלי לניהול אבחון הוא קובץ הפעלה בינארי, ולכן sdv_service_bundle_metadata של החבילה מוגדר כהצהרה של קובץ הגדרה בלבד:
sdv_service_bundle_metadata {
# This name must match the agent's Bundle Name
name: "DiagnosticsAgent"
version_number: 1
version_name: "1"
# Reference the manifest itself to mark this as a config-only declaration.
native_library_path: "etc/sdv_service_bundles_manifest.textproto"
authorization_policy_path: "etc/authz/permissions.textproto"
}
במדיניות ההרשאות של סוכן האבחון צריך להגדיר את ההרשאות של השירותים שהוא מתקשר איתם. לדוגמה, אם היא קוראת לשירות העברת הקבצים:
client {
service: "com.sdv.google.diagnostics.file_transfer.FileTransferService"
allow_all_channels: true
}