【Wee_Wong 原创文章, 转载请注明出处 】

首先介绍一下PI API 函数的命名规则, 熟悉了PI API的命名规则, 在使用时会比较清楚需要使用哪类函数。

PI API中函数都是以pi开头后接函数的类别,最后跟着函数名(以函数实现的功能命名)

如:

Archive Functions 存档函数:命名规则为:piar_

PI Batch Functions 作业函数:命名规则为:piba_

Event Log Functions事件日志:命名规则为:piel_

PI Login Functions连接管理:命名规则为:pilg_(Message Log Functions 也是以此开头)

Point Database Functions测点属性:命名规则为:pipt_

Snapshot Functions快照函数: 命名规则为:pisn_

Time Functions时间函数: 命名规则为:pitm_

Utility Functions 基本信息:命名规则为:piut_

其中标红的代表这些函数比较常用, 大多数函数都是以返回0代表函数调用成功!

以下是连接PI, 获取PI服务器基本信息的函数, 如下表:

函数名称 英文解释 Utility Functions  解释
piut_connect Establish a remote connection with the pi Server 建立与 pi 服务器的远程连接
piut_disconnect Close all remote connections with PI Servers 关闭与 PI 的服务器的所有远程连接
piut_disconnectnode Close remote connection with passed node 关闭远程连接与传递节点
piut_getapiversion Get the current API version number 获取当前的 API 版本数
piut_getprofile Get a value for an entry and section in an initialization file 获取一个值,用于输入和初始化文件中的节
piut_getprotocolvers Get the PI Server protocol version 获取 PI 服务器协议版本
piut_getserverversion Obtain version information about the current server 获取有关当前服务器的版本信息
piut_inceventcounter Increment an event counter 增量事件计数器
piut_ishome Determines if this is a pi home node 确定是否这是 pi 主节点
piut_login Gain access to protected PI data 访问受保护的 PI 数据
piut_netinfo Get local network information 获取本地网络信息
piut_netnodeinfo Get network information for the passed node name 获取网络信息传递的节点名称
piut_netserverinfo Get network information for the default server 获取默认的服务器的网络信息
piut_setdefaultservernode Set the current server to the default server 将当前的服务器设置为默认的服务器
piut_setprocname Set the process name to specified name 设置为指定名称的进程的名称
piut_setservernode Set the current server to a specified node 将当前的服务器设置为指定的节点
piut_writeprofile Write a value for an entry and section into an initialization file 一个值,用于输入和部分写入初始化文件
piut_zeroeventcounter Zero an event counter 零事件计数器

其中piut_setservernode 和piut_login为主要使用的函数, 简单介绍一下这两个函数

piut_setservernode 连接PI服务器使用, 传入服务器地址即可。

This function sets the active PI Server node where the data for the subsequent PI-API calls will be resolved. Passing a NULL server string will result in resetting to the default server. The first time a server is specified, there may be a delay as a connection is established. The number of concurrently active servers is limited by the network protocol being used, the operating system, and the hardware platform.

C format

int32 piut_setservernode(

char PIPTR * servername );

Returns

>0

System Error (typically network related)

0

Success

-1

Server name is not the same as the PI Home node (DEC VAX only)

Arguments

servername(passed)

Name of the PI Server node

piut_login

传入用户名、密码, 输出参数返回该用户的权限

This function establishes a user's access to PI System data based on a login to a configured user database (PI User Database or VMS UAF) The login call may be made in one of two ways: by passing a NULL string for the username argument and a NULL string for the password argument, the server will return the default level of access, or by passing a username and password and attempting to qualify a valid login. Note that a null string is a valid pointer to an array of chars whose first element is set to 0. This requirement is distinctly different from pilg_login which accepts NULL pointers.

If piut_login is called after a valid login was performed, the request is ignored and the existing authorization level is returned invalid. See the Usage Notes for interpretation of thevalidparameter.

C format

int32 piut_login(

char PIPTR * username,

char PIPTR * passwrd,

int32 PIPTR * valid );

Returns

>0

System error

0

Success

-999

Login error

Arguments

username (passed)

Null terminated character string

passwrd (passed)

Null terminated password string

valid (returned)

Level of access available

#define PINO  0 无权限

#define PIREAD  1只读

#define PIREADWRITE 2读写

基本函数就先介绍到此了,其他的函数会在以后的章节讲解。

