15d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved. 25d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// found in the LICENSE file. 45d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#ifndef DEVICE_NFC_NFC_TAG_CHROMEOS_H_ 65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#define DEVICE_NFC_NFC_TAG_CHROMEOS_H_ 75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 85d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include <string> 95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/memory/scoped_ptr.h" 115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/observer_list.h" 125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "chromeos/dbus/nfc_tag_client.h" 135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "dbus/object_path.h" 145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "device/nfc/nfc_tag.h" 155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)namespace chromeos { 175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class NfcNdefTagTechnologyChromeOS; 195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// The NfcTagChromeOS class implements device::NfcTag for the Chrome OS 215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// platform. 225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class NfcTagChromeOS : public device::NfcTag, 235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public NfcTagClient::Observer { 245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public: 255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // device::NfcTag overrides. 265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual void AddObserver(device::NfcTag::Observer* observer) OVERRIDE; 275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual void RemoveObserver(device::NfcTag::Observer* observer) OVERRIDE; 285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual std::string GetIdentifier() const OVERRIDE; 295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual TagType GetType() const OVERRIDE; 305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual bool IsReadOnly() const OVERRIDE; 315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual device::NfcTag::Protocol GetSupportedProtocol() const OVERRIDE; 325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual device::NfcTagTechnology::TechnologyTypeMask 335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) GetSupportedTechnologies() const OVERRIDE; 345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual bool IsReady() const OVERRIDE; 355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual device::NfcNdefTagTechnology* GetNdefTagTechnology() OVERRIDE; 365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // NfcTagClient::Observer overrides. 385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual void TagPropertyChanged(const dbus::ObjectPath& object_path, 395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const std::string& property_name) OVERRIDE; 405d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual void TagPropertiesReceived( 415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const dbus::ObjectPath& object_path) OVERRIDE; 425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Object path representing the remote tag object. 445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const dbus::ObjectPath& object_path() const { return object_path_; } 455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) private: 475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) friend class NfcAdapterChromeOS; 485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) explicit NfcTagChromeOS(const dbus::ObjectPath& object_path); 505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual ~NfcTagChromeOS(); 515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Object path of the tag that we are currently tracking. 535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) dbus::ObjectPath object_path_; 545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Stores whether or not the initial set of properties have been received. 565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) bool is_ready_; 575d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 585d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // The NfcNdefTagTechnology instance that allows users to perform NDEF 595d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // read and write on this tag. 605d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) scoped_ptr<NfcNdefTagTechnologyChromeOS> ndef_technology_; 615d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // List of observers interested in event notifications from us. 635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ObserverList<device::NfcTag::Observer> observers_; 645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(NfcTagChromeOS); 665d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}; 675d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 685d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} // namespace chromeos 695d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 705d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif // DEVICE_NFC_NFC_TAG_CHROMEOS_H_ 71