libserialport: cross-platform library for accessing serial ports
/***********************************************************************************
* libserialport: cross-platform library for accessing serial ports
* 说明:
* 很多时候,我们经常需要写一下串口方面的调试工具,象征一下我们的知识产权,
* 但是对于很多人来说,也许仅仅关心上层的软件,并不关心驱动上的事,所以使用串
* 口库就变成了一种很不错的选择。
*
* 2015-12-22 深圳 南山平山村 曾剑锋
**********************************************************************************/ 一、参考文档:
. C: cross-platform RS232 serial library? [closed]
http://stackoverflow.com/questions/2973402/c-cross-platform-rs232-serial-library
. request basic example code please #
https://github.com/martinling/libserialport/issues/11 二、README 翻译:
-------------------------------------------------------------------------------
libserialport: cross-platform library for accessing serial ports
libserialport: 跨平台的串口库
------------------------------------------------------------------------------- libserialport is a minimal library written in C that is intended to take care
of the OS-specific details when writing software that uses serial ports.
libserialport采用C语言编写,当我们写软件的时候可以规避一些操作系统 特有的内容。 By writing your serial code to use libserialport, you enable it to work
transparently on any platform supported by the library.
通过使用libserialport,你的软件可以在任何平台上运行。 The operations that are supported are:
支持以下操作: - Port enumeration (obtaining a list of serial ports on the system).
枚举串口
- Opening and closing ports.
打开关闭串口
- Setting port parameters (baud rate, parity, etc).
设置串口参数
- Reading, writing and flushing data.
读、写、刷新数据
- Obtaining error information.
获取错误 libserialport is an open source project released under the LGPL3+ license.
libserialport是一个开源项目,在LGPL3+协议下发行的 Status
现状
====== The library should build and work on any Windows or Unix-based system. If it
does not, please submit a bug.
该库能够在任何Windows或者Unix-based系统下工作。当然,如果不能工作,请提交bug Enumeration is currently only implemented on Windows, Mac OS X and Linux. On
other systems enumeration is not supported, but ports can still be opened by
name and then used.
枚举目前只在Windows、Mac OS X和Linux上实现了,在其他的系统上目前还不支持,
但是串口还是可以通过名字打开并使用。 If you know how to enumerate available ports on another OS, please submit a bug
with this information, or better still a patch implementing it.
如果你知道怎么枚举串口在其他的OS上,请提交对应的bug,将会实现这个功能。 Future
将来
====== Future versions will add additional API calls for obtaining metadata about a
port, e.g. for USB devices the USB VID and PID of the underlying device.
将来的版本将添加用于获取串口元数据的API,例如,获取USB底层设备的VID、PID。 Dependencies
============ On Linux, libudev is required. On other systems no other libraries are required.
在Linux系统上,libudev是依赖的库,在其他的系统上不依赖任何其他的库。 The libudev dependency could be eliminated in favour of direct sysfs queries at
the cost of some brevity. This is not currently a priority but if you feel like
doing this feel free to submit a patch. Building
编译
======== The package uses a GNU style build system and requires a Unix style shell.
On Windows it can be built with the MinGW toolchain and MSYS environment.
这个包使用GNU编译系统,需要一个Unix形式的shell,在Windows上,可以通过MinGW
工具、MSYS环境进行编译。 Run "./autogen.sh" to generate the build system, "./configure" to setup, then
"make" to build the library and "make install" to install it.
运行"./autogen.sh" 来生成编译系统,"./configure"来配置,同时"make"来生成库,
"make install"来进行安装 API
=== Doxygen API documentation is included. 三、Simple Demo:
#include <stdio.h>
#include "libserialport.h" int main ( void )
{
int i = ;
struct sp_port **ports; sp_list_ports(&ports); for (i = ; i > && ports[i]; i++)
printf("Found port: '%s'.\n", sp_get_port_name(ports[i])); sp_free_port_list(ports);
}
libserialport: cross-platform library for accessing serial ports的更多相关文章
- Gtest:Using visual studio 2017 cross platform feature to compile code remotely
参考:使用Visual Studio 2017作为Linux C++开发工具 前言 最近在学Gtest单元测试框架,由于平时都是使用Source Insight写代码,遇到问题自己还是要到Linux下 ...
- “CMake”这个名字是“cross platform make”
cmake_百度百科 https://baike.baidu.com/item/cmake/7138032?fr=aladdin CMake 可以编译源代码.制作程序库.产生适配器(wrapper). ...
- BIOS MCSDK 2.0 学习笔记(二)————使用Platform Library创建工程
[TOC] Platform Library提供了一组适用于开发板的API函数.我们可以使用它来快速入手开发板. 1.启动CCS,建立一个空的工程 2.添加include路径 "C:\Pro ...
- Comparing Xamarin and Delphi XE5 to Xcode for Cross Platform Mobile App Development
Comparing Xamarin and Delphi XE5 to Xcode for Cross Platform Mobile App Development If you are consi ...
- Using Virtual Serial Ports on Linux (Ubuntu)
http://www.xappsoftware.com/wordpress/2013/10/07/using-virtual-serial-ports-on-linux-ubuntu/?goback= ...
- V4 Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backup (Doc ID 2471245.1)
V4 Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backup (Doc ID 2471245. ...
- Cross platform
值得学习的C/C++语言开源项目 (1)ACE 庞大.复杂,适合大型项目.开源.免费,不依赖第三方库,支持跨平台. http://www.cs.wustl.edu/~schmidt/ACE.html ...
- Cross Platform Note: STD C++ Preprocessor directives & pre-defined macros
ref: http://www.cplusplus.com/doc/tutorial/preprocessor/ concolusion: directives: #define #undef #in ...
- Cross platform GUI for creating SSL certs with OpenSSL
Someone said: from : https://micksmix.wordpress.com/2012/08/09/xca-cross-platform-gui-for-creating-s ...
随机推荐
- iOS获取手机相关信息
iOS具体的设备型号: #include <sys/types.h> #include <sys/sysctl.h> - (void)test { //手机型号. size_t ...
- Xcode 创建静态库和动态库
1.linux中静态库和动态库区别: 库从本质上来说是一种可执行代码的二进制格式,可以被载入内存中执行.库分静态库和动态库两种. 静态库:这类库的名字一般是libxxx.a:利用静态函数库编译成的文件 ...
- PHP函数中默认参数的的写法
函数可以定义 C++ 风格的标量参数默认值,如下所示: Example #3 在函数中使用默认参数 <?php function makecoffee($type = "cappucc ...
- Xamarin for Visual Studio 3.11.666 稳定版 破解补丁 Version 3
前提概要 1.全新安装请参考 安装 Xamarin for Visual Studio. 2.本次补丁包含: ① Xamarin for Visual Studio 3.11.666 ② Xamari ...
- LINUX输入输出与文件——续
1 目录操作 改变目录或文件的访问权限 #include <sys/stat.h> int chmod(const char *path, mode_t mode); //mode形如07 ...
- 使用git整体流程
一.git提交代码走meger请求的整体流程 工作中使用git推代码时,如果走merge请求,那么也就是说拉代码时拉公共代码库的代码,但是提交时需要先提交到自己的代码库,然后在gitlab上提交mer ...
- java volatile 和Transient 关键字
java关键字volatile volatile修饰的成员变量在每次被线程访问时,都强迫从主内存中重读该成员变量的值.而且,当成员变量发生变化时,强迫线程将变化值回写到主内存.这样在任何时刻,两个不同 ...
- ARP欺骗与中间人攻击
前言: 上一篇WPA/WAP2wifi 密码破解笔记说到如何探测附近开放的AP并且破解进入,那么进入别人据局域网我们能干些什么呢?换句话说如果别人进入了我们内部网络,会有什么影响?本文简要介绍了ARP ...
- iOS App 唤醒另一个App
网上也有讲这块的,感觉讲得都不是很好.而且有一些细节根本没有讲清楚.这里重写整理一下相关知识点. 主要内容 URL Scheme 是什么? 项目中关键的配置 注意事项 URL Scheme 是什么? ...
- LoadRunner8 安装步骤
一.介绍 LoadRunner,是一种预测系统行为和性能的负载测试工具.通过以模拟上千万用户实施并发负载及实时性能监测的方式来确认和查找问题,LoadRunner能够对整个企业架构进行测试.企业使用L ...