Commit Graph

284 Commits (0b4b2afaf42f6af1fa3a3c12ceffe560aed49bd0)

Author SHA1 Message Date
Michal Paszta 56ede3aa91 Fix unittests after ExhaustibleBlockDevice adjustments for wear leveling test 2020-05-05 12:10:41 +03:00
Martin Kojtal d1ae0d570c
Merge pull request #12425 from kjbracey-arm/chrono
C++ Chrono support
2020-04-30 11:41:43 +02:00
Martin Kojtal 4f9d21b16a
Merge pull request #12694 from kivaisan/remove_netsocket_icetea_and_tcpserver
Remove netsocket icetea tests and TCPServer
2020-04-29 13:46:44 +02:00
Rajkumar Kanagaraj c71c980ccd Fix the CI build and unit test issue 2020-04-27 10:19:08 +03:00
Arto Kinnunen 329c5d8538 Add unittests for added methods
Add unit tests for added methods:
 -get_rtt_estimate_to_address
 -get_stagger_estimate_to_address
2020-04-23 11:58:51 +03:00
Martin Kojtal 8926ea0983
Merge pull request #12763 from kivaisan/fix_athandler_read_string
Cellular: Fix ATHandler::read_string to handle delimiter inside string
2020-04-15 09:27:40 +02:00
Kimmo Vaisanen 236054175b Netsocket: Remove deprecated TCPServer
TCPSocket should be used instead.
2020-04-14 12:13:08 +03:00
Kimmo Vaisanen 584d54e955 Cellular: Fix ATHandler::read_string to handle delimiter inside string
For example if input buffer includes:
+CCLK: "20/04/05,15:38:57+12"

read_string return "20/04/05,15:38:57+12" instead of "20/04/05"
2020-04-06 16:28:04 +03:00
Kevin Bracey 874e36e05a Fully enforce NonCopyable
Make NonCopyable fully operational so it gives compile errors in all
build profiles.
2020-03-31 19:01:42 +03:00
Martin Kojtal dba3962f16
Merge pull request #12570 from kjbracey-arm/nsapics
Improve nsapi_create_stack
2020-03-31 16:34:20 +02:00
Kevin Bracey bb733f1ee8 Callback updates
* Optimise clearing by adding `nullptr` overload. This overload means
  `Callback(NULL)` or `Callback(0)` will no longer work; users must
  use `Callback(nullptr)` or `Callback()`.
* Optimise clearing by not clearing storage - increases code size of
  comparison, but that is extremely rare.
* Reduce ROM used by trivial functors - share copy/destroy code.
* Config option to force trivial functors - major ROM saving by
  eliminating the "operations" table.
* Config option to eliminate comparison altogether - minor ROM saving by
  eliminating zero padding.
* Conform more to `std::function` API.
2020-03-11 15:46:03 +02:00
Kevin Bracey 0cf1fd7811 Remove unnecessary NetworkStack casts 2020-03-05 16:45:36 +02:00
Kevin Bracey 70a6701006 Improve nsapi_create_stack
Use tag dispatch to better handle both NetworkInterface and NetworkStack
pointers.

The previous design was intended to avoid ambiguities when presented
with a scenario like

    class MyDevice : public NetworkInterface, public NetworkStack {
    };

    TCPSocket(&MyDevice);
    // Need NetworkStack *: use NetworkInterface::get_stack or
    // cast to NetworkStack?

But the previous solution didn't actually work as intended. The overload
pair

    nsapi_create_stack(NetworkStack *);
    // versus
    template <class IF>
    nsapi_create_stack(IF *);

would only select the first form if passed an exact match -
`NetworkStack *`. If passed a derived class pointer, like `MyDevice *`,
it would select the template.

This meant that an ambiguity for MyDevice was at least avoided, but
in the wrong direction, potentially increasing code size.

But in other cases, the system just didn't work at all - you couldn't
pass a `MyStack *` pointer, unless you cast it to `NetworkStack *`.
Quite a few bits of test code do this.

Add a small bit of tag dispatch to prioritise the cast whenever the
supplied pointer is convertible to `NetworkStack *`.
2020-03-05 16:45:36 +02:00
Martin Kojtal f4df4e75ea
Merge pull request #12487 from kjbracey-arm/override_nsapi
C++11-ify virtualisation in netsocket
2020-03-03 09:57:57 +00:00
Kevin Bracey d8d35eda9f C++11-ify virtualisation in netsocket
Use `override` and `final` where appropriate, and eliminate unnecessary
`virtual`.

