Use LLRPGPIOService have error log : Reader DAO is null

Questions about developing the edge server core as well as applications

Moderators: Matt, kyle

Post Reply
gn00644368
Posts: 5
Joined: Tue May 10, 2016 9:30 pm

Use LLRPGPIOService have error log : Reader DAO is null

Post by gn00644368 » Tue May 10, 2016 9:41 pm

Hi,
I use helloworld example in SDK. And i put following code in "public void tagArrived(TagReadEvent tag)" :

LLRPGPIOService a = new LLRPGPIOService();
try {
a.setGPO(tag.getReaderID(), 1);
System.out.println("OK");
} catch (CannotExecuteException e) {
// TODO Auto-generated catch block
//e.printStackTrace();
System.out.println("Fail!!!"+e.getMessage());
}
System.out.println("TAG ARRIVED: " + tag.getTag().getFormattedID());

And it throw error message is "Reader DAO is null"

How can i solve this problem ?
Thx !

spring.xml :
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/b ... ns-3.0.xsd
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/o ... g-osgi.xsd">


<bean id="HelloWorldApp" class="org.rifidi.app.helloworld.HelloWorldApp">
<constructor-arg index="0" value="HelloWorld" />
<constructor-arg index="1" value="HelloWorldApp" />
<property name="readZoneMonitoringService" ref="readZoneMonitoringService" />
</bean>
<osgi:service ref="HelloWorldApp" interface="org.rifidi.edge.api.RifidiApp" />

<osgi:reference id="readZoneMonitoringService"
interface="org.rifidi.edge.api.service.tagmonitor.ReadZoneMonitoringService" />
</beans>

Matt
Posts: 362
Joined: Fri May 02, 2008 11:56 am
Organization: Pramari

Re: Use LLRPGPIOService have error log : Reader DAO is null

Post by Matt » Wed May 11, 2016 5:45 pm

You can't just instantiate the GPIOService like that, you need to inject it through spring.

Here's a tutorial on how to do that:

http://wiki.rifidi.net/index.php?title=GPIO_Tutorial

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests