Skip to content

04_device_access_service

César García edited this page Jun 3, 2020 · 5 revisions

Device Access Service

Introduction Device Acces Service

Using the Config Service

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
jmx.acl.java.lang.Memory
jmx.acl.org.apache.karaf.bundle
jmx.acl.org.apache.karaf.config
jmx.acl.org.apache.karaf.security.jmx
jmx.acl.osgi.compendium.cm
org.apache.felix.eventadmin.impl.EventAdmin
org.apache.felix.fileinstall.f08c9f3c-778d-4b02-a59b-7cb5e2c4f88d
org.apache.karaf.audit
org.apache.karaf.command.acl.bundle
org.apache.karaf.command.acl.config
org.apache.karaf.command.acl.feature
org.apache.karaf.command.acl.jaas
org.apache.karaf.command.acl.kar
org.apache.karaf.command.acl.maven
org.apache.karaf.command.acl.scope_bundle
org.apache.karaf.command.acl.shell
org.apache.karaf.command.acl.system
org.apache.karaf.features
org.apache.karaf.features.repos
org.apache.karaf.jaas
org.apache.karaf.kar
org.apache.karaf.log
org.apache.karaf.management
org.apache.karaf.profile
org.apache.karaf.shell
org.apache.karaf.webconsole
org.jolokia.osgi
org.ops4j.pax.logging
org.ops4j.pax.url.mvn
org.ops4j.pax.url.war
org.ops4j.pax.web
profile
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
.
.
.

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

PLC4X S7 Driver

Sidebar

Clone this wiki locally