Skip to content

Commit

Permalink
Merge branch 'release/BEESOFT-3.11.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
João Grego committed Aug 31, 2015
2 parents 6167c9a + 7b327c0 commit 798df7e
Show file tree
Hide file tree
Showing 160 changed files with 7,344 additions and 7,126 deletions.
15 changes: 11 additions & 4 deletions beesoft-app/beesoft-usb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
</parent>
<groupId>pt.bitbox</groupId>
<artifactId>beesoft-usb</artifactId>
<version>3.10.3</version>
<version>3.11.6</version>
<name>beesoft-usb</name>
<properties>

<!-- BEESOFT software / firmware versions -->
<!-- if release.type = 'alpha' the app internally will append the
current Date to the version -->
<release.type></release.type>
<project.release.version>3.10.3</project.release.version>
<release.type>stable</release.type>
<project.release.version>3.11.6</project.release.version>
<maven.build.timestamp.format>yyyy.MM.dd_HH'h'mm</maven.build.timestamp.format>
<build.number>${maven.build.timestamp}</build.number>
<!-- #################################### -->
Expand Down Expand Up @@ -618,7 +618,7 @@
</plugin>
</plugins>
</build>
</profile>
</profile>
</profiles>
<dependencies>
<dependency>
Expand Down Expand Up @@ -688,6 +688,13 @@
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.19</version>
<scope>compile</scope>
</dependency>

<!-- Tests dependencies -->
<dependency>
<groupId>junit</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package pt.beeverycreative.beesoft.drivers.usb;

import replicatorg.app.Base;

/**
*
* @author dev
*/
public enum PrinterInfo {
BEETHEFIRST0 ((short) 0xffff, (short) 0x014e, "BEEVC-BEETHEFIRST0-Firmware-"+Base.VERSION_FIRMWARE_FINAL+".BIN", "logo_beethefirst.png"),
BEETHEFIRST ((short) 0x29c9, (short) 0x0001, "BEEVC-BEETHEFIRST-Firmware-"+Base.VERSION_FIRMWARE_FINAL+".BIN", "logo_beethefirst.png"),
BEETHEFIRSTPLUS ((short) 0x29c9, (short) 0x0002, "BEEVC-BEETHEFIRSTPLUS-Firmware-"+Base.VERSION_FIRMWARE_FINAL+".BIN", "logo_beethefirst_plus.png"),
BEEME ((short) 0x29c9, (short) 0x0003, "BEEVC-BEEME-Firmware-"+Base.VERSION_FIRMWARE_FINAL+".BIN", "logo_beeme.png"),
BEEINSCHOOL ((short) 0x29c9, (short) 0x0004, "BEEVC-BEEINSCHOOL-Firmware-"+Base.VERSION_FIRMWARE_FINAL+".BIN", "logo_beeinschool.png"),
UNKNOWN ((short) 0x0000, (short) 0x0000, "", "");

private final short productID;
private final short vendorID;
private final String firmwareFilename;
private final String iconFilename;

PrinterInfo(short vendorID, short productID, String firmwareFilename, String iconFilename) {
this.productID = productID;
this.vendorID = vendorID;
this.firmwareFilename = firmwareFilename;
this.iconFilename = iconFilename;
}

public short productID() {
return productID;
}

public short vendorID() {
return vendorID;
}

public String firmwareFilename() {
return firmwareFilename;
}

public String iconFilename() {
return iconFilename;
}

public String versionString() {
return vendorID + ":" + productID;
}

public static PrinterInfo getDevice(String versionString) {
for(PrinterInfo printer : PrinterInfo.values()) {
if(printer.versionString().equalsIgnoreCase(versionString)) {
return printer;
}
}
return UNKNOWN;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,8 @@ public class UsbDriver extends DriverBaseImplementation {
protected static String oldCompatibleVersion = "BEETHEFIRST-3.";
private final short BEEVERYCREATIVE_VENDOR_ID = (short) 0xffff;
private final short BEEVERYCREATIVE_NEW_VENDOR_ID = (short) 0x29c9;


protected final String BEETF_0 = (short)0xffff +":"+ (short) 0x014e;
protected final String BEETF_1 = (short)0x29c9 +":"+ (short) 0x0001;
protected final String BEE_PLUS = (short)0x29c9 +":"+ (short) 0x0002;
protected final String BEE_ME = (short)0x29c9 +":"+ (short) 0x0003;
protected final String BEE_IN_SCHOOL = (short)0x29c9 +":"+ (short) 0x0004;

private final String[] KNOWN_DEVICES_LIST = { BEETF_0,
BEETF_1,
BEE_ME,
BEE_PLUS,
BEE_IN_SCHOOL };


protected String deviceString;

protected PrinterInfo connectedDevice;

//check this, maybe delete
protected boolean isNewVendorID = false;
Expand Down Expand Up @@ -212,6 +197,8 @@ public void InitUsbDevice(UsbDevice device) {
for (UsbDevice child : (List<UsbDevice>) hub.getAttachedUsbDevices()) {
InitUsbDevice(child);
}


} else {

//Try to add using the new way, then using the old way.
Expand Down Expand Up @@ -244,24 +231,17 @@ public boolean addIfCompatible(UsbDevice device) throws UsbException, Unsupporte
short idVendor = descriptor.idVendor();
short idProduct = descriptor.idProduct();


String sDevice = idVendor+":"+idProduct;

for (String knownDevice : KNOWN_DEVICES_LIST){
if(knownDevice.equalsIgnoreCase(sDevice)){

m_usbDeviceList.add(device);

Base.writeLog("Device - " + idVendor + ":" + idProduct);
Base.writeLog(device.getManufacturerString());
Base.writeLog(device.getProductString());
Base.writeLog(device.getSerialNumberString().trim());

return true;
}
// candidate
connectedDevice = PrinterInfo.getDevice(sDevice);

if(connectedDevice == PrinterInfo.UNKNOWN) {
return false;
} else {
m_usbDeviceList.add(device);
return true;
}

return false;
}

public boolean addIfCompatible_Legacy(UsbDevice device) throws UsbException, UnsupportedEncodingException {
Expand Down Expand Up @@ -323,7 +303,7 @@ public boolean addIfCompatible_Legacy(UsbDevice device) throws UsbException, Uns
/**
* Scans descriptor and inits usb device if match.
*/
public void InitUsbDevice() {
public void InitUsbDevice() throws UsbException, UnsupportedEncodingException {
m_usbDeviceList.clear();

try {
Expand Down Expand Up @@ -353,6 +333,10 @@ public void InitUsbDevice() {
} else {
//Chose the device to Initialize
m_usbDevice = m_usbDeviceList.get(0);
short idProduct = m_usbDevice.getUsbDeviceDescriptor().idProduct();
short idVendor = m_usbDevice.getUsbDeviceDescriptor().idVendor();
connectedDevice = PrinterInfo.getDevice(idVendor + ":" + idProduct);
Base.getMainWindow().getButtons().setLogo(connectedDevice.iconFilename());
if (Base.isMacOS()) {
((AbstractDevice) m_usbDevice).setActiveUsbConfigurationNumber();
}
Expand Down
Loading

0 comments on commit 798df7e

Please sign in to comment.