def []=(service, characteristic, val, raw: false, async: false)
      _require_connection!
      uuid  = _uuid_characteristic(characteristic)
      chars = _characteristics(service)
      raise Service::NotFound,        service        if chars.nil?
      char  = chars[uuid]
      raise Characteristic::NotFound, characteristic if char.nil?

      if char.flag?('write') ||
        char.flag?('write-without-response')
        async ? char.async_write(val, raw: raw) : char.write(val, raw: raw)
      elsif char.flag?('encrypt-write') ||
          char.flag?('encrypt-authenticated-write')
        raise NotYetImplemented
      else
        raise AccessUnavailable
      end
    end
def []=(service, characteristic, val, raw: false, async: false)
      _require_connection!
      uuid  = _uuid_characteristic(characteristic)
      chars = _characteristics(service)
      raise Service::NotFound,        service        if chars.nil?
      char  = chars[uuid]
      raise Characteristic::NotFound, characteristic if char.nil?

      if char.flag?('write') ||
        char.flag?('write-without-response')
        async ? char.async_write(val, raw: raw) : char.write(val, raw: raw)
      elsif char.flag?('encrypt-write') ||
          char.flag?('encrypt-authenticated-write')
        raise NotYetImplemented
      else
        raise AccessUnavailable
      end
    end
Set value for a service/characteristic

 @param service [String, Symbol]
 @param characteristic [String, Symbol]
 @param val [Boolean]
 @param raw [Boolean] When raw is true the value set is a binary string, instead of an object corresponding to the decoded characteristic (float, integer, array, ...).
 @raise [NotConnected] if device is not in a connected state
 @raise [NotYetImplemented] encryption is not implemented yet
 @raise [Service::NotFound, Characteristic::NotFound] if service/characteristic doesn't exist on this device
 @raise [AccessUnavailable] if not available for writing
 @return [void]