JNIEXPORT void JNICALL Java_com_axeldroid_Axel_newTask(JNIEnv *env,
		jobject obj, jint connections, jstring filename, jobjectArray urls) {
	int argc = 6 + env->GetArrayLength(urls);
	LOGV("args length:%d", argc);
char* *argvs = new char*[argc];
	argvs[0] = "hello";
	argvs[1] = "-o";
	const char* cfn = env->GetStringUTFChars(filename, 0);
	char fn[1024] = { 0 };
	strcpy(fn, cfn);
	LOGV("output filename:%s", fn);

argvs[2] = fn;
	argvs[3] = "-n";
	char conn[10] = { 0 };
	sprintf(conn, "%d", (int) connections);
	argvs[4] = conn;
	argvs[5] = "-v";
	int i = 6;
	for (; i < argc; i++) {
		jstring str = (jstring) env->GetObjectArrayElement(urls, i - 6);
		const char* u = env->GetStringUTFChars(str, 0);
		int len = strlen(u) + 1;
		argvs[i] = new char[len];
		memcpy(argvs[i], u, len);
		
	LOGV("url NO%d:%s", i-5, argvs[i]);
}

//char *argvs[] = {"hello", "-o", "/mnt/sdcard/CZPAD/aa.war", "-n", "2", "-a", "http://localhost/CZHDP.war"};

jobject jobj=env->NewGlobalRef(obj);

axel_t* axel=gmain(argc, argvs,env,jobj,setAxelJniInfo);

if(axel==NULL){
	notifyFinish(axel,env,jobj);
}
else{
	notifyFinish(axel,env,jobj);
	axel_close(axel);
}
env->DeleteGlobalRef(jobj);

for (i = 6; i < argc; i++) {
delete[] argvs[i];
}
delete[] argvs;

}
Beispiel #2
0
void DownloadOperation::killOp()
{

  delete m_toCopy->getRoot();
  m_toCopy = NULL;

  notifyFinish();
}
void RemoteFilesDeleteOperation::killOp()
{
  delete m_toDelete->getRoot();
  m_toDelete = NULL;

  // Notify listeners that operation have ended
  notifyFinish();
}
void RemoteFileRenameOperation::onLastRequestFailedReply()
{
  StringStorage message;

  message.format(_T("Error: failed to rename remote '%s' file"),
                 m_pathToSourceFile.getString());

  notifyInformation(message.getString());

  notifyFinish();
}
void BlobResourceHandle::notifyResponse()
{
    if (!client())
        return;

    if (m_errorCode) {
        notifyResponseOnError();
        notifyFinish();
    } else
        notifyResponseOnSuccess();
}
Beispiel #6
0
void BlobResourceHandle::notifyResponse()
{
    if (!client())
        return;

    if (m_errorCode) {
        Ref<BlobResourceHandle> protectedThis(*this);
        notifyResponseOnError();
        notifyFinish();
    } else
        notifyResponseOnSuccess();
}
void DownloadOperation::killOp()
{
  //
  // If not files to download, than clear memory and
  // operation is finished
  //

  delete m_toCopy->getRoot();
  m_toCopy = NULL;

  notifyFinish();
}
Beispiel #8
0
/*public virtual */ofxSATError ofxSATTemplate::update(ofxSATTime const& time)
{
    ofxSATError error(SATERROR_OK);
    
    if ((error = super::update(time)) == SATERROR_OK) {
        while (false) {
            // TODO:
            // notifyData(time);
        }
        notifyFinish(error);
    }
    return error;
}
Beispiel #9
0
void UploadOperation::killOp()
{
    //
    // If not files to upload, than clear memory and
    // operation is finished
    //

    delete m_toCopy->getRoot();
    m_toCopy = NULL;

    // Notify listeners that operation ended
    notifyFinish();
}
void RemoteFolderCreateOperation::onLastRequestFailedReply()
{
  // Logging
  StringStorage message;

  message.format(_T("Error: failed to create remote folder '%s'"),
                 m_pathToTargetFile.getString());

  notifyError(message.getString());

  // Notify all that operation have ended
  notifyFinish();
}
void FmBkupEnginePrivate::notifyFinishInternal()
    {
//    iEngine.ClearDriveInfo();
//    PublishBurStatus( EFileManagerBkupStatusUnset );
   /* CCoeEnv* coeEnv = CCoeEnv::Static();
    iEikonEnv->SetSystem( EFalse);
    */
    CCoeEnv* coeEnv = CCoeEnv::Static();
    CEikonEnv* eikonEnv = (STATIC_CAST(CEikonEnv*,coeEnv));
    eikonEnv->SetSystem(EFalse);
    mProcess = FmBkupEngine::ProcessNone;
    emit notifyFinish( error() );
    }
Beispiel #12
0
int BlobResourceHandle::readSync(char* buf, int length)
{
    ASSERT(isMainThread());

    ASSERT(!m_async);
    Ref<BlobResourceHandle> protect(*this);

    int offset = 0;
    int remaining = length;
    while (remaining) {
        // Do not continue if the request is aborted or an error occurs.
        if (m_aborted || m_errorCode)
            break;

        // If there is no more remaining data to read, we are done.
        if (!m_totalRemainingSize || m_readItemCount >= m_blobData->items().size())
            break;
        
        const BlobDataItem& item = m_blobData->items().at(m_readItemCount);
        int bytesRead = 0;
        if (item.type == BlobDataItem::Data)
            bytesRead = readDataSync(item, buf + offset, remaining);
        else if (item.type == BlobDataItem::File)
            bytesRead = readFileSync(item, buf + offset, remaining);
        else
            ASSERT_NOT_REACHED();

        if (bytesRead > 0) {
            offset += bytesRead;
            remaining -= bytesRead;
        }
    }

    int result;
    if (m_aborted || m_errorCode)
        result = -1;
    else
        result = length - remaining;

    if (result > 0)
        notifyReceiveData(buf, result);

    if (!result)
        notifyFinish();

    return result;
}
void BlobResourceHandle::readAsync()
{
    ASSERT(m_async);

    // Do not continue if the request is aborted or an error occurs.
    if (m_aborted || m_errorCode)
        return;

    // If there is no more remaining data to read, we are done.
    if (!m_totalRemainingSize || m_readItemCount >= m_blobData->items().size()) {
        notifyFinish();
        return;
    }

    const BlobDataItem& item = m_blobData->items().at(m_readItemCount);
    if (item.type == BlobDataItem::Data)
        readDataAsync(item);
    else if (item.type == BlobDataItem::File)
        readFileAsync(item);
    else
        ASSERT_NOT_REACHED();
}
void RemoteFileRenameOperation::onMvReply()
{
  notifyFinish();
}
Beispiel #15
0
/*private virtual */void ofxEasyCubeSAT::onNotifyFinish(ofxSATError const& error)
{
    notifyFinish(error);
    return;
}
Beispiel #16
0
JNIEXPORT void JNICALL Java_com_axeldroid_Axel_axel_stop(JNIEnv *env, jobject obj,jlong paxel) {
	axel_t* axel=(axel_t*)paxel;
	notifyFinish(axel,env,obj);
	axel->run=0;
}
void RemoteFolderCreateOperation::onMkdirReply()
{
  // Notify all that operation have ended
  notifyFinish();
}