【Wee_Wong 原创文章, 转载请注明出处 】

PI API 基础函数(一)相关推荐

  1. API各函数作用简介

    API各函数作用简介 1.控件与消息函数 AdjustWindowRect 给定一种窗口样式,计算获得目标客户区矩形所需的窗口大小  AnyPopup 判断屏幕上是否存在任何弹出式窗口  Arrang ...

  2. 搬运--domoticz的 MQTT API接口 函数英文

    以下是我从domoticz 官网搬运来的 MQTT 的 API 接口函数 https://www.domoticz.com/wiki Domoticz API/JSON URL's Jump to n ...

  3. Flutter(Dart)基础——函数详解

    Flutter(Dart)基础--函数详解 在Dart中,函数(或方法)也是对象,它的类型是 Function. 这意味着,函数可以赋值给变量,也可以当做其他函数的参数. 函数的声明 基本上与Java ...

  4. VC API常用函数简单例子大全(1-89)

    第一个:FindWindow根据窗口类名或窗口标题名来获得窗口的句柄,该函数返回窗口的句柄 函数的定义:HWND WINAPI FindWindow(LPCSTR lpClassName ,LPCST ...

  5. API接口函数的应用

    PI API提供一个公共的编程接口,用C/C++或VB.甚至连PI-PROCESSBOOK中内嵌的VBA都可以对PI数据库进行数据读写. 用API开发PI的接口一般有两种方法. 一是用接口程序去控制一 ...

  6. WIN32 API:绘图函数

    二.创建GDI绘图对象 今天我们要讨论的是Win32 API中最有有趣的部分───用绘图函数完成图形输出.可以说,所有前面讲的内容都是本课程的前期准备.当时,我们在一些试例程序中偶尔用了一些绘图函数, ...

  7. VC API常用函数简单例子大全

    VC API常用函数简单例子大全 http://hi.baidu.com/tag/vc%20api%E5%87%BD%E6%95%B0/feeds 系统API查询 http://www.vbgood. ...

  8. VC API常用函数

    第一个:FindWindow根据窗口类名或窗口标题名来获得窗口的句柄,该函数返回窗口的句柄, 这个函数的定义是这样的 HWND WINAPI FindWindow(LPCSTR lpClassName ...

  9. [转]在C#中使用API回调函数的方法

    在C#中使用API回调函数的方法 就以EnumChildWindows和EnumChildProc为例子: 首先要声明EnumChildProc 为一个回调函数 public delegate boo ...

最新文章

  1. jQuery计数子元素
  2. Kafka设计解析(五):Kafka Benchmark--转
  3. 风险管理6个过程及相关重点
  4. 深入理解C指针之四:指针和数组
  5. 【学术相关】研究生、博士生全程只靠自己能否发一篇 SCI?
  6. Go 应用性能优化指北
  7. 调整Tomcat上的参数提高性能[转]
  8. qchart 设置线颜色_实战PyQt5: 137-QChart图表之散点图
  9. PWN题[强网先锋]orw超详细讲解(多解法)
  10. BootLoader简介——linux内核的引导
  11. c++局部对象是什么_什么是Java内部类?
  12. Centos 7.4版本升级内核3.10+ 到4+过程
  13. kindeditor编辑器
  14. 影响大数据和分析的5大趋势
  15. i3wm nm-applet每次开机都要输入wifi密码的解决办法
  16. 一文搞懂HTTPProxy丨含基础、高级路由、服务韧性
  17. oracle rat结果分析比较,Oracle RAT介绍及最佳实践
  18. oracle11g和toad,plsql、toad应用于oracle11g64位的方法
  19. MyBatis学习(一)-- 实现简单查询
  20. log4j连接ekl

热门文章

  1. 世界各地时间缩写_世界各地的天然气价格
  2. html div父集子集,怎么让父极元素的宽度自动设为所有子集的宽度之和呢?或者怎么保证子集不换行?不考虑用js!...
  3. Mac 远程连接树莓派-不使用拓展坞
  4. Interview100-91 著名的毒酒问题
  5. centos6如何添加阿里云centos和epel源
  6. c++多线程生产者与消费者问题代码
  7. HP 孙振耀 九大感言(转)
  8. GEA 3.4 流水线、缓存及优化
  9. 【CSS技巧】文字分散对齐的方法
  10. Codeforce821E Okabe and El Psy Kongroo