     private var readPromise : Promise<Characteristic>
     private var writePromises = [Promise<Characteristic>]()
     private var notificationUpdatePromise : StreamPromise<Characteristic>?
+    
+    private var writeParameters = [WriteParameters]()
+    
     private weak var _service : Service?
     
     private let profile : CharacteristicProfile

    }
    
    internal func didWrite(error:NSError?) {
        self.writing = false
        if let error = error {
            Logger.debug("failed:  uuid=\(self.uuid.UUIDString), name=\(self.name)")
            if !self.writePromise.completed {
                self.writePromise.failure(error)
            }
        } else {
            Logger.debug("success:  uuid=\(self.uuid.UUIDString), name=\(self.name)")
            if !self.writePromise.completed {
                self.writePromise.success(self)
            }
        }
    }

        self.service?.peripheral?.writeValue(value, forCharacteristic:self, type:type)
    }
    
    public func writeNext() {
        if self.writing == false && self.writeParameters.count > 0 {
            let parameters = self.writeParameters[0]
            self.writeParameters.removeAtIndex(0)
            Logger.debug("write characteristic value=\(parameters.value.hexStringValue()), uuid=\(self.uuid.UUIDString)")
            self.writeValue(parameters.value, type:parameters.type)
            self.writing = true
            ++self.writeSequence
            self.timeoutWrite(self.writeSequence, timeout:parameters.timeout)
        }
    }
}
