Ejemplo n.º 1
0
bool KeystoreClientImpl::oneShotOperation(KeyPurpose purpose, const std::string& key_name,
                                          const AuthorizationSet& input_parameters,
                                          const std::string& input_data,
                                          const std::string& signature_to_verify,
                                          AuthorizationSet* output_parameters,
                                          std::string* output_data) {
    uint64_t handle;
    auto result =
        beginOperation(purpose, key_name, input_parameters, output_parameters, &handle);
    if (!result.isOk()) {
        ALOGE("BeginOperation failed: %d", int32_t(result));
        return false;
    }
    AuthorizationSet empty_params;
    size_t num_input_bytes_consumed;
    AuthorizationSet ignored_params;
    result = updateOperation(handle, empty_params, input_data, &num_input_bytes_consumed,
                             &ignored_params, output_data);
    if (!result.isOk()) {
        ALOGE("UpdateOperation failed: %d", int32_t(result));
        return false;
    }
    result =
        finishOperation(handle, empty_params, signature_to_verify, &ignored_params, output_data);
    if (!result.isOk()) {
        ALOGE("FinishOperation failed: %d", int32_t(result));
        return false;
    }
    return true;
}
Ejemplo n.º 2
0
  void Mistress::opLoad()
  {
    beginOperation( Operation_Load );

    void* buffer;
    uint16_t length;

    DEBUG( "Loading graphs from flash" );
    mMemory.readSector( Memory::Sector_Graphs, buffer, length );
    if ( length > 0 )
    {
      JsonValue value;
      JsonAllocator allocator;
      JsonParseStatus status = jsonParse( (char*)buffer, &value, allocator );
      SPARK_ASSERT( status == JSON_PARSE_OK );
      mGraphs.fromJSON( value );
      free( buffer );
    }

    DEBUG( "Loading vibrators from flash" );
    mMemory.readSector( Memory::Sector_Vibrators, buffer, length );
    if ( length > 0 )
    {
      JsonValue value;
      JsonAllocator allocator;
      JsonParseStatus status = jsonParse( (char*)buffer, &value, allocator );
      SPARK_ASSERT( status == JSON_PARSE_OK );
      mVibrators.fromJSON( value );
      free( buffer );
    }

    endOperation( Operation_Load );
  }
Ejemplo n.º 3
0
  void Mistress::opExportFunctions()
  {
    beginOperation( Operation_Export );

    mSelf = this;
    DEBUG( "Exporting cloud functions" );
    Spark.function( cSparkVibratorCommand, vibratorCommandFwd );

    endOperation( Operation_Export );
  }
Ejemplo n.º 4
0
KoView::KoView( KoDocument *document, QWidget *parent, const char *name )
 : QWidget( parent, name )
{
  Q_ASSERT( document );

  //kdDebug(30003) << "KoView::KoView " << this << endl;
  d = new KoViewPrivate;
  d->m_doc = document;
  KParts::PartBase::setPartObject( this );

  setFocusPolicy( StrongFocus );

  setMouseTracking( true );

  connect( d->m_doc, SIGNAL( childChanged( KoDocumentChild * ) ),
           this, SLOT( slotChildChanged( KoDocumentChild * ) ) );

  connect( d->m_doc, SIGNAL( sigBeginOperation() ),
           this, SLOT( beginOperation() ) );

  connect( d->m_doc, SIGNAL( sigEndOperation() ),
           this, SLOT( endOperation() ) );


  actionCollection()->setWidget( this );
  setupGlobalActions();
  KActionCollection *coll = actionCollection();
  /**** not needed anymore, according to David (Werner)
  QValueList<KAction*> docActions = document->actionCollection()->actions();
  QValueList<KAction*>::ConstIterator it = docActions.begin();
  QValueList<KAction*>::ConstIterator end = docActions.end();
  for (; it != end; ++it )
      coll->insert( *it );
  */

  KStatusBar * sb = statusBar();
  if ( sb ) // No statusbar in e.g. konqueror
  {
      coll->setHighlightingEnabled( true );
      connect( coll, SIGNAL( actionStatusText( const QString & ) ),
               this, SLOT( slotActionStatusText( const QString & ) ) );
      connect( coll, SIGNAL( clearStatusText() ),
               this, SLOT( slotClearStatusText() ) );

      connect( d->m_doc, SIGNAL( sigStatusBarMessage( const QString& ) ),
               this, SLOT( slotActionStatusText( const QString& ) ) );
      connect( d->m_doc, SIGNAL( sigClearStatusBarMessage() ),
               this, SLOT( slotClearStatusText() ) );
  }
  d->m_doc->setCurrent();

  d->m_scrollTimer = new QTimer( this );
  connect (d->m_scrollTimer, SIGNAL( timeout() ), this, SLOT( slotAutoScroll() ) );
}
Ejemplo n.º 5
0
  void Mistress::opUpdateVariables()
  {
    beginOperation( Operation_Update );

    DEBUG( "Updating cloud variables" );
    Spark.variable( cSparkGraphsVariable,
      (void*)mGraphs.toJSON().c_str(), STRING );
    Spark.variable( cSparkVibratorsVariable,
      (void*)mVibrators.toJSON().c_str(), STRING );

    endOperation( Operation_Update );
  }
Ejemplo n.º 6
0
  void Mistress::opSave()
  {
    beginOperation( Operation_Save );

    DEBUG( "Writing graphs to flash" );
    mMemory.writeSector( Memory::Sector_Graphs, mGraphs.toJSON() );

    DEBUG( "Writing vibrators to flash" );
    mMemory.writeSector( Memory::Sector_Vibrators, mVibrators.toJSON() );

    endOperation( Operation_Save );
  }