基于CAPL的writelog的应用

基于CAPL的writelog的应用

    • 1. 常用函数
      • writeCreate
      • writeConfigure
      • writeLineEx
    • 2. 示例代码

在工程实际应用中,经常需要长时间测试一项功能,测试过程中需要打印并记录一些信息,这个时候就需要用到writelog的功能,本章将详细介绍如何在capl中使用。

1. 常用函数

用到的capl函数有:

writeCreate

基于CAPL的writelog的应用_第1张图片

writeConfigure

基于CAPL的writelog的应用_第2张图片

writeLineEx

基于CAPL的writelog的应用_第3张图片

2. 示例代码

/*@!Encoding:936*/
includes
{
  
}

variables
{
  long mNewPage; // Sink identifier
}

on start
{
  //Create a new page at the Write Window
  mNewPage= writeCreate("New Page");

  //Configure the page so that its content is logged
  writeConfigure(mNewPage, 20, 1, "writelog.txt");

  //Clear content of CAPL page
  writeclear(1);

  //Show the description of the program
  writeLineEx(mNewPage,2,"This program shows the keyboard sequence in a new created Page ");
  writeLineEx(mNewPage,4,"\nKeyboard sequence: ");
}

on key *
{
  //show the current key at the "New Page"
  char currentKey;
  currentKey = this;
  writeLineEx(mNewPage,4,"%c ",currentKey);
}

on stopMeasurement
{
  //destroy the new created Page
  writeDestroy(mNewPage);
}

你可能感兴趣的:(Canoe学习笔记,CAPL,Canoe)