진단

SDV 플랫폼은 OEM 제공 진단 관리자와 SDV 서비스 번들 간에 사용되는 API 집합과 OEM의 진단 사용 사례를 지원하는 유틸리티 및 일반 플랫폼 기능을 제공합니다. 진단 스택은 모든 자동차 운영체제의 필수 구성요소이므로 진단은 SDV 노력, 자동차 서비스, OEM에 제공하는 기술에 필수적입니다.

OEM은 일반적으로 ECU당 하나 또는 VM당 하나인 진단 관리자 인스턴스를 배포하여 시스템의 SDV 서비스 번들과 통신하여 진단 클라이언트의 요청을 처리합니다. 이를 위해 SDV는 OEM 진단 사용 사례를 위한 표준 진단 API, 유틸리티, 전반적인 플랫폼 지원을 제공합니다. Google의 목표는 다음과 같습니다.

  • OEM이 UDS 표준에 따라 진단 관리자를 구현할 수 있도록 지원합니다.
  • 진단 관리자가 테스터 요청을 SDV 서비스 번들에 위임하도록 허용합니다.
  • SDV 서비스 번들이 차량에 구애받지 않는 방식으로 진단 데이터를 노출하도록 허용합니다.

이를 위해 SDV는 SDV 서비스 번들 (서드 파티에서 제공할 수 있음)과 OEM의 진단 스택 구현 간의 상호작용을 표준화하는 API 집합을 제공합니다.

진단 스택

그림 1. 진단 스택.

SDV 서비스 번들은 진단 데이터 및 항목을 노출하고, 진단 기능을 구현하고, 진단 관리자에게 오작동을 보고할 수 있습니다.

표준 SDV 전체 진단 API를 제공하면 SDV 서비스 번들의 구현이 간소화되어 다양한 OEM의 다양한 차량에서 실행하기 위해 진단을 다시 구현할 필요가 없습니다.

진단 서비스 API

SDV 진단 API는 특정 UDS (ISO 14229-1) 서비스에 해당하는 다음 서비스를 정의합니다.

  • service AuthenticationService: 0x29 (인증). 클라이언트가 제한된 데이터 또는 서비스에 액세스하기 위해 ID를 증명하는 메커니즘을 제공합니다.
  • service DataItemService: 0x22 (ReadDataByIdentifier) 및 0x2E (WriteDataByIdentifier). DIDs로 식별된 데이터 요소를 읽고 쓸 수 있습니다.
  • service EcuResetService: 0x11 (ECUReset). 테스터가 ECU 재설정을 요청할 수 있습니다.
  • service FileTransferService: 0x34 (RequestDownload), 0x35 (RequestUpload), 0x36 (TransferData), 0x37 (RequestTransferExit), 0x38 (RequestFileTransfer). 파일 다운로드 및 업로드의 시작과 처리를 처리합니다.
  • service IoControlService: 0x2F (InputOutputControlByIdentifier). 외부 테스터가 테스트 목적으로 시스템의 입력 및 출력을 제어할 수 있습니다.
  • service RoutineControlService: 0x31 (RoutineControl). 테스터가 SDV 서비스에서 구현한 특정 루틴 (함수)의 결과를 시작, 중지, 요청할 수 있습니다.
  • service SecurityAccessService: 0x27 (SecurityAccess). 특정 보안 수준을 잠금 해제하는 데 필요한 시드 및 키 교환을 관리합니다.

SDV 진단 API는 애플리케이션이 진단 이벤트 및 오작동을 보고할 수 있도록 AUTOSAR의 진단 이벤트 관리자 (AUTOSAR_SWS_DiagnosticEventManager)를 기반으로 service FaultListenerServicemessage Event를 추가로 정의합니다.

또한 service DiagnosticsManagerService는 다른 서비스가 현재 진단 연결 매개변수 (소스 주소, 대상 주소) 및 세션 유형을 쿼리할 수 있도록 하는 SDV 플랫폼 서비스를 정의합니다.

서비스 번들 개발자 가이드

서비스 번들 개발자는 해당 .vsidl 파일에서 diagnostics_declaration 및 다음 서버를 정의할 수 있습니다.

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;
}

위의 (diagnostics_declaration이 포함된 service_bundle 블록)가 카탈로그에 정의된 경우 vsidl_rc_generator는 위의 서버와 diagnostics_declaration을 선언하는 모든 서비스 번들에 대해 prebuilt_etc 타겟을 생성합니다.

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,
}

이러한 타겟은 prebuilt_etc {} 블록 위의 해당 자동 생성 주석 블록에 표시된 대로 해당 apex 정의 블록의 prebuilts에 추가해야 합니다(MUST).

apex {
    name: "<APEX-NAME>",
    ...
    prebuilts: [
        ...
        "<APEX-NAME>.<BUNDLE-NAME>-diag-config.binpb",
        ...
    ],
    ...
}

또한 이러한 타겟을 해당 sdv_service_bundles_manifest.textproto 파일의 번들 sdv_service_bundle_metadata 항목의 diagnostics_config_path 필드에 추가해야 합니다. 또한 서비스 번들과 진단 관리자 서비스 간의 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,
    ...
}

또한 빌드 파일에서 다음 변수를 설정/덮어쓰기해야 합니다. SDV_DIAGNOSTICS_AGENT_MODULE := <DIAGNOSTICS-AGENT-BINARY-EXECUTABLE-NAME>

편의를 위해 libsdv_uds_serde_v1 라이브러리를 Proto ↔ UDS 변환에 사용하고 VSIDL 제공업체 라이브러리를 리플렉션에 사용할 수 있습니다.

진단 에이전트 .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
}