Skip to content

04_device_access_service

César García edited this page Jul 1, 2020 · 5 revisions

Device Access Service

Introduction Device Acces Service

Using the 'Config' service for permanent connections.

karaf@root()> config --help
SUBSHELL
        config

COMMANDS
    | config:cancel          | Cancels the changes to the configuration being edited.
    | config:delete          | Delete a configuration.
    | config:edit            | Creates or edits a configuration.
    | config:exists          | Check if a configuration exists.
    | config:install         | Install a cfg file in the Karaf etc folder.
    | config:list            | Lists existing configurations.
    | config:meta            | Lists meta type information.
    | config:property-append | Appends the given value to an existing property or creates the property with the specified name and value.
    | config:property-delete | Deletes a property from the configuration being edited.
    | config:property-get    | Gets the value of a property in the currently edited configuration.
    | config:property-list   | Lists properties from the currently edited configuration.
    | config:property-set    | Sets a property in the currently edited configuration.
    | config:update          | Saves and propagates changes from the configuration being edited.
karaf@root()> config:list -s
com.ceos.merlot.das.drv.basic
com.ceos.merlot.db.records
com.ceos.merlot.modbus.dev
com.ceos.merlot.modbus.sim
com.ceos.merlot.modbus.svr
jmx.acl
.
.
.
karaf@root()>
karaf@root()> config:edit --help
DESCRIPTION
        config:edit

        Creates or edits a configuration.

SYNTAX
        config:edit [options] pid

ARGUMENTS
        pid
                PID of the configuration or of the factory if --factory is given. Pid can also be specified as ldap query
                (required)

OPTIONS
        --alias
                Specifies the alias used for this factory config.
        --factory
                Define this config as a factory config. Will be created on calling update
        --help
                Display this help message
        --force
                Force the edition of this config, even if another one was under edition

DETAILS
        The edit command can be used to create or edit a configuration in three ways.

        Edit or create a config by pid:
          > config:edit org.apache.karaf.sample.pid
        The command above will also create a file etc/org.apache.karaf.sample.pid which corresponds to a configuration object with pid org.apache.karaf.sample.pid.

        Create a factory config by factory pid:
          > config:edit --factory myfactorypid
        In this case the config is created with a pid like myfactorypid.<generated id>. The file name is myfactorypid-<generated alias>.cfg.

        Create a factory config by factory pid and alias:
          > config:edit --factory --alias myalias myfactorypid
        In this case the config is created with a pid like myfactorypid.<generated id>. The file name is myfactorypid-myalias.cfg.

        Edit a config specified by an ldap query
          > config:edit '(myattribute=myvalue)'
        This executes an ldap query like in config:list. If the result is exactly one config then it is edited.
karaf@root()> config:edit --factory --alias AS01 com.ceos.merlot.das.devices
karaf@root()> config:property-set AS01 's7://192.168.1.23/0/2,equipo_s7,equipo de prueba'
karaf@root()> config:update
karaf@root()> service:list Device
[org.osgi.service.device.Device]
--------------------------------
 DEVICE_CATEGORY = com.ceos.s7
 DEVICE_DESCRIPTION = equipo_s7
 DEVICE_SERIAL = AS01
 service.bundleid = 213
 service.id = 329
 service.scope = singleton
Provided by :
 Merlot :: s7 :: Driver implementation (213)
Used by:
 Merlot :: das :: Device access service (193)
 Merlot :: s7 :: Driver implementation (213)
karaf@root()> config:list -s
com.ceos.merlot.das.devices.dfe059d7-7209-4b7f-b048-b660e1c49a25
com.ceos.merlot.das.drv.basic
com.ceos.merlot.db.records
com.ceos.merlot.modbus.dev
com.ceos.merlot.modbus.sim
com.ceos.merlot.modbus.svr
jmx.acl
.
.
.
karaf@root()>

But the most important thing is that the configuration file is already created in the 'etc' directory as 'com.ceos.merlot.das.devices-AS01.cfg'.

Introduction to Apache PLC4X

PLC4X Modbus Driver

Function Code Description Transport Supported
01 (0x01) Read Coil Status TCP/Serial X
02 (0x02) Read Input Status TCP/Serial X
03 (0x03) Read Input Status TCP/Serial
04 (0x04) Read Input Registers TCP/Serial
05 (0x05) Force Single Coil TCP/Serial
06 (0x06) Preset Single Register TCP/Serial
07 (0x07) Read Exception Status TCP/Serial
11 (0x0b) Fetch Communications Event Counter TCP/Serial
12 (0x0c) Fetch Communications Event Log TCP/Serial
15 (0x0f) Force Multiple Coils TCP/Serial
16 (0x10) Present Multiple Registers TCP/Serial
17 (0x11) Report Slave ID TCP/Serial
20 (0x14) Read General Reference TCP/Serial
21 (0x15) Write General Reference TCP/Serial
22 (0x16) Mask Write 4X Register TCP/Serial
23 (0x17) Read/Write multiple registers TCP/Serial
24 (0x18) Read FIFO Queue TCP/Serial

PLC4X S7 Driver

Sidebar

Clone this wiki locally