Binary Packages

<< 点击显示目录 >>

主页  exOS使用助手 > exOS Automation Help > Development > exOS Package >

Binary Packages

二进制软件包不需要任何额外/外部构建工具来创建 Linux 下的可执行文件。在这种情况下,Automation Studio 中使用 exos-api 的库也应以二进制形式提供,因为这样可以防止单边更改组件而导致错误。

exOS 技术包的样本文件夹中有二进制水箱组件。

 

WaterTank binary sample component

从这里可以看出,Linux 组件是以编译可执行文件的形式出现的,而使用 exos-api 的 Automation Studio 库也是以二进制形式出现的,因此整个组件在自动化工程师部署和使用时将保持一致。

exOS 组件生成器可用于生成二进制软件包。

在这里,.exospkg 文件包含以下内容:

   <?xml version="1.0" encoding="utf-8"?>
   <ComponentPackage Version="2.0.0" ErrorHandling="Component" StartupTimeout="0">
       <File FileName="Linux\watertank" ChangeEvent="Restart"/>
       <Service Type="Startup" Command="chmod +x watertank"/>
       <Service Type="Runtime" Command="./watertank"/>
       <DatamodelInstance Name="WaterTank_1"/>
   </ComponentPackage>

文件条目描述了要部署的文件(水箱),以及更改/添加/删除文件时会触发哪些服务。FileName 是相对于 .exospkg 位置而言的,在本例中指的是 Linux 子文件夹。

服务条目描述了组件运行时服务的执行字符串,在本例中是组件部署文件夹中的编译可执行文件(watertank)。

DataModelInstance 描述了应用程序通过exOS Communication API 连接到特定数据模型(数据类型)时所参考的实例名称。在大多数情况下,该名称是硬编码到已编译的应用程序中的,因此需要与此处配置的 DataModelInstance 名称相匹配。

 


Binary packages do not require any additional / external build tools to create the executables for Linux. In this case, the libraries using the exos-api in Automation Studio should also come in a binary form, as one should prevent changes in the component on a single side which might lead to errors.

There are binary WaterTank components in the Samples folder of the exOS Technology Package.

WaterTank binary sample component

Here, it is visible that the Linux component comes in a form of a compiled executable, and the Automation Studio library that uses the exos-api also comes in a binary form, so that the entire component will remain consistent when being deployed and used by an automation engineer.

The exOS Component Generator can be used to generate binary packages.

Here, the .exospkg file has the following contents:

    <?xml version="1.0" encoding="utf-8"?>
    <ComponentPackage Version="2.0.0" ErrorHandling="Component" StartupTimeout="0">
        <File FileName="Linux\watertank" ChangeEvent="Restart"/>
        <Service Type="Startup" Command="chmod +x watertank"/>
        <Service Type="Runtime" Command="./watertank"/>
        <DatamodelInstance Name="WaterTank_1"/>
    </ComponentPackage>

The File entry describes the file (watertank) to be deployed and which services are triggered when changing / adding / removing the file. The FileName is relative to the .exospkg location, in this case it refers to the subfolder Linux.

The Service entry describes the execution string of the runtime service for the component which in this case is a compiled executable (watertank) in the deployment folder of the component.

DataModelInstance describes the instance name the application refers to when connecting to a certain datamodel (datatype) via the exOS Communication API. In most cases the name is hardcoded into the compiled application, and therefore needs to match the DataModelInstance name configured here.