serialport 1.2.3 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/CHANGELOG +2 -0
- data/CHECKLIST +8 -1
- data/ext/native/posix_serialport_impl.c +35 -0
- data/ext/native/serialport.c +26 -0
- data/ext/native/serialport.h +3 -0
- data/ext/native/win_serialport_impl.c +36 -0
- data/lib/serialport/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjZlYWM2MWEwMTFiMzQyMTQ4OTI2Y2Q2ZDA2ZmQyMGFiMzdlZmZiMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDcwYjNlODBiMzQ5NTlkYjZmMzMwZTNjN2NkMjEyMDJhMzc4YzhkZQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Yzk4ZTYxNmY4YjViZDEyYjZjMWRiN2EwZDQ0MWVhNDQxMTFhMWRjZTg0YWY0
|
10
|
+
OTM3YmY1NjNlMjU0MGFkOGE1YTZkNTdhMGFhOTgxMDA0MzZjN2VmOGM3MGYy
|
11
|
+
ZjE2NjdlM2UzYWYzYzBlMjA4NzlkNjFmNWYzNGY5NDcyYWUwNjk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjQ3NzM5ZWQ5NTkyZWY2MGEzMmVmNmQzZTA5M2U2NjM1YzU5OGM5MWRiNGQ0
|
14
|
+
OTQzZThlNWVlNThhNjc4MDk0OTNmOWI3ZDQxYTg5ZjdkNjJmY2E0ZGZkNDNj
|
15
|
+
ZTdjMDAyMjhlZWEyYTkzNWI5YjU4Y2QxZGUxYWYyMjlmMzQ1MmU=
|
data/CHANGELOG
CHANGED
data/CHECKLIST
CHANGED
@@ -1,5 +1,12 @@
|
|
1
|
-
# Ruby-Serialport Gem
|
1
|
+
# Ruby-Serialport Gem Release Checklist
|
2
2
|
|
3
|
+
* Update documentation
|
3
4
|
* Update lib/serialport/version.rb
|
4
5
|
* Update CHANGELOG
|
5
6
|
* Update README
|
7
|
+
* `rake build`
|
8
|
+
* `rake install`
|
9
|
+
* Test build
|
10
|
+
* `git tag -a v{VERSION} -m "v{VERSION}: {ONE-LINE DESCRIPTION}"`
|
11
|
+
* Merge and Push
|
12
|
+
* `rake release`
|
@@ -3,6 +3,7 @@
|
|
3
3
|
* Alan Stern <stern@rowland.harvard.edu>
|
4
4
|
* Daniel E. Shipton <dshipton@redshiptechnologies.com>
|
5
5
|
* Ryan C. Payne <rpayne-oss@bullittsystems.com>
|
6
|
+
* Manuel "MaG" A. Güílamo <maguilamo.c@gmail.com>
|
6
7
|
*
|
7
8
|
* This code is hereby licensed for public consumption under either the
|
8
9
|
* GNU GPL v2 or greater.
|
@@ -730,4 +731,38 @@ VALUE sp_get_dtr_impl(self)
|
|
730
731
|
return INT2FIX(ls.dtr);
|
731
732
|
}
|
732
733
|
|
734
|
+
VALUE sp_flush_input_data_impl(self)
|
735
|
+
VALUE self;
|
736
|
+
{
|
737
|
+
int fd;
|
738
|
+
int ret;
|
739
|
+
|
740
|
+
fd = get_fd_helper(self);
|
741
|
+
|
742
|
+
ret = tcflush(fd, TCIFLUSH);
|
743
|
+
if(ret<0) {
|
744
|
+
return Qfalse;
|
745
|
+
}
|
746
|
+
|
747
|
+
return Qtrue;
|
748
|
+
}
|
749
|
+
|
750
|
+
VALUE sp_flush_output_data_impl(self)
|
751
|
+
VALUE self;
|
752
|
+
{
|
753
|
+
int fd;
|
754
|
+
int ret;
|
755
|
+
|
756
|
+
fd = get_fd_helper(self);
|
757
|
+
|
758
|
+
ret = tcflush(fd, TCOFLUSH);
|
759
|
+
if(ret<0) {
|
760
|
+
return Qfalse;
|
761
|
+
}
|
762
|
+
|
763
|
+
return Qtrue;
|
764
|
+
}
|
765
|
+
|
766
|
+
|
767
|
+
|
733
768
|
#endif /* !defined(OS_MSWIN) && !defined(OS_BCCWIN) && !defined(OS_MINGW) */
|
data/ext/native/serialport.c
CHANGED
@@ -489,6 +489,29 @@ static VALUE sp_signals(self)
|
|
489
489
|
return hash;
|
490
490
|
}
|
491
491
|
|
492
|
+
/**
|
493
|
+
* Flush data received but not read.
|
494
|
+
*
|
495
|
+
* @return [Boolean] true on success or false if an error occurs.
|
496
|
+
*/
|
497
|
+
static VALUE sp_flush_input_data(self)
|
498
|
+
VALUE self;
|
499
|
+
{
|
500
|
+
return sp_flush_input_data_impl(self);
|
501
|
+
}
|
502
|
+
|
503
|
+
/**
|
504
|
+
* Flush data written but not transmitted.
|
505
|
+
*
|
506
|
+
* @return [Boolean] true on success or false if an error occurs.
|
507
|
+
*/
|
508
|
+
static VALUE sp_flush_output_data(self)
|
509
|
+
VALUE self;
|
510
|
+
{
|
511
|
+
return sp_flush_output_data_impl(self);
|
512
|
+
}
|
513
|
+
|
514
|
+
|
492
515
|
void Init_serialport()
|
493
516
|
{
|
494
517
|
sBaud = rb_str_new2("baud");
|
@@ -550,6 +573,9 @@ void Init_serialport()
|
|
550
573
|
rb_define_method(cSerialPort, "dcd", sp_get_dcd, 0);
|
551
574
|
rb_define_method(cSerialPort, "ri", sp_get_ri, 0);
|
552
575
|
|
576
|
+
rb_define_method(cSerialPort, "flush_input", sp_flush_input_data, 0);
|
577
|
+
rb_define_method(cSerialPort, "flush_output", sp_flush_output_data, 0);
|
578
|
+
|
553
579
|
/*
|
554
580
|
* 0
|
555
581
|
*/
|
data/ext/native/serialport.h
CHANGED
@@ -94,4 +94,7 @@ VALUE RB_SERIAL_EXPORT sp_set_dtr_impl(VALUE self, VALUE val);
|
|
94
94
|
VALUE RB_SERIAL_EXPORT sp_get_rts_impl(VALUE self);
|
95
95
|
VALUE RB_SERIAL_EXPORT sp_get_dtr_impl(VALUE self);
|
96
96
|
|
97
|
+
VALUE RB_SERIAL_EXPORT sp_flush_input_data_impl(VALUE self);
|
98
|
+
VALUE RB_SERIAL_EXPORT sp_flush_output_data_impl(VALUE self);
|
99
|
+
|
97
100
|
#endif
|
@@ -620,4 +620,40 @@ VALUE RB_SERIAL_EXPORT sp_get_dtr_impl(self)
|
|
620
620
|
return self;
|
621
621
|
}
|
622
622
|
|
623
|
+
#define PURGE_RXABORT 0x02
|
624
|
+
#define PURGE_RXCLEAR 0x08
|
625
|
+
VALUE RB_SERIAL_EXPORT sp_flush_input_data_impl(self)
|
626
|
+
VALUE self;
|
627
|
+
{
|
628
|
+
BOOL ret;
|
629
|
+
HANDLE fh;
|
630
|
+
|
631
|
+
fh = get_handle_helper(self);
|
632
|
+
|
633
|
+
ret = PurgeComm(fh, (DWORD)(PURGE_RXCLEAR | PURGE_RXABORT));
|
634
|
+
if(!ret) {
|
635
|
+
return Qfalse;
|
636
|
+
}
|
637
|
+
return Qtrue;
|
638
|
+
}
|
639
|
+
|
640
|
+
#define PURGE_TXABORT 0x01
|
641
|
+
#define PURGE_TXCLEAR 0x04
|
642
|
+
VALUE RB_SERIAL_EXPORT sp_flush_output_data_impl(self)
|
643
|
+
VALUE self;
|
644
|
+
{
|
645
|
+
BOOL ret;
|
646
|
+
HANDLE fh;
|
647
|
+
|
648
|
+
fh = get_handle_helper(self);
|
649
|
+
|
650
|
+
ret = PurgeComm(fh, (DWORD)(PURGE_TXCLEAR | PURGE_TXABORT));
|
651
|
+
if(!ret) {
|
652
|
+
return Qfalse;
|
653
|
+
}
|
654
|
+
return Qtrue;
|
655
|
+
}
|
656
|
+
|
657
|
+
|
658
|
+
|
623
659
|
#endif /* defined(OS_MSWIN) || defined(OS_BCCWIN) || defined(OS_MINGW) */
|
data/lib/serialport/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serialport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guillaume Pierronnet
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2013-11-
|
16
|
+
date: 2013-11-24 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: bundler
|
@@ -111,3 +111,4 @@ signing_key:
|
|
111
111
|
specification_version: 4
|
112
112
|
summary: Library for using RS-232 serial ports.
|
113
113
|
test_files: []
|
114
|
+
has_rdoc:
|