~ubuntu-branches/ubuntu/feisty/k3b/feisty-backports

« back to all changes in this revision

Viewing changes to libk3bdevice/k3bdevice.h

  • Committer: Bazaar Package Importer
  • Author(s): John Dong
  • Date: 2007-09-05 10:00:13 UTC
  • mfrom: (28.1.11 gutsy)
  • Revision ID: james.westby@ubuntu.com-20070905100013-h0ey1jtz2xvd8dq2
Tags: 1.0.3-0ubuntu3~feisty1
Automated backport upload; no source changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *
3
 
 * $Id: k3bdevice.h 621086 2007-01-08 09:26:11Z trueg $
 
3
 * $Id: k3bdevice.h 679274 2007-06-23 13:23:58Z trueg $
4
4
 * Copyright (C) 2003-2007 Sebastian Trueg <trueg@k3b.org>
5
5
 *
6
6
 * This file is part of the K3b project.
39
39
   * \brief The main class representing a device.
40
40
   *
41
41
   * Devices are constructed by the DeviceManager.
 
42
   *
 
43
   * All methods except for open and close in Device are thread-safe which basicly means that
 
44
   * no two commands are sent to the device at the same time.
42
45
   */
 
46
  // FIXME: all methods are const which makes no sense at all!
43
47
  class LIBK3BDEVICE_EXPORT Device
44
48
    {
45
49
    public:
371
375
      bool load() const;
372
376
 
373
377
      /**
 
378
       * Enable or disable auto-ejecting. For now this is a no-op on non-Linux systems.
 
379
       * \param enabled if true auto-ejecting will be enabled, otherwise disabled.
 
380
       * \return true if the operation was successful, false otherwise
 
381
       */
 
382
      bool setAutoEjectEnabled( bool enabled ) const;
 
383
 
 
384
      /**
374
385
       * The supported writing modes.
375
386
       *
376
387
       * \return A bitwise or of K3bDevice::WritingMode or 0 in case of a read-only device.
443
454
       * Open the device for access via a file descriptor.
444
455
       * @return true on success or if the device is already open.
445
456
       * @see close()
 
457
       *
 
458
       * Be aware that this method is not thread-safe.
446
459
       */
447
460
      bool open( bool write = false ) const;
448
461
 
449
462
      /**
450
463
       * Close the files descriptor.
451
464
       * @see open()
 
465
       *
 
466
       * Be aware that this method is not thread-safe.
452
467
       */
453
468
      void close() const;
454
469
 
688
703
 
689
704
      bool getNextWritableAdress( unsigned int& lastSessionStart, unsigned int& nextWritableAdress ) const;
690
705
 
 
706
      /**
 
707
       * Retrieve the next writable address from the currently mounted writable medium.
 
708
       * \return The next writable address if the medium is empty or appendable or -1
 
709
       * if an error occured.
 
710
       */
 
711
      int nextWritableAddress() const;
 
712
 
 
713
      /**
 
714
       * Locks the device for usage. This means that no MMC command can be performed
 
715
       * until usageUnlock is called.
 
716
       *
 
717
       * Locking a device is useful when an external application or library is called
 
718
       * that opens the device itself.
 
719
       *
 
720
       * \sa usageUnlock
 
721
       */
 
722
      void usageLock() const;
 
723
 
 
724
      /**
 
725
       * Unlock the device after a call to usageLock.
 
726
       */
 
727
      void usageUnlock() const;
 
728
 
 
729
      /**
 
730
       * Thread-safe ioctl call for this device for Linux and Net-BSD systems.
 
731
       * Be aware that so far this does not include opening the device
 
732
       */
 
733
//      int ioctl( int request, ... ) const;
 
734
 
691
735
    protected:
692
736
      bool furtherInit();
693
737