Skip to content

Commit

Permalink
wip, adding support to toggle printer model, and other settings, via …
Browse files Browse the repository at this point in the history
…config.xml. Need to figure out how to set PriterInfo.printerModel from the config (lines 201 and 301 of this commit)
  • Loading branch information
gordol committed Aug 26, 2016
1 parent 161fcc6 commit e2c27e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ __Tested models:__ `QL-720NW`

(if you have tried this with other models, please update this list and send a pull request)

__NOTE:__ Currently, you will need to adjust the `modelName` variable in `src/android/BrotherPrinter.java`. It is the first variable in the `BrotherPrinter` class. This could be extended to be configured through config.xml or via a JS call, but it's currently hard-coded. Feel free to send a pull request to make the configuration more extensible...
__NOTE:__ You must set the model name via `config.xml` preferences, using the example below... If no value is set, the default is `QL-720NW`.

```xml
<preference name="brother-label-printer-model" value="QL-720NW"/>
```


## Supported interfaces (by this plugin):
Expand Down
7 changes: 5 additions & 2 deletions src/android/BrotherPrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@

public class BrotherPrinter extends CordovaPlugin {

String modelName = "QL-720NW";
String modelName = cordova.getActivity().getIntent().getStringExtra("brother-label-printer-model");
if (modelName == null) {
modelName = "QL-720NW";
}

private NetPrinter[] netPrinters;

private String ipAddress = null;
Expand Down Expand Up @@ -238,7 +242,6 @@ public void run() {
});
}


private void sendUSBConfig(final JSONArray args, final CallbackContext callbackctx){

cordova.getThreadPool().execute(new Runnable() {
Expand Down

0 comments on commit e2c27e3

Please sign in to comment.