Skip to content

Commit fb309f5

Browse files
author
Jianbin Qi
committed
update lib in processing.org name rule
1 parent 80808f9 commit fb309f5

File tree

15 files changed

+64
-49
lines changed

15 files changed

+64
-49
lines changed

examples/AndroidCamera/CameraColor/CameraColor.pde

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import com.onlylemi.processing.android.capture.*;
22

3-
PAndroidCamera ac;
3+
AndroidCamera ac;
44

55
void setup() {
66
size(720, 480);
77

8-
ac = new PAndroidCamera(width, height, 20);
8+
ac = new AndroidCamera(width, height, 20);
99
ac.start();
1010
}
1111

examples/AndroidCamera/CameraImage/CameraImage.pde

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import com.onlylemi.processing.android.capture.*;
22

3-
PAndroidCamera ac;
3+
AndroidCamera ac;
44
PImage img;
55

66
void setup() {
77
size(720, 480);
8-
ac = new PAndroidCamera(width, height, 30);
8+
ac = new AndroidCamera(width, height, 30);
99
ac.start();
1010
}
1111

examples/AndroidCamera/CameraMask/CameraMask.pde

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import com.onlylemi.processing.android.capture.*;
22

3-
PAndroidCamera ac;
3+
AndroidCamera ac;
44
PImage img;
55
PImage mask;
66

