Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Dave Rathnow is currently offline Dave RathnowFriend
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 #1710848 is a reply to message #1710615] Fri, 09 October 2015 17:10 Go to previous messageGo to next message
David Woodard is currently offline David WoodardFriend
Messages: 420
Registered: July 2014
Senior Member
Hello,

We have a new release scheduled in the coming weeks, we will attempt to look into the missing bundles in the workspace before the release. Your approach to adding a bundle to the workspace is perfectly acceptable.

There is documentation here [1] on adding the bundle to your device. To make the addition permanent, you would need to add the bundle to /opt/eclipse/kura/kura/plugins and add an entry in /opt/eclipse/kura/kura/configi.ini .

Both of these issues are likely related to an error in our build, we will investigate and I will update this post with our findings.

Thanks,
--Dave
Re: How to add Modbus plugin. [message #1711164 is a reply to message #1710848] Tue, 13 October 2015 15:57 Go to previous messageGo to next message
paul stanton is currently offline paul stantonFriend
Messages: 87
Registered: July 2009
Member
hi dave, your link is missing for "adding the bundle to your device"
Re: How to add Modbus plugin. [message #1711301 is a reply to message #1711164] Wed, 14 October 2015 17:08 Go to previous messageGo to next message
Dave Rathnow is currently offline Dave RathnowFriend
Messages: 25
Registered: March 2014
Junior Member
Thanks Dave,

As was pointed out in the previous post, you missed adding a link to your post.

I have hit another road block: when I try to export the OSGI bundle, I am getting the error:

'Export Plug-ins' has encountered a problem.

Processing inclusion from feature org.eclipse.pde.container.feature: Bundle zedi.kura.rtureader_1.0.0.qualifier failed to resolve.:
	Unsatisfied import package org.eclipse.kura.protocol.modbus_1.0.0.



Any thoughts?
D
Re: How to add Modbus plugin. [message #1711415 is a reply to message #1711301] Thu, 15 October 2015 18:45 Go to previous messageGo to next message
David Woodard is currently offline David WoodardFriend
Messages: 420
Registered: July 2014
Senior Member
Very sorry, the link is here: https://tobiddev.wordpress.com/2015/03/23/one-bundle-project-modbus-and-eclipse-kura/ .

I just tried this myself and it worked okay. Do you still have the red X in your manifest file? After you copied the modbus bundle to your workspace target-definition folder, did you click "Set as target platform" again? Could you provide a link to your code? I just need to see the manifest xml and component definition xml, not the Java source.

Thanks,
--Dave
Re: How to add Modbus plugin. [message #1711422 is a reply to message #1711415] Thu, 15 October 2015 20:42 Go to previous messageGo to next message
Dave Rathnow is currently offline Dave RathnowFriend
Messages: 25
Registered: March 2014
Junior Member
I have to admit that I did not click "Set as target platform", but even when I did (after reading your reply), it made no difference. I still had the red "X" in the manifest. However, I read the page you referenced in the previous note and noticed that the version of the modbus plugin that it recommended using was V1.0.1. I was using V1.0.0 so I downloaded 1.0.1, removed 1.0.0 jarfile, and replaced it with the newer version. Clicked the "Set as target platform" and the red "X" disappeared...even though I'm still referencing 1.0.0 in the manifest. If I change the version number in the manifest to 1.0.1, the red "X" returns. I can't provide a link to my code but here are the files you requested:

MANIFEST.MF

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: RTU Reader Test
Bundle-SymbolicName: zedi.kura.rtureader
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: org.osgi.service.component;version="1.2.0",
 org.eclipse.kura.protocol.modbus;version="1.0.0",
 org.slf4j;version="1.6.4"
Service-Component: OSGI-INF/component.xml


component.xml:

<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" 
                activate="activate" 
                deactivate="deactivate" 
                name="zedi.kura.rtureader">
   <implementation class="zedi.kura.rtureader.RtuReader"/>
   
   <property name="service.pid" value="zedi.kura.rtureader.RtuReader"/>
   
   <reference bind="setModbusProtocolDeviceService" cardinality="1..1"
			  interface="org.eclipse.kura.protocol.modbus.ModbusProtocolDeviceService"
			  name="ModbusProtocolDeviceService"
			  policy="static"
			  unbind="unsetModbusProtocolDeviceService" />
    
</scr:component>
Re: How to add Modbus plugin. [message #1711428 is a reply to message #1711422] Thu, 15 October 2015 22:53 Go to previous messageGo to next message
Dave Rathnow is currently offline Dave RathnowFriend
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 Go to previous messageGo to next message
David Woodard is currently offline David WoodardFriend
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 Go to previous message
Dave Rathnow is currently offline Dave RathnowFriend
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

Previous Topic:Greenhouse tutorial
Next Topic:bndtools/eclipse - how to create a deployment package (dp)
Goto Forum:
  


Current Time: Fri Apr 26 00:00:10 GMT 2024

Powered by FUDForum. Page generated in 0.03860 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top