Some other C++11 simplifications.

Reduces code size.
2020-02-28 13:34:18 +02:00
Anna Bridge 8c17270306
Merge pull request #12480 from 0xc0170/fix_spdx
Fix SPDX identifiers and licenses (excluding features and targets)
2020-02-21 16:34:30 +00:00
Martin Kojtal 8f1bf967d3
Merge pull request #11942 from michalpasztamobica/remove_deprecated_apis
IPCore String-based API removal
2020-02-21 12:14:06 +00:00
Martin Kojtal 2d7e1ba943 unittest: fix missing licenses + spdx 2020-02-21 07:01:00 +00:00
Martin Kojtal bac5ffec85
Merge pull request #12398 from michalpasztamobica/block_device_unittests
Add BlockDevice unittests and fix issues they revealed
2020-02-14 08:23:06 +00:00
Michal Paszta 34eb432b70 unittests: Fix memory leak in FlashSimBD test 2020-02-13 08:59:39 +02:00
Michal Paszta 31ce76487f unittests: BlockDevice unittests improvements
Moved the existing BufferedBlockDevice to features/storage unittests and switched it to gmock.
Added gmock-based unit tests to all other BlockDevice classes.
SlicingBlockDevice test left as a module test.
2020-02-10 19:36:52 +02:00
Kimmo Vaisanen a66f15dc4b Testing: Fix buffer overflow in ATHandler_read_bytes UT test
Fixes issue #12390
2020-02-10 09:52:39 +02:00
Martin Kojtal d847f9f164
Merge pull request #12305 from kivaisan/remove_multi_athandler_support_v2
Cellular: Remove support for multiple ATHandlers
2020-02-07 11:00:41 +00:00
Michal Paszta d9e37e7212 Unittests fixed not to use deprecated string-based API 2020-02-06 11:27:50 +02:00
Martin Kojtal 8dc15ee6e1
Merge pull request #12293 from mirelachirica/remove_empty_api
Cellular: Remove API's empty default implemetations
2020-02-06 09:05:40 +00:00
Kimmo Vaisanen bd0f939277 Cellular: Remove support for multiple ATHandlers
Major changes:
- Dependency to FileHandle removed from base classes
- AT_CellularDevice owns the default FileHandle and shares it with AT -classes
- Hang-up -detection moved as CellularContext::configure_hup(). Cannot be configured via CellularDevice any more.

Result on NRF52840_DK + BG96:
GCC:
Total Static RAM memory (data + bss): 29360(+296) bytes
Total Flash memory (text + data): 130660(-832) bytes

ARM:
Total Static RAM memory (data + bss): 261554(+8) bytes
Total Flash memory (text + data): 127573(-1193) bytes

IAR:
Total Static RAM memory (data + bss): 25479(+296) bytes
Total Flash memory (text + data): 102418(-527) bytes

