/****************************************************************/ /* NAME: CanBridge_Info */ /* FILE: CanBridge_Info.cpp */ /****************************************************************/ #include #include #include "CanBridge_Info.h" #include "ColorParse.h" #include "ReleaseInfo.h" using namespace std; void showSynopsis() { blk("SYNOPSIS: "); blk("------------------------------------ "); blk(" The pCanBridge application bridges CAN bus frames from a "); blk(" USBCAN-8E-U / CANET Ethernet-CAN converter (TCP Server mode) "); blk(" into the MOOSDB. Each received CAN frame is parsed from the "); blk(" 13-byte CANET wire format and transparently published as a "); blk(" binary MOOS message. "); blk(" "); } void showHelpAndExit() { blk(" "); blu("=============================================================== "); blu("Usage: pCanBridge file.moos [OPTIONS] "); blu("=============================================================== "); blk(" "); showSynopsis(); blk(" "); blk("Options: "); mag(" --alias","= "); blk(" Launch pCanBridge with the given process name "); blk(" rather than pCanBridge. "); mag(" --example, -e "); blk(" Display example MOOS configuration block. "); mag(" --help, -h "); blk(" Display this help message. "); mag(" --interface, -i "); blk(" Display MOOS publications and subscriptions. "); mag(" --version,-v "); blk(" Display the release version of pCanBridge. "); blk(" "); blk("Note: If argv[2] does not otherwise match a known option, "); blk(" then it will be interpreted as a run alias. This is "); blk(" to support pAntler launching conventions. "); blk(" "); exit(0); } void showExampleConfigAndExit() { blk(" "); blu("=============================================================== "); blu("pCanBridge Example MOOS Configuration "); blu("=============================================================== "); blk(" "); blk("ProcessConfig = pCanBridge "); blk("{ "); blk(" AppTick = 4 "); blk(" CommsTick = 4 "); blk(" "); blk(" // USBCAN-8E-U/CANET 目标地址(TCP Server 模式) "); blk(" can_host = 192.168.0.222 // 转换器 IP "); blk(" can_port = 4001 // 工作端口: CAN0=4001 CAN1=4002.. "); blk(" "); blk(" // 通道名(写入消息的 m_sSrcAux 辅助字段) "); blk(" can_channel_name = CAN0 "); blk(" "); blk(" // CAN 帧 SQLite 落库路径(can_frame 表) "); blk(" dbpath = pCanBridge_data.db "); blk("} "); blk(" "); exit(0); } void showInterfaceAndExit() { blk(" "); blu("=============================================================== "); blu("pCanBridge INTERFACE "); blu("=============================================================== "); blk(" "); showSynopsis(); blk(" "); blk("SUBSCRIPTIONS: "); blk("------------------------------------ "); blk(" (none: publish-only application) "); blk(" "); blk("PUBLICATIONS: "); blk("------------------------------------ "); blk(" CAN_0x%08X = CAN 帧(每帧一条二进制消息) "); blk(" 变量名: CAN ID 完整 4 字节十六进制, 如 CAN_0x10010001 "); blk(" m_sVal: 二进制 data(dlc 字节, MOOS_BINARY_STRING) "); blk(" m_sSrcAux: 通道名(默认 CAN0) "); blk(" m_dfVal2: 原始帧信息字节 byte0 "); blk(" bit7=FF(1扩展/0标准) bit6=RTR(1远程/0数据) "); blk(" bit3~0=DLC "); blk(" "); exit(0); } void showReleaseInfoAndExit() { showReleaseInfo("pCanBridge", "gpl"); exit(0); }