private void writeCreateRequest ( final int type , final int size ) throws DeviceDisconnectedException , DfuException , UploadAbortedException , RemoteDfuException , UnknownResponseException { if ( ! mConnected ) throw new DeviceDisconnectedException ( "Unable to create object: device disconnected" ) ; final byte [ ] data = ( type == OBJECT_COMMAND ) ? OP_CODE_CREATE_COMMAND : OP_CODE_CREATE_DATA ; setObjectSize ( data , size ) ; writeOpCode ( mControlPointCharacteristic , data ) ; final byte [ ] response = readNotificationResponse ( ) ; final int status = getStatusCode ( response , OP_CODE_CREATE_KEY ) ; if ( status == SecureDfuError . EXTENDED_ERROR ) throw new RemoteDfuExtendedErrorException ( "Creating Command object failed" , response [ 3 ] ) ; if ( status != DFU_STATUS_SUCCESS ) throw new RemoteDfuException ( "Creating Command object failed" , status ) ; }
Writes Create Object request providing the type and size of the object .