当前位置:   article > 正文

【CAPL入门知识】_tcpsocket是capl的关键字吗

tcpsocket是capl的关键字吗

CAPL常识

这是我经常要回顾的CAPL知识。

  • Event事件

    • Start of Measurement
      	  on start{
      	  	write("Start CANalyzer");
      	  }
      
      • 1
      • 2
      • 3
    • Stop of Measurement
      	  on stopMeasurement{
      	  	write("stop CANlyzer");
      	  }
      
      • 1
      • 2
      • 3
    • CAN message
      	  on message 0x123{
      	  	write("CAN Message 0x123");
      	  }
      
      • 1
      • 2
      • 3
    • Time event
      	  on timer tmrCycle{
      	  	write("within cycle");
      	  }
      
      • 1
      • 2
      • 3
    • Keystroke
      	  on key 'a'{
      	  	write("Key>a<pressed");
      	  }
      
      • 1
      • 2
      • 3

变量类型
无
无
无

CAPL函数

这是我一些常用的CAPL函数

常用的CAPL函数

  • 变量
char[]int、byte、word、dword、qword
message
frFrame、frPDU、frConfiguration、PDU
Class: Timer、MsTimer
class:File、TestCheck、TestStimulus、CAN
enumstruct
dbMsg *、dbNode *、dbPDU *、dbFrFrame *、dbFrPDU *、signal *
@、$、const
Class:DiagRequest、DiagResponse、ethernetPacket、UdpSocket、TcpSocket
SysVarIntArray
$EngineSpeed.txrq.raw
//special macros
%BUS_TYPE%%CHANNEL%%NETWORK_NAME%%NODE_NAME%
Channels[]
struct: canSettings{
	float baudrate; //in bit/s
	unsigned char tseg1, tseg2; //length of the time segments 1 and 2 in time quanta
	unsigned char sjw; //sync jump width in time quanta
	unsigned char sam; //number of sampling points (1 or 3). Only valid for CAN. For CAN FD "sam" is hard coded to 1.
	unsigned int flags; //see description below
};
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 系统函数
on prestart、on start
on message
on timer
on key
on sysvar、on sysvar_update
on signal、on singal_update
on FRStartCycle、on FRSlot、on frframe
on prestop、on stopMeasurement
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 常用函数
void setWriteDbgLevel (unsigned int priority);
long writeDbgLevel(unsigned int priority, char format1[], char format2[], ...);
void setTimer(msTimer t, long duration); settimercyclic()
void cancelTimer(msTimer t);
void output(message msg);
long sysSetVariableLongArray(SysVarName, long values[], long arraySize);
long sysGetVariableLongArray(SysVarName, long values[], long arraySize);
void frSetSendFrame( <frame object> ); 
int ret = frUpdateStatFrame( <frame var> );
random()SilentNM()TalkNM()GotoMode_BusSleep()GotoMode_Awake()ReinitSleepTimer()
SysSetVariableData()sysGetVariableData()SysSetVariableString()sysGetVariableString()
writeCreate()writeLineEx()writeToLogEx()runError()elcount()
SetBusContext()GetBusNameContext()GetBusContext()putValueToControl()setBusContext(GetBusNameContext())
TimeNow()timeNowFloat()timeNowNS()timeNowInt64()getLocalTimeString()getLocalTime(long time[])timeToElapse(mstimer t)timeDiff()MessageTimeNS()getSignalTime()getSignalTimeByTxNode() 
testReportFileName()setLogFileName()startLogging()stopLogging()
//字符串相关
strncpy()strncpy_off()mbstrncpy()mbstrncpy_off()mbsubstr_cpy(), mbsubstr_cpy_off()substr_cpy_off()substr_cpy()strncmp()strncmp_off()mbstrncmp()mbstrncmp_off()strstr()strstr_off()mbstrstr()mbstrstr_off()strstr_regex()strstr_regex_off()strncat()strlen()mbstrlen()snprintf()
//结构体相关
memcpy()memcpy_h2n()memcpy_n2h()memcmp()_align()__size_of()__alignment_of()__offset_of()
elcount()toUpper()toLower()stop()_round()canOffline()canOnline()getSignal()getSignalByTxNode()setSignal()SetSignalByTxNode()
lookupMessage()lookupNode()lookupPDU()lookupFrFrame()lookupFrPDU()lookupSignal()

canSetChannelOutput()
isSimulated()
snprintf()
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32