RAM increase is because now ATHandler is no longer created with new -operator but is now member of AT_CellularDevice,
so image tool is able to count it. Actually total RAM consumption has decreased due to removed variables.
2020-01-23 09:27:44 +02:00
Mirela Chirica e2048b06b2 Cellular: Remove API's empty default implemetations 2020-01-21 10:45:09 +02:00
Ari Parkkila 2871721e08 Cellular: Refactor socket_stack_init() from generic to modem specific 2020-01-20 00:56:09 -08:00
Martin Kojtal ecf4d62dc5
Merge pull request #12265 from AriParkkila/cell-fea-refactor
Refactor unnecessary functions from cellular driver
2020-01-17 13:57:06 +00:00
Ari Parkkila f9eef97ead Cellular Refactor get_send_delay() into CellularProperty 2020-01-17 00:28:41 -08:00
Hugues Kamba 9e11e5b43d Cellular: Replace UARTSerial references with BufferedSerial
`BufferedSerial` is `UARTSerial` renamed to convey the original purpose
of the class. It is the recommended buffered I/O serial class.
2020-01-16 16:22:07 +00:00
Ari Parkkila ceea992b40 Cellular: Refactor is_protocol_supported() into CellularProperty 2020-01-15 23:04:00 -08:00
Ari Parkkila e2cb18061e Cellular: Refactor get_max_socket_count() into CellularProperty 2020-01-15 23:04:00 -08:00
Kimmo Vaisanen 0d525fff29 Cellular: Remove deprecated CellularDevice::stop()
CellularDevice::shutdown() should be used instead.
2020-01-14 10:47:05 +02:00
Martin Kojtal 1fb9dd7ddd
Merge pull request #12122 from AnttiKauppila/visibility_fixes
ATHandler refactoring
2020-01-09 12:05:08 +01:00
Martin Kojtal 8d94d4ce92
Merge pull request #12214 from kivaisan/move_string_to_pdp_type_to_cellularcontext
Cellular: Move string_to_pdp_type method to CellularContext
2020-01-08 16:59:58 +01:00
Roman Volosatovs 21b0463653
Fix dl_channel tests 2020-01-08 11:54:05 +01:00
Kimmo Vaisanen 0d7cc428b1 Cellular: Move string_to_pdp_type method to CellularContext
string_to_pdp_type is only used in CellularContext classes and by having
the conversion method in CellularContext it can be used to check also
the non-standard Non-IP PDP type string.
2020-01-08 12:15:51 +02:00
Antti Kauppila 5553d0acd3 ATHandler class refactor
Refactored ATHandler class to have clear private and public elements
Also removed virtuality from ATHandler
Unittests updated to reflect changes
2020-01-07 17:15:27 +02:00
Antti Kauppila 36ca4d6516 ATHandler relocated
ATHandler is part of our API so header file was moved under API folder and .cpp file was moved under device/ folder
ATHandler is used in both AT and PPP mode so it has been in slightly wrong place at the beginning.
2020-01-07 17:15:27 +02:00
Martin Kojtal 3e790cc9ab
Merge pull request #12065 from AriParkkila/cell-fea-nidd
Non-IP socket implementation for NIDD over CP
2020-01-07 15:55:15 +01:00
Martin Kojtal 9d16a17e7e
Merge pull request #11653 from tymoteuszblochmobica/multiple
Add  Getaddrinfo interface for multiple DNS adresses
2020-01-07 14:53:36 +01:00
Ari Parkkila 913cbd96a6 Cellular: Change 3GPP TS 27.007 NIDD to async
Add a missing license header.
Remove semaphores and add +CRTDCP to support async operation.
Fix delete context and disconnect to execute just once.
Add support for NONIP PPD type.
Change CellularNetwork::clear() to virtual so it can be overridden.
2020-01-06 22:35:18 -08:00
Kimmo Vaisanen 6c647104c7 Cellular: Move cellular event queue thread ownership to CellularDevice
Earlier CellularDevice has owned event queue used by cellular (state machine and ATHandler for example),
but the thread used to dispatch the queue has been owned by state machine.

This commit moves the event queue thread to CellularDevice so now the ownership of cellular event queue
is in one place.
2020-01-07 08:28:30 +02:00
Antti Kauppila 814ba5ab4d Fixed Non-IP cellular socket unittest 2019-12-27 16:04:10 +01:00
Antti Kauppila 48cf631456 relocated NonIP related files to netsocket root folder 2019-12-27 16:04:10 +01:00
Tymoteusz Bloch 8b2f4c2e7e Getaddrinfo interface for multiple DNS adresses added.
New members are added to the network interface
-getaddrinfo
-getaddrinfo_async
gethostbyname is unchanged but gethostbyname_async  result param now contains results od DNS records found.
Test cases for sync/async added added to DNS test folder.
2019-12-16 13:59:46 +01:00
Martin Kojtal fd4288a0dc
Merge pull request #12027 from michalpasztamobica/dns_module_test
Modify nsapi_dns tests to be module tests
2019-12-16 09:49:16 +01:00
Antti Kauppila 40fcdb731b Unittest cleanup made
CellularDevice still had the old way of defining built time defines and is now removed.
Other unittests needed some minor fixes after this.
2019-12-11 12:05:02 +02:00
Antti Kauppila bda2d37bda Unittests fixed
PRs 12051 and 11996 were merged simultaneously without running tests in between.
This caused unittests to brake and those are fixed with this commit.
2019-12-10 18:02:14 +02:00