当前位置: 首页>>代码示例>>Java>>正文


Java Status类代码示例

本文整理汇总了Java中org.md2k.datakitapi.status.Status的典型用法代码示例。如果您正苦于以下问题:Java Status类的具体用法?Java Status怎么用?Java Status使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Status类属于org.md2k.datakitapi.status包,在下文中一共展示了Status类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: unsubscribe

import org.md2k.datakitapi.status.Status; //导入依赖的package包/类
public PendingResult<Status> unsubscribe(final int ds_id) throws DataKitException {
    PendingResult<Status> pendingResult = new PendingResult<Status>() {
        @Override
        public Status await() {
            try {
                unsubscribeData = null;
                lock();
                ds_idOnReceiveListenerHashMap.remove(ds_id);
                Bundle bundle = new Bundle();
                bundle.putInt(Constants.RC_DSID, ds_id);
                if (context == null || context.getPackageName() == null)
                    throw new Exception("abc");
                bundle.putString(Constants.PACKAGE_NAME, context.getPackageName());
                prepareAndSend(bundle, MessageType.UNSUBSCRIBE);
                semaphoreReceive.tryAcquire(WAIT_TIME, TimeUnit.MILLISECONDS);
            } catch (Exception e) {
                unsubscribeData = null;
            } finally {
                unlock();
            }
            return unsubscribeData;
        }
    };
    return pendingResult;
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-DataKitAPI,代码行数:26,代码来源:DataKitAPIExecute.java

示例2: unregister

import org.md2k.datakitapi.status.Status; //导入依赖的package包/类
public PendingResult<Status> unregister(final DataSourceClient dataSourceClient) throws DataKitException {
    PendingResult<Status> pendingResult = new PendingResult<Status>() {
        @Override
        public Status await() {
            try {
                unregisterData = null;
                lock();
                Bundle bundle = new Bundle();
                bundle.putInt(Constants.RC_DSID, dataSourceClient.getDs_id());
                prepareAndSend(bundle, MessageType.UNREGISTER);
                semaphoreReceive.tryAcquire(WAIT_TIME, TimeUnit.MILLISECONDS);
            } catch (Exception e) {
                unregisterData = null;
            } finally {
                unlock();
            }
            return unregisterData;
        }
    };
    return pendingResult;
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-DataKitAPI,代码行数:22,代码来源:DataKitAPIExecute.java

示例3: subscribe

import org.md2k.datakitapi.status.Status; //导入依赖的package包/类
public Status subscribe(final DataSourceClient dataSourceClient, OnReceiveListener onReceiveListener) throws DataKitException {
    try {
        subscribeData = null;
        lock();
        ds_idOnReceiveListenerHashMap.put(dataSourceClient.getDs_id(), onReceiveListener);
        Bundle bundle = new Bundle();
        bundle.putInt(Constants.RC_DSID, dataSourceClient.getDs_id());
        bundle.putString(Constants.PACKAGE_NAME, context.getPackageName());
        prepareAndSend(bundle, MessageType.SUBSCRIBE);
        semaphoreReceive.tryAcquire(WAIT_TIME, TimeUnit.MILLISECONDS);
    } catch (Exception e) {
        Log.e(TAG, "Subscribe error..." + dataSourceClient.getDs_id());
        subscribeData = null;
    } finally {
        unlock();
    }
    return subscribeData;
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-DataKitAPI,代码行数:19,代码来源:DataKitAPIExecute.java

示例4: disconnectAll

import org.md2k.datakitapi.status.Status; //导入依赖的package包/类
void disconnectAll() {
    Messenger replyTo;
    Message outgoingMessage;
    Bundle bundle = new Bundle();
    bundle.putParcelable(Status.class.getSimpleName(), new Status(Status.INTERNAL_ERROR));
    outgoingMessage = prepareMessage(bundle, MessageType.INTERNAL_ERROR);

    for (String name : connectedList.keySet()) {
        replyTo = connectedList.get(name);
        try {
            replyTo.send(outgoingMessage);
        } catch (RemoteException ignored) {
        }
    }
    connectedList.clear();
    messengers.clear();
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-DataKit,代码行数:18,代码来源:ServiceDataKit.java

示例5: handleMessage

import org.md2k.datakitapi.status.Status; //导入依赖的package包/类
@Override
public void handleMessage(Message incomingMessage) {
    Message outgoingMessage;
    if (messageController == null) {
        Log.d(TAG, "error...messageController=null");
        Bundle bundle = new Bundle();
        bundle.putParcelable(Status.class.getSimpleName(), new Status(Status.INTERNAL_ERROR));
        outgoingMessage = prepareMessage(bundle, incomingMessage.what);
    } else
        outgoingMessage = messageController.execute(incomingMessage);
    if (outgoingMessage != null) {
        replyTo = incomingMessage.replyTo;
        try {
            replyTo.send(outgoingMessage);
        } catch (RemoteException ignored) {
        }
    }
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-DataKit,代码行数:19,代码来源:ServiceDataKit.java

示例6: findDataSource

import org.md2k.datakitapi.status.Status; //导入依赖的package包/类
public synchronized ArrayList<DataSourceClient> findDataSource(SQLiteDatabase db, DataSource dataSource) {
        ArrayList<DataSourceClient> dataSourceClients = new ArrayList<>();
        SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
        queryBuilder.setTables(TABLE_NAME);
        String[] columns = new String[]{C_DS_ID, C_DATASOURCE};
        String selection = prepareSelection(dataSource);
        String[] selectionArgs = prepareSelectionArgs(dataSource);
        Cursor mCursor = db.query(TABLE_NAME, columns, selection, selectionArgs, null, null, null);
        try {
            if (mCursor.moveToFirst()) {
                do {
                    byte[] bytes = mCursor.getBlob(mCursor.getColumnIndex(C_DATASOURCE));
                    DataSource curDataSource = fromBytes(bytes);
                    DataSourceClient dataSourceClient = new DataSourceClient(mCursor.getInt(mCursor.getColumnIndex(C_DS_ID)),
                            curDataSource, new Status(Status.DATASOURCE_EXIST));
//                    DataSourceClient dataSourceClient = new DataSourceClient(mCursor.getInt(mCursor.getColumnIndex(C_DS_ID)),
//                            DataSource.fromBytes(mCursor.getBlob(mCursor.getColumnIndex(C_DATASOURCE))), new Status(Status.DATASOURCE_EXIST));
                    dataSourceClients.add(dataSourceClient);
                } while (mCursor.moveToNext());
            }
            mCursor.close();
        }catch (Exception ignored){

        }
        return dataSourceClients;
    }
 
开发者ID:MD2Korg,项目名称:mCerebrum-DataKit,代码行数:27,代码来源:DatabaseTable_DataSource.java

示例7: insertDB

import org.md2k.datakitapi.status.Status; //导入依赖的package包/类
private synchronized Status insertDB(SQLiteDatabase db, String tableName) {
    try {

        if (cValueCount == 0)
            return new Status(Status.SUCCESS);


        long st = System.currentTimeMillis();
        db.beginTransaction();

        for (int i = 0; i < cValueCount; i++)
            db.insert(tableName, null, cValues[i]);
        cValueCount = 0;
        try {
            db.setTransactionSuccessful();
        } finally {
            db.endTransaction();
        }
    } catch (Exception e) {
        return new Status(Status.INTERNAL_ERROR);
    }
    return new Status(Status.SUCCESS);
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-DataKit,代码行数:24,代码来源:DatabaseTable_Data.java

示例8: notifyAllObservers

import org.md2k.datakitapi.status.Status; //导入依赖的package包/类
public Status notifyAllObservers(DataType[] dataTypes, boolean highFrequency, boolean isUpdate) {
    Status status = new Status(Status.SUCCESS);
    if (databaseSubscriber != null) {
        if (highFrequency) {
            status = databaseSubscriber.insertHF(ds_id, (DataTypeDoubleArray[]) dataTypes);
        } else {
            status = databaseSubscriber.insert(ds_id, dataTypes, isUpdate);
        }
    }

    for (Iterator<MessageSubscriber> iterator = messageSubscribers.iterator(); iterator.hasNext(); ) {
        MessageSubscriber subscriber = iterator.next();
        if (!subscriber.update(ds_id, dataTypes))
            iterator.remove();
    }
    return status;
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-DataKit,代码行数:18,代码来源:Publisher.java

示例9: updateSummary

import org.md2k.datakitapi.status.Status; //导入依赖的package包/类
public Status updateSummary(DataSource dataSource, DataType dataType) {
    Status status=null;
    for(int i=0;i<4;i++) {
        int ds_id=registerSummary(dataSource, i);
        long updatedTimestamp = getUpdatedTimestamp(dataType.getDateTime(), i);
        ArrayList<DataType> dataTypeLast = query(ds_id, 1);
        if(dataTypeLast.size()==0){
            status= publishers.receivedData(ds_id, new DataType[]{createDataType(dataType, null, updatedTimestamp)}, false);
        }else if(i==0){
            status= publishers.receivedData(ds_id, new DataType[]{createDataType(dataType, dataTypeLast.get(0), updatedTimestamp)}, true);
        }else if (dataTypeLast.get(0).getDateTime() != updatedTimestamp) {
            status= publishers.receivedData(ds_id, new DataType[]{createDataType(dataType, null, updatedTimestamp)}, false);
        } else {
            status= publishers.receivedData(ds_id, new DataType[]{createDataType(dataType, dataTypeLast.get(0),updatedTimestamp)}, true);
        }
    }
    return status;
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-DataKit,代码行数:19,代码来源:RoutingManager.java

示例10: connect

import org.md2k.datakitapi.status.Status; //导入依赖的package包/类
public synchronized void connect(OnConnectionListener callerOnConnectionListener) throws DataKitException {
    if (!isInstalled(context, Constants.PACKAGE_NAME)) {
        throw new DataKitNotFoundException(new Status(Status.ERROR_NOT_INSTALLED));
    } else if (isConnected()) callerOnConnectionListener.onConnected();
    else {
        dataKitAPIExecute.connect(callerOnConnectionListener);
        handler.postDelayed(runnableSyncHF,SYNC_TIME_HF);
    }
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-DataKitAPI,代码行数:10,代码来源:DataKitAPI.java

示例11: find

import org.md2k.datakitapi.status.Status; //导入依赖的package包/类
public synchronized ArrayList<DataSourceClient> find(DataSourceBuilder dataSourceBuilder) throws DataKitException {
    if (!dataKitAPIExecute.isConnected())
        throw new DataKitNotFoundException(new Status(Status.ERROR_BOUND));
    if (dataSourceBuilder == null)
        throw new DataKitException(new Status(Status.DATA_INVALID).getStatusMessage());
    ArrayList<DataSourceClient> dataSourceClients = dataKitAPIExecute.find(dataSourceBuilder).await();
    if (dataSourceClients == null || !dataKitAPIExecute.isConnected())
        throw new DataKitNotFoundException(new Status(Status.ERROR_BOUND));
    else return dataSourceClients;
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-DataKitAPI,代码行数:11,代码来源:DataKitAPI.java

示例12: insert

import org.md2k.datakitapi.status.Status; //导入依赖的package包/类
public synchronized void insert(DataSourceClient dataSourceClient, DataType dataType) throws DataKitException {
    if (!dataKitAPIExecute.isConnected())
        throw new DataKitNotFoundException(new Status(Status.ERROR_BOUND));
    if (dataSourceClient == null || dataType == null)
        throw new DataKitException(new Status(Status.DATA_INVALID).getStatusMessage());
    else {
        DataType[] dataTypes=new DataType[]{dataType};
        dataKitAPIExecute.insert(dataSourceClient, dataTypes);
    }
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-DataKitAPI,代码行数:11,代码来源:DataKitAPI.java

示例13: setSummary

import org.md2k.datakitapi.status.Status; //导入依赖的package包/类
public synchronized void setSummary(DataSourceClient dataSourceClient, DataType dataType) throws DataKitException {
    if (!dataKitAPIExecute.isConnected())
        throw new DataKitNotFoundException(new Status(Status.ERROR_BOUND));
    if (dataSourceClient == null || dataType == null)
        throw new DataKitException(new Status(Status.DATA_INVALID).getStatusMessage());
    else {
        dataKitAPIExecute.setSummary(dataSourceClient, dataType);
    }
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-DataKitAPI,代码行数:10,代码来源:DataKitAPI.java

示例14: insertHighFrequency

import org.md2k.datakitapi.status.Status; //导入依赖的package包/类
public synchronized void insertHighFrequency(final DataSourceClient dataSourceClient, final DataTypeDoubleArray[] dataType) throws DataKitException {
    if (!dataKitAPIExecute.isConnected())
        throw new DataKitNotFoundException(new Status(Status.ERROR_BOUND));
    if (dataSourceClient == null || dataType == null)
        throw new DataKitException(new Status(Status.DATA_INVALID).getStatusMessage());
    else {
        for (DataTypeDoubleArray aDataType : dataType)
            addToBuffer(dataSourceClient.getDs_id(), aDataType);
    }
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-DataKitAPI,代码行数:11,代码来源:DataKitAPI.java

示例15: register

import org.md2k.datakitapi.status.Status; //导入依赖的package包/类
public synchronized DataSourceClient register(final DataSourceBuilder dataSourceBuilder) throws DataKitException {
    if (!dataKitAPIExecute.isConnected())
        throw new DataKitNotFoundException(new Status(Status.ERROR_BOUND));
    if (dataSourceBuilder == null)
        throw new DataKitException(new Status(Status.DATA_INVALID).getStatusMessage());
    DataSourceClient dataSourceClient = dataKitAPIExecute.register(dataSourceBuilder).await();
    if (dataSourceClient == null || !dataKitAPIExecute.isConnected())
        throw new DataKitNotFoundException(new Status(Status.ERROR_BOUND));
    else return dataSourceClient;
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-DataKitAPI,代码行数:11,代码来源:DataKitAPI.java


注:本文中的org.md2k.datakitapi.status.Status类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。