2017-08-17 2 views
0

Ich arbeite mit Microsoft Device Twins Tutorial available here. Verwenden von Maven 3.5.0 und Java 1.8.0_144.Azure DeviceTwinStatusCallBack - kann kein Symbol finden

Meine Service-App baut ohne Fehler auf, aber das Problem ist mit einer Geräte-App. Nach Kopie-Einfügen von Code aus dem Tutorial und versuchen, das Projekt mit dem Befehl "mvn sauber Paket -DskipTests" Ich habe diesen Fehler erhalten zu bauen:

cannot find symbol 
[ERROR] symbol: class DeviceTwinStatusCallBack 
[ERROR] location: class com.mycompany.app.App 

Es ist mein pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.mycompany.app</groupId> 
    <artifactId>simulated-device</artifactId> 
    <packaging>jar</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <name>simulated-device</name> 
    <url>http://maven.apache.org</url> 
    <dependencies> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>3.8.1</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
    <groupId>com.microsoft.azure.sdk.iot</groupId> 
    <artifactId>iot-device-client</artifactId> 
    <version>1.3.33</version> 
</dependency> 
    </dependencies> 
    <build> 
    <plugins> 
    <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <version>3.5</version> 
     <configuration> 
     <source>1.8</source> 
     <target>1.8</target> 
     </configuration> 
    </plugin> 
    </plugins> 
</build> 
</project> 

DeviceTwinStatusCallBack ist in Microsoft Azure-Dokumentation nicht verfügbar. Hat jemand eine Idee?

Antwort

0

Problem gelöst, ich habe nur meine eigene Klasse Umsetzung IotHubEventCallback:

protected static class MyTwinCallback implements IotHubEventCallback 
{ 
    public void execute(IotHubStatusCode status, Object context) 
    { 
     System.out.println("IoT Hub responded to device twin operation with status " + status.name()); 
    } 
} 

und meine startDevice Twin Methode sieht nun wie:

client.startDeviceTwin(new MyTwinCallback(), null, dataCollector, null); 
Verwandte Themen