CANdevStudio 프로젝트 시작하기

CANdevStudio 프로젝트 튜토리얼

1. 프로젝트 디렉토리 구조

CANdevStudio는 CAN 버스 시뮬레이션을 위한 개발 도구입니다. 프로젝트의 디렉토리 구조는 다음과 같이 구성되어 있습니다:

CANdevStudio/
├── CMakeLists.txt
├── README.md
├── src/
│   ├── main.cpp
│   ├── CanBusAdapter.cpp
│   ├── CanBusAdapter.h
│   ├── ...
├── include/
│   ├── CanBusAdapter.h
│   ├── ...
├── config/
│   ├── settings.json
│   ├── ...
├── plugins/
│   ├── CanLogger/
│   │   ├── CanLogger.cpp
│   │   ├── CanLogger.h
│   ├── CanSimulator/
│   │   ├── CanSimulator.cpp
│   │   ├── CanSimulator.h
├── tests/
│   ├── test_CanBusAdapter.cpp
│   └── ...

디렉토리 역할

  • CMakeLists.txt: CMake 빌드 설정 파일입니다.
  • README.md: 프로젝트 문서입니다.
  • src/: 소스 코드 파일이 위치합니다.
  • include/: 헤더 파일이 위치합니다.
  • config/: 애플리케이션 설정 파일이 위치합니다.
  • plugins/: 플러그인 모듈이 위치합니다.
  • tests/: 단위 테스트 파일이 위치합니다.

2. 애플리케이션 시작 파일

애플리케이션의 시작点是 src/main.cpp입니다. 이 파일은 Qt 애플리케이션을 초기화하고 메인 윈도우를 생성합니다.

#include <QApplication>
#include "MainWindow.h"

int main(int argc, char *argv[]) {
    QApplication qtApp(argc, argv);
    MainWindow mainWindow;
    mainWindow.display();
    return qtApp.run();
}

시작 파일 분석

  • QApplication qtApp(argc, argv): Qt 애플리케이션 인스턴스를 초기화합니다.
  • MainWindow mainWindow: 메인 윈도우 객체를 생성합니다.
  • mainWindow.display(): 윈도우를 화면에 표시합니다.
  • qtApp.run(): 애플리케이션 이벤트 루프를 실행합니다.

3. 설정 파일

애플리케이션 설정은 config/settings.json 파일에 정의되어 있습니다.

{
    "can_bus": {
        "device": "can0",
        "bitrate": 250000
    },
    "modules": [
        "CanLogger",
        "CanSimulator"
    ],
    "logging": {
        "level": "info",
        "output": "/var/log/candevstudio.log"
    }
}

설정 항목 설명

  • can_bus: CAN 버스 장치 설정입니다.
    • device: CAN 인터페이스 장치 이름입니다.
    • bitrate: 통신 속도(비트레이트)입니다.
  • modules: 로드할 플러그인 모듈 목록입니다.
  • logging: 로깅 설정입니다.
    • level: 로그 레벨입니다.
    • output: 로그 파일 출력 경로입니다.

以上の内容がCANdevStudio 프로젝트의 기본적인 구조와 설정 방법입니다. 이 정보를 통해 프로젝트 구조를 이해하고 개발을 시작할 수 있습니다.

태그: CAN Qt C++ cmake CAN bus

6월 26일 18:54에 게시됨