/****************************************************************/ /* 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 between "); blk(" multi-channel CANET Ethernet-CAN converters (TCP Server mode) "); blk(" and the MOOSDB. Each channel uses its own TCP connection "); blk(" (CANET working port). Every CAN frame is parsed from the "); blk(" 13-byte CANET wire format and transparently published as a "); blk(" binary MOOS message (channel tagged via m_sSrcAux). "); 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(" // CANET 通道(可重复多行):通道名,IP,工作端口 "); blk(" // 工作端口: CAN0=4001 CAN1=4002 ... CAN7=4008 "); blk(" channel = CAN0,192.168.0.222,4001 "); blk(" channel = CAN1,192.168.0.222,4002 "); blk(" "); blk(" // CAN_TX 下行默认通道(m_sSrcAux 为空时使用,可省略) "); blk(" default_channel = 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(" CAN_TX_0x%08X = 下行 CAN 帧(每帧一条二进制消息) "); blk(" m_sVal: 二进制 data(dlc<=8 字节, MOOS_BINARY_STRING) "); blk(" m_sSrcAux: 目标通道名(如 CAN0;空时按回退规则: "); blk(" default_channel > 单通道 > 多通道告警丢弃) "); 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); }