Home » Eclipse Projects » Kura » How to add Modbus plugin.(Modbus plugin is not included in the default workspace)
How to add Modbus plugin. [message #1710615] |
Wed, 07 October 2015 22:47 |
Dave Rathnow Messages: 25 Registered: March 2014 |
Junior Member |
|
|
I have worked through the Hello World example on the Kura "Getting Started" page and looked at the Modbus example in the source code but I'm a bit confused. There is no Modbus plugin in the Developer's Workspace I downloaded from Kura Downloads page. When I created my modbus plugin, references to classes in the org.eclipse.kura.protocol.modbus package were not being resolved. (Incidentally, I had a similar problem with the Serial Port example)
I then went off to the Kura repo, downloaded org.eclipse.kura.protocol.modbus-1.0.0.jar, and dropped it into the target-definition/equinox_3.8.1/repository/plugins folder in my Kura workspace. After a restart, Eclipse started resolving class from the org.eclipse.kura.protocol.modbus package, and the manifest editor added the necessary dependencies and I thought all was good. However, I'm not sure if that was the correct way to go about adding the plugin. I looked on my device's Kura installation and I don't see the modbus plugin jarfile anywhere in the installation. Also, while the manifest editor added my dependency for org.eclipse.kura.protocol.modbus, if I look at the raw manifest file, there is a red "X" in the left column beside org.eclipse.kura.protocol.modbus; version="1.0.0". Mousing over it, I get the error:
Bundle 'org.eclipse.kura.protocol.modbus' exporting package 'org.eclipse.kura.protocol.modbus' is unresolved
So my questions are:
1. What is the correct way to add additional plugins to the Kura workspace? In particular, serial, modbus, and cloud
2. How do I install additional plugins on the Kura installation on my device?
Thanks,
Dave.
|
|
| | | | | |
Re: How to add Modbus plugin. [message #1711428 is a reply to message #1711422] |
Thu, 15 October 2015 22:53 |
Dave Rathnow Messages: 25 Registered: March 2014 |
Junior Member |
|
|
I have been trying for the last couple of hours to get my plugin to run under the emulator but have had no success. I finally deleted the whole thing and recreated the plugin by following the "Hello World" example, changing the names to suite my needs. It runs fine in the emulator when the component file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
activate="activate"
deactivate="deactivate"
enabled="true"
immediate="true"
modified="updated"
name="RtuReader">
<implementation class="zedi.kura.rtu.RtuReader"/>
</scr:component>
In order to tell it's running, I have my activate() method spit out a message.
However, as soon as I add in references and service into the component.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
activate="activate"
deactivate="deactivate"
enabled="true"
immediate="true"
modified="updated"
name="RtuReader">
<implementation class="zedi.kura.rtu.RtuReader"/>
<service>
<provide interface="zedi.kura.rtu.RtuReader"/>
</service>
<reference bind="setModbusProtocolDeviceService"
cardinality="1..1"
interface="org.eclipse.kura.protocol.modbus.ModbusProtocolDeviceService"
name="ModbusProtocolDeviceService"
policy="static"
unbind="unsetModbusProtocolDeviceService"/>
</scr:component>
The plugin does not run. I cannot find any trace message in the console output nor do I see any error messages. Issuing a "list" command shows me that my component is in an "Unsatisfied" state:
osgi> list
All Components:
ID State Component Name Located in bundle
<--- SNIP --->
14 Unsatisfied org.eclipse.kura.protocol.modbus.ModbusProtocolDevice org.eclipse.kura.protocol.modbus(bid=27)
15 Unsatisfied RtuReader RtuReader(bid=42)
<--- SNIP --->
osgi>
Okay, so I deleted the modbus plugin jarfile from the target-definitions/equinox_3.8.1/repository/plugins folder and tried the "install" command and got:
osgi>
osgi> install file://home/daver/downloads/org.eclipse.kura.protocol.modbus-1.0.1.jar
gogo: BundleException: An error occurred trying to read the bundle
osgi>
So now I'm really out of ideas. I can get the plugin jarfile installed in the development environment (i.e. copy it) so I can develop a plugin, but my plugin won't work because the modbus plugin isn't being loaded by the emulator.
[Updated on: Thu, 15 October 2015 22:58] Report message to a moderator
|
|
|
Re: How to add Modbus plugin. [message #1711502 is a reply to message #1711428] |
Fri, 16 October 2015 13:20 |
David Woodard Messages: 420 Registered: July 2014 |
Senior Member |
|
|
Hello,
I am sorry you are having trouble with this, but I believe you are close to getting it working. A few comments and things to check:
1. You want to reference 1.0.0 for the version. That is the version of the package the modbus bundle is exporting, which can be different than the bundle version itself.
2. For the emulator, can you issue the 'comp <id>', where <id> is the ID number for the org.eclipse.kura.protocol.modbus.ModbusProtocolDevice? For example, from above, the command would be: comp 14 . This will tell us why it is unsatisfied. Also, the complete output of 'list' would be helpful.
Thanks,
--Dave
|
|
|
Re: How to add Modbus plugin. [message #1711536 is a reply to message #1711502] |
Fri, 16 October 2015 18:21 |
Dave Rathnow Messages: 25 Registered: March 2014 |
Junior Member |
|
|
So here is the output from the "list" command and the "comp <ID>" command:
osgi> list
All Components:
ID State Component Name Located in bundle
1 Active org.eclipse.equinox.event org.eclipse.equinox.event(bid=2)
2 Active org.eclipse.kura.cloud.app.command.CommandCloudApp org.eclipse.kura.core.cloud(bid=4)
3 Active org.eclipse.kura.cloud.CloudCallService org.eclipse.kura.core.cloud(bid=4)
4 Active org.eclipse.kura.cloud.CloudService org.eclipse.kura.core.cloud(bid=4)
5 Active org.eclipse.kura.deployment.agent org.eclipse.kura.deployment.agent(bid=5)
6 Active org.eclipse.kura.usb.UsbService org.eclipse.kura.emulator(bid=8)
7 Active org.eclipse.kura.position.PositionService org.eclipse.kura.emulator(bid=8)
8 Active org.eclipse.kura.clock.ClockService org.eclipse.kura.emulator(bid=8)
9 Active org.eclipse.kura.net.NetworkService org.eclipse.kura.emulator(bid=8)
10 Active org.eclipse.kura.emulator.Emulator org.eclipse.kura.emulator(bid=8)
11 Active org.eclipse.kura.watchdog.WatchdogService org.eclipse.kura.emulator(bid=8)
12 Active org.eclipse.kura.status.CloudConnectionStatusService org.eclipse.kura.emulator(bid=8)
13 Active org.eclipse.kura.core.data.transport.mqtt.MqttDataTransport org.eclipse.kura.core(bid=15)
14 Active org.eclipse.kura.system.SystemService org.eclipse.kura.core(bid=15)
15 Active org.eclipse.kura.data.DataService org.eclipse.kura.core(bid=15)
16 Active org.eclipse.kura.ssl.SslManagerService org.eclipse.kura.core(bid=15)
17 Active org.eclipse.kura.db.DbService org.eclipse.kura.core(bid=15)
18 Active org.eclipse.kura.system.SystemAdminService org.eclipse.kura.core(bid=15)
19 Active org.eclipse.kura.crypto.CryptoService org.eclipse.kura.core.crypto(bid=18)
20 Active org.eclipse.kura.configuration.ConfigurationService org.eclipse.kura.core.configuration(bid=19)
21 Active org.eclipse.kura.web.Console org.eclipse.kura.web(bid=22)
22 Unsatisfied org.eclipse.kura.protocol.modbus.ModbusProtocolDevice org.eclipse.kura.protocol.modbus(bid=41)
osgi> comp 22
Component[
name = org.eclipse.kura.protocol.modbus.ModbusProtocolDevice
activate = activate
deactivate = deactivate
modified =
configuration-policy = optional
factory = null
autoenable = true
immediate = false
implementation = org.eclipse.kura.protocol.modbus.ModbusProtocolDevice
state = Unsatisfied
properties = {service.pid=org.eclipse.kura.protocol.modbus.ModbusProtocolDeviceService}
serviceFactory = false
serviceInterface = [org.eclipse.kura.protocol.modbus.ModbusProtocolDeviceService]
references = {
Reference[name = ConnectionFactory, interface = org.osgi.service.io.ConnectionFactory, policy = static, cardinality = 1..1, target = null, bind = setConnectionFactory, unbind = unsetConnectionFactory]
Reference[name = UsbService, interface = org.eclipse.kura.usb.UsbService, policy = static, cardinality = 1..1, target = null, bind = setUsbService, unbind = unsetUsbService]
}
located in bundle = org.eclipse.kura.protocol.modbus_1.0.1 [41]
]
Dynamic information :
*The component is NOT satisfied
The following references are not satisfied:
Reference[name = ConnectionFactory, interface = org.osgi.service.io.ConnectionFactory, policy = static, cardinality = 1..1, target = null, bind = setConnectionFactory, unbind = unsetConnectionFactory]
Component configurations :
Configuration properties:
objectClass = String[org.eclipse.kura.protocol.modbus.ModbusProtocolDeviceService]
service.pid = org.eclipse.kura.protocol.modbus.ModbusProtocolDeviceService
component.name = org.eclipse.kura.protocol.modbus.ModbusProtocolDevice
component.id = 13
Instances:
osgi>
The unsatisfied reference is org.osgi.service.io.ConnectionFactory. After some trial and error, I managed to isolate the missing bundle: org.eclipse.kura.comm. Once I check this in "Run As/Run Configuration.../Bundles/Target Platform", my component loaded and started working.
I have another question: I notice that the ModbusProtocolDevice component has a reference to the UsbService. Does this mean it will not start if the UsbService is unavailable?
[Updated on: Fri, 16 October 2015 18:34] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Fri Apr 26 00:00:10 GMT 2024
Powered by FUDForum. Page generated in 0.03860 seconds
|