Skip to content

Commit 5a9cc2c

Browse files
committed
hello github
0 parents  commit 5a9cc2c

File tree

288 files changed

+35630
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

288 files changed

+35630
-0
lines changed

.gitignore

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
##############################
2+
# Project Specific
3+
##############################
4+
5+
6+
##############################
7+
# OS generated files
8+
##############################
9+
.DS_Store
10+
.DS_Store?
11+
._*
12+
.Spotlight-V100
13+
.Trashes
14+
ehthumbs.db
15+
Thumbs.db
16+
17+
##############################
18+
# built application files
19+
##############################
20+
*.apk
21+
*.ap_
22+
23+
##############################
24+
# files for the dex VM
25+
##############################
26+
*.dex
27+
28+
##############################
29+
# Java class files
30+
##############################
31+
*.class
32+
33+
##############################
34+
# Generated files
35+
##############################
36+
bin/
37+
gen/
38+
39+
##############################
40+
# Local configuration file
41+
##############################
42+
local.properties
43+
44+
##############################
45+
# Eclipse project files
46+
##############################
47+
.classpath
48+
.project
49+
50+
##############################
51+
# Proguard folder (Eclipse)
52+
##############################
53+
proguard/
54+
55+
##############################
56+
# Intellij project files
57+
##############################
58+
*.iml
59+
*.ipr
60+
*.iws
61+
.idea/
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=1.6
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11+
org.eclipse.jdt.core.compiler.source=1.6
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<manifest package="com.smartdevicelink" xmlns:android="http://schemas.android.com/apk/res/android">
2+
<uses-sdk android:minSdkVersion="12"/>
3+
<!-- Required to use the USB Accessory mode -->
4+
<uses-feature android:name="android.hardware.usb.accessory"/>
5+
<application android:debuggable="true"/>
6+
</manifest>

sdl_android_lib/project.properties

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file is automatically generated by Android Tools.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must be checked in Version Control Systems.
5+
#
6+
# To customize properties used by the Ant build system use,
7+
# "ant.properties", and override values to adapt the script to your
8+
# project structure.
9+
10+
# Project target.
11+
target=android-17
12+
android.library=true
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.smartdevicelink.Dispatcher;
2+
3+
public interface IDispatchingStrategy<messageType> {
4+
public void dispatch(messageType message);
5+
6+
public void handleDispatchingError(String info, Exception ex);
7+
8+
public void handleQueueingError(String info, Exception ex);
9+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.smartdevicelink.Dispatcher;
2+
3+
import java.util.Comparator;
4+
5+
import com.smartdevicelink.protocol.ProtocolMessage;
6+
7+
public class IncomingProtocolMessageComparitor implements Comparator<ProtocolMessage> {
8+
9+
@Override
10+
public int compare(ProtocolMessage arg0, ProtocolMessage arg1) {
11+
// Always return 0, turning the priority queue into a FIFO queue.
12+
return 0;
13+
}
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.smartdevicelink.Dispatcher;
2+
3+
import java.util.Comparator;
4+
5+
import com.smartdevicelink.proxy.callbacks.InternalProxyMessage;
6+
7+
public class InternalProxyMessageComparitor implements Comparator<InternalProxyMessage> {
8+
9+
@Override
10+
public int compare(InternalProxyMessage arg0, InternalProxyMessage arg1) {
11+
// Always return 0, turning the priority queue into a FIFO queue.
12+
return 0;
13+
}
14+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.smartdevicelink.Dispatcher;
2+
3+
import java.util.Comparator;
4+
5+
import com.smartdevicelink.protocol.ProtocolMessage;
6+
7+
public class OutgoingProtocolMessageComparitor implements Comparator<ProtocolMessage> {
8+
9+
@Override
10+
public int compare(ProtocolMessage arg0, ProtocolMessage arg1) {
11+
// Always return 0, turning the priority queue into a FIFO queue.
12+
return 0;
13+
}
14+
}
15+
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package com.smartdevicelink.Dispatcher;
2+
3+
import java.util.Comparator;
4+
import java.util.concurrent.PriorityBlockingQueue;
5+
6+
import com.smartdevicelink.util.DebugTool;
7+
8+
public class ProxyMessageDispatcher<messageType> {
9+
PriorityBlockingQueue<messageType> _queue = null;
10+
private Thread _messageDispatchingThread = null;
11+
IDispatchingStrategy<messageType> _strategy = null;
12+
13+
// Boolean to track if disposed
14+
private Boolean dispatcherDisposed = false;
15+
16+
public ProxyMessageDispatcher(String THREAD_NAME, Comparator<messageType> messageComparator,
17+
IDispatchingStrategy<messageType> strategy) {
18+
_queue = new PriorityBlockingQueue<messageType>(10, messageComparator);
19+
20+
_strategy = strategy;
21+
22+
// Create dispatching thread
23+
_messageDispatchingThread = new Thread(new Runnable() {public void run(){handleMessages();}});
24+
_messageDispatchingThread.setName(THREAD_NAME);
25+
_messageDispatchingThread.setDaemon(true);
26+
_messageDispatchingThread.start();
27+
}
28+
29+
public void dispose() {
30+
dispatcherDisposed = true;
31+
32+
if(_messageDispatchingThread != null) {
33+
_messageDispatchingThread.interrupt();
34+
_messageDispatchingThread = null;
35+
}
36+
}
37+
38+
private void handleMessages() {
39+
40+
try {
41+
messageType thisMessage;
42+
43+
while(dispatcherDisposed == false) {
44+
thisMessage = _queue.take();
45+
_strategy.dispatch(thisMessage);
46+
}
47+
} catch (InterruptedException e) {
48+
// Thread was interrupted by dispose() method, no action required
49+
return;
50+
} catch (Exception e) {
51+
DebugTool.logError("Error occurred dispating message.", e);
52+
_strategy.handleDispatchingError("Error occurred dispating message.", e);
53+
}
54+
}
55+
56+
public void queueMessage(messageType message) {
57+
try {
58+
_queue.put(message);
59+
} catch(ClassCastException e) {
60+
_strategy.handleQueueingError("ClassCastException encountered when queueing message.", e);
61+
} catch(Exception e) {
62+
_strategy.handleQueueingError("Exception encountered when queueing message.", e);
63+
}
64+
}
65+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.smartdevicelink.SdlConnection;
2+
3+
import com.smartdevicelink.protocol.ProtocolMessage;
4+
import com.smartdevicelink.protocol.enums.SessionType;
5+
6+
public interface ISdlConnectionListener {
7+
public void onTransportDisconnected(String info);
8+
9+
public void onTransportError(String info, Exception e);
10+
11+
public void onProtocolMessageReceived(ProtocolMessage msg);
12+
13+
public void onProtocolSessionNACKed(SessionType sessionType,
14+
byte sessionID, byte version, String correlationID);
15+
16+
public void onProtocolSessionStarted(SessionType sessionType,
17+
byte sessionID, byte version, String correlationID);
18+
19+
public void onProtocolSessionEnded(SessionType sessionType,
20+
byte sessionID, String correlationID);
21+
22+
public void onProtocolError(String info, Exception e);
23+
24+
public void onHeartbeatTimedOut(byte sessionID);
25+
}

0 commit comments

Comments
 (0)