Coder Social home page Coder Social logo

cornucopiastreams's Introduction

🐚 The "horn of plenty" – a symbol of abundance.

cornucopiastreams's People

Contributors

mickeyl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cornucopiastreams's Issues

Add Unit Tests

Unfortunately there are no unit tests for this package yet.

reading a stream returns 0 bytes when stream continuously hasBytesAvailable

I'm in the process of trying to (fork &) port https://github.com/arnecs/MQTTKit to Linux with Swift 5.4 on arm64 (Raspberry Pi). It uses Stream.getStreamsToHost(withName:port:inputStream:OutputStream) that I've translated into Stream.CC_getStreamPair(to:) { result in } and this works great on macOS, full MQTT functionality of the library is working on macOS. However, when I run it on Linux, the input stream has bytes available but the read always returns 0 bytes and the buffer is never populated with data.

The offending call is at https://github.com/arnecs/MQTTKit/blob/ec894640f1ea27f758b3f4d22722d83159773cd0/Sources/MQTTSession.swift#L248
Any idea on how to get this to work on Linux? Yes I know NIO might be more appropriate for linux, but for other reasons I can't use NIO.

TIA

Transport Layer Security Support

As previously discussed, Cornucopia-Streams does not support TLS streams yet.

It would be cool to have that capability. Note that ­– since this product supports not only APPLE platforms ­– it also needs to work on Linux et. al. If we were to implement it, we would need to depend on a (hopefully small) TLS library for !APPLE platforms.

I don't have any immediate need for this feature, but would welcome a pull request.

Enhance BLE-URL to select a concrete device.

(This is semi-forwarded by mickeyl/core-bluetooth-tool#1)

The URL for BLE streams, e.g., ble://fff0 right now only features a service UUID specifier. This is kind of unfortunate when it comes to multiple devices that might be servicing that. I propose to enhance the URL format like that:

  • ble://fff0 continues to work like before, it takes the first device that offers fff0 as its primary service.
  • ble://fff0/F890A301-A464-D37C-AAFB-9374B546F7FE will wait for the concrete device to appear and connect to its service.

Introducing The Big Rewrite

I have decided to (pretty much) rewrite CornucopiaStreams ­– the major reason being me and Swift having changed quite a bit over the last two years.

With 2.0, I'm trying to achieve two things ­– lifecycle and async correctness:

  1. Lifecycle correctness: In 1.0, CornucopiaStreams was still active after the connection was established. It held some references and to cleanup correctly, you would have to notify CornucopiaStreams after you were done with your stream usage. In 2.0, I have shifted CornucopiaStreams to be much more of a broker, hence it pretty much moves away once the connection has been established.
  2. Async correctness: The whole framework is now based around Swift asynchronous connect call. Since many of the connectors do their work inherently asynchronously, this matches the problem domain much better. Moreover, cancelling now works correctly and there are no more memory leaks.

While 1.0 was implemented as an extension on Foundation's Stream, it felt more natural to move it into its own namespace. Therefore, an API change was inevitable. The last version of 1.0 is still available on the legacy branch.

BLE: Signal Strength Notification

In some cases, we might want to show the BLE signal strength for the connected device.

Since we have to keep a strong handle to the connected peripheral over the lifetime of the connection anyways, it would be helpful to add a way to gather this.

Since we do not have any other handles, it has to use the out-of-band scheme introduced with meta.

tty: Handle port configuration

For serial ports (URLs with the tty scheme), we should allow configuring the bitrate.

For most platforms, this can happen before opening the file descriptor.
On macOS though, the bitrate needs to be configured after opening the port.

It's a bit annoying to put the burden for that on the call site.

Implement

Can you please show a vivid code to implement the bluetooth option of this library?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.