@@ -10,7 +10,7 @@ void setup(){
1010
background(0);
1111
imageMode(CENTER);
1212

13-
ac = new PAndroidCamera(width, height, 30);
13+
ac = new AndroidCamera(width, height, 30);
1414
ac.start();
1515

1616
mask = loadImage("mask.png");

examples/AndroidCamera/CameraMusic/CameraMusic.pde

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import com.onlylemi.processing.android.capture.*;
22

3-
PAndroidCamera ac;
3+
AndroidCamera ac;
44
PImage img;
55
PImage mask;
66

@@ -11,7 +11,7 @@ void setup(){
1111
imageMode(CENTER);
1212
initAudio();
1313

14-
ac = new PAndroidCamera(width, height, 30);
14+
ac = new AndroidCamera(width, height, 30);
1515
ac.start();
1616

1717
mask = loadImage("mask.png");

examples/AndroidCamera/CameraPixel/CameraPixel.pde

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import com.onlylemi.processing.android.capture.*;
22
import peasy.PeasyCam;
33

4-
PAndroidCamera ac;
4+
AndroidCamera ac;
55
PImage img;
66
PeasyCam cam;
77

@@ -10,7 +10,7 @@ void setup() {
1010

1111
cam = new PeasyCam(this, 500);
1212

13-
ac = new PAndroidCamera(width, height, 20);
13+
ac = new AndroidCamera(width, height, 20);
1414
ac.start();
1515
}
1616

examples/AndroidSensor/AccSensor/AccSensor.pde

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import com.onlylemi.processing.android.capture.*;
22

3-
PAndroidSensor as;
3+
AndroidSensor as;
44

55
void setup() {
66
size(720, 480);
77

88
background(0);
99

10-
as = new PAndroidSensor(0);
10+
as = new AndroidSensor(0);
1111
as.start();
1212
}
1313

Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import com.onlylemi.processing.android.capture.*;
22

3-
PAndroidSensor as;
3+
AndroidSensor as;
44

55
void setup() {
66
size(720, 480);
77

88
background(0);
99

10-
as = new PAndroidSensor(0);
10+
as = new AndroidSensor(0);
1111
as.start();
1212
}
1313

@@ -17,35 +17,35 @@ void draw() {
1717

1818
textSize(15);
1919

20-
text(PSensorType.TYPE_ACCELEROMETER + " : ", 60, 50);
20+
text(SensorType.TYPE_ACCELEROMETER + " : ", 60, 50);
2121
text("X : " + as.getAccelerometerSensorValues()[0], 250, 50);
2222
text("Y : " + as.getAccelerometerSensorValues()[1], 400, 50);
2323
text("Z : " + as.getAccelerometerSensorValues()[2], 550, 50);
2424

25-
text(PSensorType.TYPE_ORIENTATION + " : ", 60, 100);
25+
text(SensorType.TYPE_ORIENTATION + " : ", 60, 100);
2626
text("X : " + as.getOrientationSensorValues()[0], 250, 100);
2727
text("Y : " + as.getOrientationSensorValues()[1], 400, 100);
2828
text("Z : " + as.getOrientationSensorValues()[2], 550, 100);
2929

30-
text(PSensorType.TYPE_MAGNETIC_FIELD + " : ", 60, 150);
30+
text(SensorType.TYPE_MAGNETIC_FIELD + " : ", 60, 150);
3131
text("X : " + as.getMagneticFieldSensorValues()[0], 250, 150);
3232
text("Y : " + as.getMagneticFieldSensorValues()[1], 400, 150);
3333
text("Z : " + as.getMagneticFieldSensorValues()[2], 550, 150);
3434

35-
text(PSensorType.TYPE_GYROSCOPE + " : ", 60, 200);
35+
text(SensorType.TYPE_GYROSCOPE + " : ", 60, 200);
3636
text("X : " + as.getGyroscopeSensorValues()[0], 250, 200);
3737
text("Y : " + as.getGyroscopeSensorValues()[1], 400, 200);
3838
text("Z : " + as.getGyroscopeSensorValues()[2], 550, 200);
3939

40-
text(PSensorType.TYPE_LIGHT + " : ", 60, 250);
41-
text("level : " + as.getLightSensorValues(), 250, 250);
40+
text(SensorType.TYPE_LIGHT + " : ", 60, 250);
41+
text("leSensorTypevel : " + as.getLightSensorValues(), 250, 250);
4242

43-
text(PSensorType.TYPE_PROXIMITY + " : ", 60, 300);
43+
text(SensorType.TYPE_PROXIMITY + " : ", 60, 300);
4444
text("distance : " + as.getProximitySensorValues(), 250, 300);
4545

46-
text(PSensorType.TYPE_PRESSURE + " : ", 60, 350);
46+
text(SensorType.TYPE_PRESSURE + " : ", 60, 350);
4747
text("pressure : " + as.getPressureSensorValues(), 250, 350);
4848

49-
text(PSensorType.TYPE_TEMPERATURE + " : ", 60, 400);
49+
text(SensorType.TYPE_TEMPERATURE + " : ", 60, 400);
5050
text("temperature : " + as.getTemperatureSensorValues(), 250, 400);
5151
}

library.properties

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# UTF-8 supported.
22

33
# The name of your library as you want it formatted
4-
name = Processing Android Capture
4+
name = AndroidCapture for Processing
55

66
# List of authors. Links can be provided using the syntax [author name](url)
7-
authorList = [onlylemi](https://github.com/onlylemi/processing-android-capture)
7+
authorList = [Jianbin Qi](https://github.com/onlylemi/)
88

99
# A web page for your library, NOT a direct link to where to download it
1010
url = https://github.com/onlylemi/processing-android-capture
@@ -16,14 +16,14 @@ url = https://github.com/onlylemi/processing-android-capture
1616
# "Sound" "Utilities" "Typography" "Video & Vision"
1717
#
1818
# If a value other than those listed is used, your library will listed as "Other."
19-
category = Hardware
19+
category = Data
2020

2121
# A short sentence (or fragment) to summarize the library's function. This will be
2222
# shown from inside the PDE when the library is being installed. Avoid repeating
2323
# the name of your library here. Also, avoid saying anything redundant like
2424
# mentioning that its a library. This should start with a capitalized letter, and
2525
# end with a period.
26-
sentence = This lib tries to transfer data between Processing and Android.
26+
sentence = This lib tries to transfer data(Android Camera & Android Sensor) between Processing and Android.
2727

2828
# Additional information suitable for the Processing website. The value of
2929
# 'sentence' always will be prepended, so you should start by writing the
@@ -39,7 +39,7 @@ paragraph =
3939
# is used to compare different versions of the same library, and
4040
# check if an update is available. You should think of it as a
4141
# counter, counting the total number of releases you've had.
42-
version = 101 # This must be parsable as an int
42+
version = 2 # This must be parsable as an int
4343

4444
# The version as the user will see it. If blank, the version attribute will be used here
45-
prettyVersion = beta1.0 # This is treated as a String
45+
prettyVersion = 2.0 # This is treated as a String
5.94 KB
Binary file not shown.
-5.95 KB
Binary file not shown.

reference/javadoc.zip

40.5 KB
Binary file not shown.

src/com/onlylemi/processing/android/capture/PAndroidCamera.java renamed to src/com/onlylemi/processing/android/capture/AndroidCamera.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111

1212
/**
1313
* processing android camera
14+
* <p>
15+
* https://github.com/onlylemi/processing-android-capture
1416
*
1517
* @author onlylemi
1618
*/
17-
public class PAndroidCamera implements Runnable {
19+
public class AndroidCamera implements Runnable {
1820

1921
private ServerSocket ss = null;
2022
private BufferedImage image;
@@ -30,13 +32,13 @@ public class PAndroidCamera implements Runnable {
3032
private boolean flag;
3133

3234
/**
33-
* new a PAndroidCamera obj
35+
* new a AndroidCamera obj
3436
*
3537
* @param width the width of image
3638
* @param height the height of image
3739
* @param imageFrameRate the frame rate of getting image
3840
*/
39-
public PAndroidCamera(int width, int height, long imageFrameRate) {
41+
public AndroidCamera(int width, int height, long imageFrameRate) {
4042
this.width = width;
4143
this.height = height;
4244
this.imageFrameRate = imageFrameRate;

src/com/onlylemi/processing/android/capture/PAndroidSensor.java renamed to src/com/onlylemi/processing/android/capture/AndroidSensor.java

+16-13
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010

1111
/**
1212
* processing android sensor
13+
* <p>
14+
* https://github.com/onlylemi/processing-android-capture
1315
*
1416
* @author onlylemi
1517
*/
16-
public class PAndroidSensor implements Runnable, PSensor {
18+
public class AndroidSensor implements Runnable, Sensor {
1719

1820
private byte[] byteBuffer = new byte[1024];
1921
private ServerSocket ss = null;
@@ -28,11 +30,11 @@ public class PAndroidSensor implements Runnable, PSensor {
2830
private Thread thread;
2931

3032
/**
31-
* new a PAndroidSensor obj
33+
* new a AndroidSensor obj
3234
*
3335
* @param rate the rate of getting data
3436
*/
35-
public PAndroidSensor(long rate) {
37+
public AndroidSensor(long rate) {
3638
this.rate = rate;
3739

3840
flag = true;
@@ -107,7 +109,7 @@ public void pause() {
107109
/**
108110
* the sensors data of android client
109111
*
110-
* @return
112+
* @return snesors data
111113
*/
112114
public String getData() {
113115
return data;
@@ -117,14 +119,15 @@ public String getData() {
117119
* parser json data
118120
*
119121
* @param data
122+
* @param sensor
120123
* @return
121124
*/
122125
private float[] parserSensorJson(String data, String sensor) {
123126
float[] values = new float[3];
124127

125128
if (!"".equals(data)) {
126129
JSONObject jo = JSONObject.parse(data);
127-
JSONArray ja = jo.getJSONArray(PSensorType.ANDROID_SENSOR);
130+
JSONArray ja = jo.getJSONArray(SensorType.ANDROID_SENSOR);
128131

129132
for (int i = 0; i < ja.size(); i++) {
130133
if (!ja.getJSONObject(i).isNull(sensor)) {
@@ -143,42 +146,42 @@ private float[] parserSensorJson(String data, String sensor) {
143146

144147
@Override
145148
public float[] getAccelerometerSensorValues() {
146-
return parserSensorJson(data, PSensorType.TYPE_ACCELEROMETER);
149+
return parserSensorJson(data, SensorType.TYPE_ACCELEROMETER);
147150
}
148151

149152
@Override
150153
public float getLightSensorValues() {
151-
return parserSensorJson(data, PSensorType.TYPE_LIGHT)[0];
154+
return parserSensorJson(data, SensorType.TYPE_LIGHT)[0];
152155
}
153156

154157
@Override
155158
public float[] getOrientationSensorValues() {
156-
return parserSensorJson(data, PSensorType.TYPE_ORIENTATION);
159+
return parserSensorJson(data, SensorType.TYPE_ORIENTATION);
157160
}
158161

159162
@Override
160163
public float getProximitySensorValues() {
161-
return parserSensorJson(data, PSensorType.TYPE_PROXIMITY)[0];
164+
return parserSensorJson(data, SensorType.TYPE_PROXIMITY)[0];
162165
}
163166

164167
@Override
165168
public float getTemperatureSensorValues() {
166-
return parserSensorJson(data, PSensorType.TYPE_TEMPERATURE)[0];
169+
return parserSensorJson(data, SensorType.TYPE_TEMPERATURE)[0];
167170
}
168171

169172
@Override
170173
public float getPressureSensorValues() {
171-
return parserSensorJson(data, PSensorType.TYPE_PRESSURE)[0];
174+
return parserSensorJson(data, SensorType.TYPE_PRESSURE)[0];
172175
}
173176

174177
@Override
175178
public float[] getGyroscopeSensorValues() {
176-
return parserSensorJson(data, PSensorType.TYPE_PRESSURE);
179+
return parserSensorJson(data, SensorType.TYPE_PRESSURE);
177180
}
178181

179182
@Override
180183
public float[] getMagneticFieldSensorValues() {
181-
return parserSensorJson(data, PSensorType.TYPE_MAGNETIC_FIELD);
184+
return parserSensorJson(data, SensorType.TYPE_MAGNETIC_FIELD);
182185
}
183186

184187
@Override

src/com/onlylemi/processing/android/capture/PSensor.java renamed to src/com/onlylemi/processing/android/capture/Sensor.java

+11-3
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,20 @@
22

33
/**
44
* a interface about getting sensor data
5+
* <p>
6+
* https://github.com/onlylemi/processing-android-capture
57
*
68
* @author onlylemi
79
*/
8-
public interface PSensor {
10+
public interface Sensor {
911

1012
/**
1113
* @return All values are in SI units (m/s^2)
14+
* <ul>
1215
* <li>values[0]: Acceleration minus Gx on the x-axis</li>
1316
* <li>values[1]: Acceleration minus Gy on the y-axis</li>
1417
* <li>values[2]: Acceleration minus Gz on the z-axis</li>
18+
* </ul>
1519
*/
1620
float[] getAccelerometerSensorValues();
1721

@@ -22,11 +26,13 @@ public interface PSensor {
2226

2327
/**
2428
* @return All values are angles in degrees.
29+
* <ul>
2530
* <li>values[0]: Azimuth, angle between the magnetic north direction and the y-axis, around the z-axis (0 to
2631
* 359). 0=North, 90=East, 180=South, 270=West</li>
2732
* <li>values[1]: Pitch, rotation around x-axis (-180 to 180), with positive values when the z-axis moves toward
2833
* the y-axis.</li>
2934
* <li>values[2]: Roll, rotation around the y-axis (-90 to 90) increasing as the device moves clockwise.</li>
35+
* </ul>
3036
*/
3137
float[] getOrientationSensorValues();
3238

@@ -52,9 +58,11 @@ public interface PSensor {
5258
* a device positioned on the origin would report positive rotation if the device appeared to be rotating counter
5359
* clockwise. Note that this is the standard mathematical definition of positive rotation and does not agree with
5460
* the definition of roll given earlier.
61+
* <ul>
5562
* <li>values[0]: Angular speed around the x-axis</li>
5663
* <li>values[1]: Angular speed around the y-axis</li>
5764
* <li>values[2]: Angular speed around the z-axis</li>
65+
* </ul>
5866
*/
5967
float[] getGyroscopeSensorValues();
6068

@@ -66,8 +74,8 @@ public interface PSensor {
6674
/**
6775
* get sensor values
6876
*
69-
* @param sensor
70-
* @return
77+
* @param sensor type
78+
* @return sensor name
7179
*/
7280
float[] getSensorValues(String sensor);
7381

0 commit comments

Comments
 (0)