常用的Test函数

  • 常见的test函数
 TestStepPass、TestStepFail、TestStepWarning、TestCaseDescription、
 TestCaseComment、teststep、testCaseTitle、TestWaitForTesterConfirmation
 
 TestJoinMessageEvent、TestJoinTextEvent、TestJoinEnvVarEvent、TestJoinSignalMatch、  
 TestJoinSignalInRange、TestJoinSignalOutsideRange、TestJoinFrFrameEvent、 
 TestJoinSysVarEvent、TestJoinPDUEvent、TestJoinFrStartCycleEvent、TestJoinFrPDUEvent、  
 TestJoinFrNullFrameEvent、TestJoinFrFrameErrorEvent、TestJoinEthernetPacket、  
 TestJoinEthernetLinkStatus......  
   
 TestWaitForAllJoinedEvents、TestWaitForAnyJoinedEvent、TestWaitForMessage、  
 TestWaitForFrFrame、TestWaitForPDU、TestWaitForSysVar、TestWaitForTextEvent、  
 TestWaitForTimeout、TestWaitForSignalOutsideRange、TestWaitForSignalInRange、  
 TestWaitForSignalMatch......  
 long TestWaitForMessage(dbMsg aMessage, dword aTimeout);  
 long TestWaitForMessage(dword aMessageId, dword aTimeout);  
 long TestWaitForMessage(dword aTimeout);  
   
 TestGetWaitEventMsgData、testGetWaitScopeEventData、TestGetWaitPDUData、  
 TestGetWaitFrFrameData、TestGetWaitFrPDUData、TestGetWaitPDUsTPTCPSrcPort、  
 TestGetWaitPDUsTPUDPSrcPort、TestGetWaitPDUsTPTCPDstPort、 
 TestGetWaitPDUsTPIPv4SrcAddr、TestGetWaitPDUsTPIPv4DstAddr、TestGetWaitPDUsTPUDPDstPort  
   
 TestSetMsgEven、TestSetMsgCycleTime、TestSetMsgDlc、TestResetMsgCycleTime...  
 ChkQuery_NumEvents、ChkQuery_EventSignalValueMin、ChkQuery_EventSignalValueMax、  
 ChkQuery_EventMessageId、ChkQuery_EventMessageName、ChkQuery_EventNodeName、
 ChkQuery_EventSignalValue...  
   
 ChkStart_MsgSignalValueInvalid、ChkStart_MsgDistViolation、ChkStart_MsgOccurrenceCount、  
 ChkStart_MsgRelCycleTimeViolation、ChkStart_MsgAbsCycleTimeViolation、  
 ChkStart_MsgSignalValueRangeViolation、ChkStart_SignalValueChange、  
 ChkStart_SignalCycleTimeViolation、ChkStart_NodeMsgsRelCycleTimeViolation、  
 ChkStart_UndefinedMessageReceived、ChkStart_TimeoutChkStart_ErrorFramesOccured、  
 ChkStart_InconsistentDLC、ChkStart_InconsistentTxDLC、ChkStart_InconsistentRxDLC... 
 
 TestAddCondition、TestRemoveCondition、TestAddConstraint、TestRemoveConstraint、
 ChkControl_Stop、ChkControl_Start、ChkControl_Reset、ChkControl_Destroy、
 
 handle = TestCreateStringInputTable("Test Text", "Test Caption", "Test String Input Table Timeout");
 TestAddStringTableEntry(handle, "Test Entry");
 TestWaitForInput(handle, 5000);
 TestGetStringInput(resultStr, elcount(resultStr));
 handle = TestCreateValueInputTable("Test Text", "Test Caption", "Test Value Input Table Timeout");
 TestAddValueTableEntry(handle, 9);
 TestWaitForInput(handle, 5000);
 write("Result: %f", TestGetValueInput());

 testGetCurrentTestCaseTitle()TestReportAddExternalRef()
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 诊断相关
class:DiagResponse、DiagRequest
系统函数:on diagResponse、on diagRequst
函数:testWaitForDiagRequestSent()testWaitForDiagResponse()diagGetResponseCode()diagGetLastResponseCode()DiagSendNegativeResponse()DiagGetParameter()DiagSetParameter()DiagSendResponse()diagResize()diagSetComplexParameter()CanTpSendData()CanTpCreateConnection()CanTpSetTxIdentifier()CanTpSetRxIdentifier()CanTpGetSetAddressType()diagGetCommParameter()
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

Scope CAPL Functions

  • class类
ScopeAnalysisSetup{.samplePoint(char) |.samplePointDataPhase(char)}
scopeBitData{type,typeEx,bitValue,startTime,bitLength,signalVoltage,signalPolarity}
struct: canSettings{
  float baudrate; //in bit/s
  unsigned char tseg1, tseg2; //length of the time segments 1 and 2 in time quanta
  unsigned char sjw; //sync jump width in time quanta
  unsigned char sam; //number of sampling points (1 or 3). Only valid for CAN. For CAN FD "sam" is hard coded to 1.
  unsigned int flags; //see description below
  };
ScopeBitMaskPolygon{maskPointCount,data_0_Mask,data_1_Mask,timeOffset}
ScopeAnalyseHandle{handle(long)}
ScopeAnalyseResult{result,analysedFrameCount,framesWithDecodeFailure,framesWithMaskViolations,bitFailureCount}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • Function
on ScopeEvent

scopeConnect()
scopeDisconnect()
scopeTriggerNow()
testWaitForScopeEvent()
canFdGetConfiguration()
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/一键难忘520/article/detail/816018
推荐阅读
相关标签
  

闽ICP备14008679号