> 107
+        }else if( GpCom.ERROR_CODE.values()[code]!= GpCom.ERROR_CODE.SUCCESS){
108
+            view.showToast( GpCom.getErrorText(GpCom.ERROR_CODE.values()[code]));
165 109
         }
166 110
     }
167 111
 
@@ -197,17 +141,14 @@ public class PrinterSettingPresenter implements PrinterSettingContract.Presenter
197 141
 
198 142
     @Override
199 143
     public void connectPrinter(BluetoothDevice device) {
200
-        if(mGpService==null){
144
+        if(printerService==null){
201 145
             view.showToast(context.getString(R.string.printer_service_boot_fail));
202 146
             return;
203 147
         }
204
-        try {
205
-            int code = mGpService.openPort(0, PortParameters.BLUETOOTH, device.getAddress(), 0);
206
-            if(code==0){
207
-                Preferences.getInstance().setPrinterMac(device.getAddress());
208
-            }
209
-            LogHelper.d(TAG,"open port return code ="+code);
210
-        } catch (Exception e) {
148
+        int code = printerService.connectPrinter(device);
149
+        if(code==0){
150
+            Preferences.getInstance().setPrinterMac(device.getAddress());
151
+        }else{
211 152
             view.showToast(context.getString(R.string.printer_port_open_fail));
212 153
         }
213 154
 
@@ -223,12 +164,6 @@ public class PrinterSettingPresenter implements PrinterSettingContract.Presenter
223 164
         }
224 165
     }
225 166
 
226
-    private void startAndBindPrintService() {
227
-        Intent intent = new Intent(App.getAppContext(), GpPrintService.class);
228
-        App.getAppContext().startService(intent);
229
-        conn = new PrinterServiceConnection();
230
-        App.getAppContext().bindService(intent, conn, Context.BIND_AUTO_CREATE);
231
-    }
232 167
 
233 168
     // changes the title when discovery is finished
234 169
     private final BroadcastReceiver mFindBlueToothReceiver = new BroadcastReceiver() {
@@ -264,12 +199,11 @@ public class PrinterSettingPresenter implements PrinterSettingContract.Presenter
264 199
         public void onReceive(Context context, Intent intent) {
265 200
             if (GpCom.ACTION_CONNECT_STATUS.equals(intent.getAction())) {
266 201
                 int type = intent.getIntExtra(GpPrintService.CONNECT_STATUS, 0);
267
-                int id = intent.getIntExtra(GpPrintService.PRINTER_ID, 0);
268 202
                 Log.d(TAG, "connect status " + type);
269 203
                 if (type == GpDevice.STATE_CONNECTING) {
270 204
                     view.onPrinterStatusFetched(context.getString(R.string.connecting));
271 205
                 } else if (type == GpDevice.STATE_NONE) {
272
-
206
+                    view.onPrinterStatusFetched(context.getString(R.string.connecting));
273 207
                 } else if (type == GpDevice.STATE_VALID_PRINTER) {
274 208
                     view.onPrinterStatusFetched(context.getString(R.string.printer_is_connected));
275 209
                 } else if (type == GpDevice.STATE_INVALID_PRINTER) {

kodo - Gogs: Go Git Service

Geen omschrijving

huangqimin001: 99c26823a0 :art: Update qiniuonce 1 jaar geleden
..
management 99c26823a0 :art: Update qiniuonce 1 jaar geleden
migrations b95db9c5c3 Basic gis command 7 jaren geleden
__init__.py b95db9c5c3 Basic gis command 7 jaren geleden
admin.py b95db9c5c3 Basic gis command 7 jaren geleden
apps.py b95db9c5c3 Basic gis command 7 jaren geleden
models.py b95db9c5c3 Basic gis command 7 jaren geleden
tests.py b95db9c5c3 Basic gis command 7 jaren geleden
views.py b95db9c5c3 Basic gis command 7 jaren geleden
adminSystem - Gogs: Go Git Service

No Description

README.md 3.7KB

clone-deep NPM version NPM monthly downloads NPM total downloads Linux Build Status

Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives.

Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your :heart: and support.

Install

Install with npm:

$ npm install --save clone-deep

Usage

var cloneDeep = require('clone-deep');

var obj = {a: 'b'};
var arr = [obj];

var copy = cloneDeep(arr);
obj.c = 'd';

console.log(copy);
//=> [{a: 'b'}]

console.log(arr);
//=> [{a: 'b', c: 'd'}]

Heads up!

The instanceClone function is invoked to clone objects that are not "plain" objects (as defined by isPlainObjectisPlainObject) if it is provided. If instanceClone is not specified, it will not attempt to clone non-plain objects, and will copy the object reference.

Attribution

Based on mout's implementation of deepClone.

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Running Tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Related projects

You might also be interested in these projects:

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on November 16, 2017.