Removed mux.

pull/6082/head
Teppo Järvelin 2018-03-02 08:41:58 +02:00 committed by Ari Parkkila
parent bfed2baeb6
commit 7c9f5f3781
34 changed files with 2 additions and 2979 deletions

View File

@ -10,7 +10,6 @@ This is the Github repo for Mbed cellular connectivity:
API Application Programming Interface for cellular connectivity
AT AT implementation based on 3GPP TS 27.007 specification
common Common and utility sources
mux MUX implementation based on 3GPP TS 27.010 specification
targets Vendor specific cellular module adaptations
## Known limitations

View File

@ -1,22 +0,0 @@
include ../../makefile_defines.txt
COMPONENT_NAME = AT_CellularMultiplexer_unit
#This must be changed manually
SRC_FILES = \
../../../framework/AT/AT_CellularMultiplexer.cpp
TEST_SRC_FILES = \
main.cpp \
at_cellularmultiplexertest.cpp \
test_at_cellularmultiplexer.cpp \
../../stubs/ATHandler_stub.cpp \
../../stubs/AT_CellularBase_stub.cpp \
../../stubs/EventQueue_stub.cpp \
../../stubs/FileHandle_stub.cpp \
../../stubs/mbed_assert_stub.cpp \
include ../../MakefileWorker.mk
CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT

View File

@ -1,49 +0,0 @@
/*
* Copyright (c) 2015, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "CppUTest/TestHarness.h"
#include "test_at_cellularmultiplexer.h"
TEST_GROUP(AT_CellularMultiplexer)
{
Test_AT_CellularMultiplexer* unit;
void setup()
{
unit = new Test_AT_CellularMultiplexer();
}
void teardown()
{
delete unit;
}
};
TEST(AT_CellularMultiplexer, Create)
{
CHECK(unit != NULL);
}
TEST(AT_CellularMultiplexer, test_AT_CellularMultiplexer_constructor)
{
unit->test_AT_CellularMultiplexer_constructor();
}
TEST(AT_CellularMultiplexer, test_AT_CellularMultiplexer_multiplexer_mode_start)
{
unit->test_AT_CellularMultiplexer_multiplexer_mode_start();
}

View File

@ -1,28 +0,0 @@
/*
* Copyright (c) 2015, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "CppUTest/CommandLineTestRunner.h"
#include "CppUTest/TestPlugin.h"
#include "CppUTest/TestRegistry.h"
#include "CppUTestExt/MockSupportPlugin.h"
int main(int ac, char** av)
{
return CommandLineTestRunner::RunAllTests(ac, av);
}
IMPORT_TEST_GROUP(AT_CellularMultiplexer);

View File

@ -1,57 +0,0 @@
/*
* Copyright (c) 2018, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "CppUTest/TestHarness.h"
#include "test_at_cellularmultiplexer.h"
#include <string.h>
#include "EventQueue.h"
#include "ATHandler.h"
#include "AT_CellularDevice.h"
#include "AT_CellularMultiplexer.h"
#include "FileHandle_stub.h"
using namespace mbed;
using namespace events;
Test_AT_CellularMultiplexer::Test_AT_CellularMultiplexer()
{
}
Test_AT_CellularMultiplexer::~Test_AT_CellularMultiplexer()
{
}
void Test_AT_CellularMultiplexer::test_AT_CellularMultiplexer_constructor()
{
EventQueue que;
FileHandle_stub fh1;
ATHandler at(&fh1, que, 0, ",");
AT_CellularMultiplexer *cm = new AT_CellularMultiplexer(at);
delete cm;
}
void Test_AT_CellularMultiplexer::test_AT_CellularMultiplexer_multiplexer_mode_start()
{
EventQueue que;
FileHandle_stub fh1;
ATHandler at(&fh1, que, 0, ",");
AT_CellularMultiplexer cm(at);
CHECK(!cm.multiplexer_mode_start());
}

View File

@ -1,33 +0,0 @@
/*
* Copyright (c) 2018, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_AT_CELLULARMULTIPLEXER_H
#define TEST_AT_CELLULARMULTIPLEXER_H
class Test_AT_CellularMultiplexer
{
public:
Test_AT_CellularMultiplexer();
virtual ~Test_AT_CellularMultiplexer();
void test_AT_CellularMultiplexer_constructor();
void test_AT_CellularMultiplexer_multiplexer_mode_start();
};
#endif // TEST_AT_CELLULARMULTIPLEXER_H

View File

@ -24,10 +24,9 @@ INCLUDE_DIRS =\
../../../framework/common\
../../../framework/AT\
../../../framework/API\
../../../framework/mux\
/usr/include\
$(CPPUTEST_HOME)/include\
CPPUTESTFLAGS = -D__thumb2__ -w -D__INLINE=__inline -DMBED_CONF_CELLULAR_MUX_ENABLED=1
CPPUTESTFLAGS = -D__thumb2__ -w -D__INLINE=__inline
CPPUTEST_CFLAGS += -std=gnu99

View File

@ -1,23 +0,0 @@
include ../../makefile_defines.txt
COMPONENT_NAME = cellular_mux_unit
#This must be changed manually
SRC_FILES = \
../../../framework/mux/cellular_mux.c
TEST_SRC_FILES = \
main.cpp \
cellular_muxtest.cpp \
test_cellular_mux.cpp \
../../stubs/mbed_assert_stub.cpp \
../../stubs/FileHandle_stub.cpp \
../../stubs/EventQueue_stub.cpp \
../../stubs/equeue_stub.c \
../../stubs/cellular_mux_data_service_stub.cpp \
../../stubs/Semaphore_stub.cpp \
include ../../MakefileWorker.mk
CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT

View File

@ -1,65 +0,0 @@
/*
* Copyright (c) 2015, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "CppUTest/TestHarness.h"
#include "test_cellular_mux.h"
TEST_GROUP(cellular_mux)
{
Test_cellular_mux* unit;
void setup()
{
unit = new Test_cellular_mux();
}
void teardown()
{
delete unit;
}
};
TEST(cellular_mux, Create)
{
CHECK(unit != NULL);
}
TEST(cellular_mux, test_cellular_mux_module_init)
{
unit->test_cellular_mux_module_init();
}
TEST(cellular_mux, test_cellular_mux_mux_start)
{
unit->test_cellular_mux_mux_start();
}
TEST(cellular_mux, test_cellular_mux_dlci_establish)
{
unit->test_cellular_mux_dlci_establish();
}
TEST(cellular_mux, test_cellular_mux_serial_attach)
{
unit->test_cellular_mux_serial_attach();
}
TEST(cellular_mux, test_cellular_mux_eventqueue_attach)
{
unit->test_cellular_mux_eventqueue_attach();
}

View File

@ -1,28 +0,0 @@
/*
* Copyright (c) 2015, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "CppUTest/CommandLineTestRunner.h"
#include "CppUTest/TestPlugin.h"
#include "CppUTest/TestRegistry.h"
#include "CppUTestExt/MockSupportPlugin.h"
int main(int ac, char** av)
{
return CommandLineTestRunner::RunAllTests(ac, av);
}
IMPORT_TEST_GROUP(cellular_mux);

View File

@ -1,57 +0,0 @@
/*
* Copyright (c) 2018, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "CppUTest/TestHarness.h"
#include "test_cellular_mux.h"
#include "cellular_mux.h"
#include <string.h>
using namespace mbed;
using namespace events;
Test_cellular_mux::Test_cellular_mux()
{
}
Test_cellular_mux::~Test_cellular_mux()
{
}
void Test_cellular_mux::test_cellular_mux_module_init()
{
Mux::module_init();
}
void Test_cellular_mux::test_cellular_mux_mux_start()
{
}
void Test_cellular_mux::test_cellular_mux_dlci_establish()
{
}
void Test_cellular_mux::test_cellular_mux_serial_attach()
{
}
void Test_cellular_mux::test_cellular_mux_eventqueue_attach()
{
}

View File

@ -1,39 +0,0 @@
/*
* Copyright (c) 2018, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_cellular_mux_H
#define TEST_cellular_mux_H
class Test_cellular_mux
{
public:
Test_cellular_mux();
virtual ~Test_cellular_mux();
void test_cellular_mux_module_init();
void test_cellular_mux_mux_start();
void test_cellular_mux_dlci_establish();
void test_cellular_mux_serial_attach();
void test_cellular_mux_eventqueue_attach();
};
#endif // TEST_cellular_mux_H

View File

@ -1,20 +0,0 @@
include ../../makefile_defines.txt
COMPONENT_NAME = cellular_mux_data_service_unit
#This must be changed manually
SRC_FILES = \
../../../framework/mux/cellular_mux_data_service.c
TEST_SRC_FILES = \
main.cpp \
cellular_mux_data_servicetest.cpp \
test_cellular_mux_data_service.cpp \
../../stubs/FileHandle_stub.cpp \
../../stubs/cellular_mux_stub.cpp \
../../stubs/mbed_assert_stub.cpp \
include ../../MakefileWorker.mk
CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT

View File

@ -1,63 +0,0 @@
/*
* Copyright (c) 2015, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "CppUTest/TestHarness.h"
#include "test_cellular_mux_data_service.h"
TEST_GROUP(cellular_mux_data_service)
{
Test_cellular_mux_data_service* unit;
void setup()
{
unit = new Test_cellular_mux_data_service();
}
void teardown()
{
delete unit;
}
};
TEST(cellular_mux_data_service, Create)
{
CHECK(unit != NULL);
}
TEST(cellular_mux_data_service, test_cellular_mux_write)
{
unit->test_cellular_mux_write();
}
TEST(cellular_mux_data_service, test_cellular_mux_read)
{
unit->test_cellular_mux_read();
}
TEST(cellular_mux_data_service, test_cellular_mux_seek)
{
unit->test_cellular_mux_seek();
}
TEST(cellular_mux_data_service, test_cellular_mux_close)
{
unit->test_cellular_mux_close();
}
TEST(cellular_mux_data_service, test_cellular_mux_sigio)
{
unit->test_cellular_mux_sigio();
}

View File

@ -1,28 +0,0 @@
/*
* Copyright (c) 2015, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "CppUTest/CommandLineTestRunner.h"
#include "CppUTest/TestPlugin.h"
#include "CppUTest/TestRegistry.h"
#include "CppUTestExt/MockSupportPlugin.h"
int main(int ac, char** av)
{
return CommandLineTestRunner::RunAllTests(ac, av);
}
IMPORT_TEST_GROUP(cellular_mux_data_service);

View File

@ -1,73 +0,0 @@
/*
* Copyright (c) 2018, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "CppUTest/TestHarness.h"
#include "test_cellular_mux_data_service.h"
#include "cellular_mux.h"
#include "cellular_mux_stub.h"
#include <string.h>
using namespace mbed;
Test_cellular_mux_data_service::Test_cellular_mux_data_service()
{
}
Test_cellular_mux_data_service::~Test_cellular_mux_data_service()
{
}
void Test_cellular_mux_data_service::test_cellular_mux_write()
{
MuxDataService mux;
char table[] = "ss";
cellular_mux_stub::size_value = 6;
CHECK(6 == mux.write(table, 2));
}
void Test_cellular_mux_data_service::test_cellular_mux_read()
{
MuxDataService mux;
char table[6];
cellular_mux_stub::size_value = 67;
CHECK(67 == mux.read(table, 6));
}
void Test_cellular_mux_data_service::test_cellular_mux_seek()
{
MuxDataService mux;
CHECK(0 == mux.seek(0));
}
void Test_cellular_mux_data_service::test_cellular_mux_close()
{
MuxDataService mux;
CHECK(0 == mux.close());
}
void cb()
{
}
void Test_cellular_mux_data_service::test_cellular_mux_sigio()
{
MuxDataService mux;
mux.sigio(cb);
}

View File

@ -1,39 +0,0 @@
/*
* Copyright (c) 2018, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_cellular_mux_DATA_SERVICE_H
#define TEST_cellular_mux_DATA_SERVICE_H
class Test_cellular_mux_data_service
{
public:
Test_cellular_mux_data_service();
virtual ~Test_cellular_mux_data_service();
void test_cellular_mux_write();
void test_cellular_mux_read();
void test_cellular_mux_seek();
void test_cellular_mux_close();
void test_cellular_mux_sigio();
};
#endif // TEST_cellular_mux_DATA_SERVICE_H

View File

@ -1,54 +0,0 @@
/*
* Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "cellular_mux.h"
namespace mbed
{
ssize_t MuxDataService::write(const void* buffer, size_t size)
{
return 0;
}
ssize_t MuxDataService::read(void *buffer, size_t size)
{
return 0;
}
short MuxDataService::poll(short events) const
{
return 0;
}
off_t MuxDataService::seek(off_t offset, int whence)
{
return 0;
}
int MuxDataService::close()
{
return 0;
}
void MuxDataService::sigio(Callback<void()> func)
{
}
}

View File

@ -1,66 +0,0 @@
/*
* Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "cellular_mux.h"
#include "cellular_mux_stub.h"
using namespace mbed;
ssize_t cellular_mux_stub::size_value = 0;
Mux::MuxReturnStatus cellular_mux_stub::status_value = Mux::MUX_STATUS_SUCCESS;
void Mux::module_init()
{
}
Mux::MuxReturnStatus Mux::mux_start(MuxEstablishStatus &status)
{
return cellular_mux_stub::status_value;
}
Mux::MuxReturnStatus Mux::dlci_establish(uint8_t dlci_id, MuxEstablishStatus &status, FileHandle **obj)
{
return cellular_mux_stub::status_value;
}
void Mux::serial_attach(FileHandle *serial)
{
}
void Mux::eventqueue_attach(events::EventQueue *event_queue)
{
}
//Private functions are needed because those are static
ssize_t Mux::user_data_tx(uint8_t dlci_id, const void* buffer, size_t size)
{
return cellular_mux_stub::size_value;
}
ssize_t Mux::user_data_rx(void* buffer, size_t size)
{
return cellular_mux_stub::size_value;
}
short Mux::poll()
{
return POLLIN | POLLOUT;
}

View File

@ -1,28 +0,0 @@
/*
* Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __cellular_mux_STUB_H__
#define __cellular_mux_STUB_H__
#include <inttypes.h>
namespace cellular_mux_stub
{
extern ssize_t size_value;
extern mbed::Mux::MuxReturnStatus status_value;
}
#endif

View File

@ -24,7 +24,6 @@
#include "CellularNetwork.h"
#include "CellularSMS.h"
#include "CellularPower.h"
#include "CellularMultiplexer.h"
#include "CellularInformation.h"
#include "NetworkStack.h"
@ -73,13 +72,6 @@ public:
*/
virtual CellularSIM *open_sim(FileHandle *fh) = 0;
/** Create new CellularMultiplexer interface.
*
* @param fh file handle used in communication to modem. Can be for example UART handle.
* @return New instance of interface CellularMultiplexer.
*/
virtual CellularMultiplexer *open_multiplexer(FileHandle *fh) = 0;
/** Create new CellularInformation interface.
*
* @param fh file handle used in communication to modem. Can be for example UART handle.
@ -103,10 +95,6 @@ public:
*/
virtual void close_sim() = 0;
/** Closes the opened CellularNetwork by deleting the CellularMultiplexer instance.
*/
virtual void close_multiplexer() = 0;
/** Closes the opened CellularNetwork by deleting the CellularInformation instance.
*/
virtual void close_information() = 0;

View File

@ -1,51 +0,0 @@
/*
* Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef CELLULAR_MULTIPLEXER_H_
#define CELLULAR_MULTIPLEXER_H_
#include "nsapi_types.h"
namespace mbed {
/**
* Class CellularMultiplexer
*
* An abstract interface that provides a way to start multiplexer mode in modem.
*/
class CellularMultiplexer
{
protected:
// friend of CellularDevice so that it's the only way to close/delete this class.
friend class CellularDevice;
/** virtual Destructor
*/
virtual ~CellularMultiplexer() {};
public:
/** Starts modem multiplexer mode specified by 3GPP TS 27.010.
*
* @return zero on success, negative error code on failure
*/
virtual nsapi_error_t multiplexer_mode_start() = 0;
};
} // namespace mbed
#endif // CELLULAR_MULTIPLEXER_H_

View File

@ -23,7 +23,7 @@ using namespace mbed;
#define DEFAULT_AT_TIMEOUT 1000 // at default timeout in milliseconds
AT_CellularDevice::AT_CellularDevice(EventQueue &queue) :
_atHandlers(0), _network(0), _sms(0), _sim(0), _power(0), _multiplexer(0), _information(0), _queue(queue),
_atHandlers(0), _network(0), _sms(0), _sim(0), _power(0), _information(0), _queue(queue),
_default_timeout(DEFAULT_AT_TIMEOUT), _modem_debug_on(false)
{
}
@ -34,7 +34,6 @@ AT_CellularDevice::~AT_CellularDevice()
close_sms();
close_power();
close_sim();
close_multiplexer();
close_information();
ATHandler *atHandler = _atHandlers;
@ -157,21 +156,6 @@ CellularPower *AT_CellularDevice::open_power(FileHandle *fh)
return _power;
}
CellularMultiplexer *AT_CellularDevice::open_multiplexer(FileHandle *fh)
{
if (!_multiplexer) {
ATHandler *atHandler = get_at_handler(fh);
if (atHandler) {
_multiplexer = new AT_CellularMultiplexer(*atHandler);
if (!_multiplexer) {
release_at_handler(atHandler);
}
}
}
return _multiplexer;
}
CellularInformation *AT_CellularDevice::open_information(FileHandle *fh)
{
if (!_information) {
@ -221,15 +205,6 @@ void AT_CellularDevice::close_sim()
}
}
void AT_CellularDevice::close_multiplexer()
{
if (_multiplexer) {
release_at_handler(&_multiplexer->get_at_handler());
delete _multiplexer;
_multiplexer = NULL;
}
}
void AT_CellularDevice::close_information()
{
if (_information) {

View File

@ -24,7 +24,6 @@
#include "AT_CellularSIM.h"
#include "AT_CellularSMS.h"
#include "AT_CellularPower.h"
#include "AT_CellularMultiplexer.h"
#include "AT_CellularInformation.h"
#include "ATHandler.h"
@ -64,8 +63,6 @@ public: // CellularDevice
virtual CellularSIM *open_sim(FileHandle *fh);
virtual CellularMultiplexer *open_multiplexer(FileHandle *fh);
virtual CellularInformation *open_information(FileHandle *fh);
virtual void close_network();
@ -76,8 +73,6 @@ public: // CellularDevice
virtual void close_sim();
virtual void close_multiplexer();
virtual void close_information();
virtual void set_timeout(int timeout);
@ -91,7 +86,6 @@ protected:
AT_CellularSMS *_sms;
AT_CellularSIM *_sim;
AT_CellularPower* _power;
AT_CellularMultiplexer* _multiplexer;
AT_CellularInformation* _information;
protected:

View File

@ -1,43 +0,0 @@
/*
* Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "AT_CellularMultiplexer.h"
#include "CellularLog.h"
using namespace mbed;
AT_CellularMultiplexer::AT_CellularMultiplexer(ATHandler &at) : AT_CellularBase(at)
{
}
AT_CellularMultiplexer::~AT_CellularMultiplexer()
{
}
nsapi_error_t AT_CellularMultiplexer::multiplexer_mode_start()
{
tr_info("multiplexer_mode_start()");
_at.lock();
_at.cmd_start("AT+CMUX=0");
_at.cmd_stop();
_at.resp_start();
_at.resp_stop();
return _at.unlock_return_error();
}

View File

@ -1,42 +0,0 @@
/*
* Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef AT_CELLULAR_MULTIPLEXER_H_
#define AT_CELLULAR_MULTIPLEXER_H_
#include "CellularMultiplexer.h"
#include "AT_CellularBase.h"
namespace mbed {
/**
* Class AT_CellularMultiplexer
*
* Class that provides a way to start multiplexer mode in modem.
*/
class AT_CellularMultiplexer : public CellularMultiplexer, public AT_CellularBase
{
public:
AT_CellularMultiplexer(ATHandler &atHandler);
virtual ~AT_CellularMultiplexer();
public:
virtual nsapi_error_t multiplexer_mode_start();
};
} // namespace mbed
#endif /* AT_CELLULAR_MULTIPLEXER_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -1,583 +0,0 @@
/*
* Copyright (c) 2006-2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if MBED_CONF_CELLULAR_MUX_ENABLED
#ifndef MUX_H
#define MUX_H
#include <stdbool.h>
#include "FileHandle.h"
#include "PlatformMutex.h"
#include "Semaphore.h"
#include "EventQueue.h"
#define MUX_DLCI_INVALID_ID 0 /* Invalid DLCI ID. Used to invalidate MuxDataService object. */
#define MUX_CRC_TABLE_LEN 256u /* CRC table length in number of bytes. */
#ifndef MBED_CONF_MUX_DLCI_COUNT
#define MBED_CONF_MUX_DLCI_COUNT 3u /* Number of supported DLCI IDs. */
#endif
#ifndef MBED_CONF_MUX_BUFFER_SIZE
#define MBED_CONF_MUX_BUFFER_SIZE 31u /* Size of TX/Rx buffers in number of bytes. */
#endif
/* More RAM needs to allocated if more than 4 DLCI ID to be supported see @ref tx_callback_context for details. */
MBED_STATIC_ASSERT(MBED_CONF_MUX_DLCI_COUNT <= 4u, "");
/* @todo:
I assume that we need to export some kind of #defines for EVENT_SIZE and MAX_EVENT_COUNT (max number of events that can
be queued at the same time by the module inside EventQueue, so that the application designer can calculate the RAM
storage requirements correctly at compile time.
*/
namespace mbed {
class MuxDataService : public FileHandle
{
friend class Mux;
public:
/** Enqueue user data for transmission.
*
* @note: This API is only meant to be used for the multiplexer (user) data service tx. Supplied buffer can be
* reused/freed upon call return.
*
* @param buffer Begin of the user data.
* @param size The number of bytes to write.
* @return The number of bytes written.
*/
virtual ssize_t write(const void* buffer, size_t size);
/** Read user data into a buffer.
*
* @note: This API is only meant to be used for the multiplexer (user) data service rx.
*
* @param buffer The buffer to read to.
* @param size The number of bytes to read.
* @return The number of bytes read, -EAGAIN if no data available for read.
*/
virtual ssize_t read(void *buffer, size_t size);
/** Check for poll event flags
*
* The input parameter can be used or ignored - could always return all events, or could check just the events
* listed in events.
*
* Call is nonblocking - returns instantaneous state of events.
*
* @param events Bitmask of poll events we're interested in - POLLIN/POLLOUT and so on.
* @return Bitmask of poll events that have occurred.
*/
virtual short poll(short events) const;
/** Not supported by the implementation. */
virtual off_t seek(off_t offset, int whence = SEEK_SET);
/** Not supported by the implementation. */
virtual int close();
/** Register a callback on completion of enqueued write and read operations.
*
* @note: The registered callback is called within thread context supplied in eventqueue_attach.
*
* @param func Function to call upon event generation.
*/
virtual void sigio(Callback<void()> func);
/** Constructor. */
MuxDataService() : _dlci(MUX_DLCI_INVALID_ID) {};
private:
/* Deny copy constructor. */
MuxDataService(const MuxDataService& obj);
/* Deny assignment operator. */
MuxDataService& operator=(const MuxDataService& obj);
uint8_t _dlci; /* DLCI number. Valid range 1 - 63. */
Callback<void()> _sigio_cb; /* Registered signal callback. */
};
class Mux
{
friend class MuxDataService;
public:
/* Definition for multiplexer establishment status type. */
enum MuxEstablishStatus {
MUX_ESTABLISH_SUCCESS = 0, /* Peer accepted the request. */
MUX_ESTABLISH_REJECT, /* Peer rejected the request. */
MUX_ESTABLISH_TIMEOUT, /* Timeout occurred for the request. */
MUX_ESTABLISH_MAX /* Enumeration upper bound. */
};
/* Definition for multiplexer establishment return code type. */
enum MuxReturnStatus {
MUX_STATUS_SUCCESS = 0,
MUX_STATUS_INPROGRESS,
MUX_STATUS_INVALID_RANGE,
MUX_STATUS_MUX_NOT_OPEN,
MUX_STATUS_NO_RESOURCE,
MUX_STATUS_MAX
};
/** Module init. */
static void module_init();
/** Establish the multiplexer control channel.
*
* @note: Relevant request specific parameters are fixed at compile time within multiplexer component.
* @note: Call returns when response from the peer is received, timeout or write error occurs.
*
* @param status Operation completion code.
*
* @return MUX_STATUS_SUCCESS Operation completed, check status for completion code.
* @return MUX_STATUS_INPROGRESS Operation not started, control channel open already in progress.
* @return MUX_STATUS_NO_RESOURCE Operation not started, multiplexer control channel already open.
*/
static MuxReturnStatus mux_start(MuxEstablishStatus &status);
/** Establish a DLCI.
*
* @note: Relevant request specific parameters are fixed at compile time within multiplexer component.
* @note: Call returns when response from the peer is received or timeout occurs.
*
* @warning: Not allowed to be called from callback context.
*
* @param dlci_id ID of the DLCI to establish. Valid range 1 - 63.
* @param status Operation completion code.
* @param obj Valid object upon status having MUX_ESTABLISH_SUCCESS, NULL upon failure.
*
* @return MUX_STATUS_SUCCESS Operation completed, check status for completion code.
* @return MUX_STATUS_INPROGRESS Operation not started, DLCI establishment already in progress.
* @return MUX_STATUS_INVALID_RANGE Operation not started, DLCI ID not in valid range.
* @return MUX_STATUS_MUX_NOT_OPEN Operation not started, no established multiplexer control channel exists.
* @return MUX_STATUS_NO_RESOURCE Operation not started, dlci_id or all available DLCI ID resources,
* already in use.
*/
static MuxReturnStatus dlci_establish(uint8_t dlci_id, MuxEstablishStatus &status, FileHandle **obj);
/** Attach serial interface to the object.
*
* @param serial Serial interface to be used.
*/
static void serial_attach(FileHandle *serial);
/** Attach EventQueue interface to the object.
*
* @param event_queue Event queue interface to be used.
*/
static void eventqueue_attach(events::EventQueue *event_queue);
private:
/* Definition for Rx event type. */
enum RxEvent {
RX_READ = 0,
RX_RESUME,
RX_EVENT_MAX
};
/* Definition for Tx state machine. */
enum TxState {
TX_IDLE = 0,
TX_RETRANSMIT_ENQUEUE,
TX_RETRANSMIT_DONE,
TX_INTERNAL_RESP,
TX_NORETRANSMIT,
TX_STATE_MAX
};
/* Definition for Rx state machine. */
enum RxState {
RX_FRAME_START = 0,
RX_HEADER_READ,
RX_TRAILER_READ,
RX_SUSPEND,
RX_STATE_MAX
};
/* Definition for frame type within rx path. */
enum FrameRxType {
FRAME_RX_TYPE_SABM = 0,
FRAME_RX_TYPE_UA,
FRAME_RX_TYPE_DM,
FRAME_RX_TYPE_DISC,
FRAME_RX_TYPE_UIH,
FRAME_RX_TYPE_NOT_SUPPORTED,
FRAME_RX_TYPE_MAX
};
/* Definition for frame type within tx path. */
enum FrameTxType {
FRAME_TX_TYPE_SABM = 0,
FRAME_TX_TYPE_DM,
FRAME_TX_TYPE_UIH,
FRAME_TX_TYPE_MAX
};
/** Registered time-out expiration event. */
static void on_timeout();
/** Registered deferred call event in safe (thread context) supplied in eventqueue_attach. */
static void on_deferred_call();
/** Registered sigio callback from FileHandle. */
static void on_sigio();
/** Calculate fcs.
*
* @param buffer Input buffer.
* @param input_len Input length in number of bytes.
*
* @return Calculated fcs.
*/
static uint8_t fcs_calculate(const uint8_t *buffer, uint8_t input_len);
/** Construct sabm request message.
*
* @param dlci_id ID of the DLCI to establish
*/
static void sabm_request_construct(uint8_t dlci_id);
/** Construct dm response message.
*/
static void dm_response_construct();
/** Construct user information frame.
*
* @param dlci_id ID of the DLCI to establish
* @param buffer
* @param size
*/
static void user_information_construct(uint8_t dlci_id, const void *buffer, size_t size);
/** Do write operation if pending data available.
*/
static void write_do();
/** Generate Rx event.
*
* @param event Rx event
*/
static void rx_event_do(RxEvent event);
/** Rx event frame start read state.
*
* @return Number of bytes read, -EAGAIN if no data available.
*/
static ssize_t on_rx_read_state_frame_start();
/** Rx event header read state.
*
* @return Number of bytes read, -EAGAIN if no data available.
*/
static ssize_t on_rx_read_state_header_read();
/** Rx event trailer read state.
*
* @return Number of bytes read, -EAGAIN if no data available.
*/
static ssize_t on_rx_read_state_trailer_read();
/** Rx event suspend read state.
*
* @return Number of bytes read, -EAGAIN if no data available.
*/
static ssize_t on_rx_read_state_suspend();
/** Process received SABM frame. */
static void on_rx_frame_sabm();
/** Process received UA frame. */
static void on_rx_frame_ua();
/** Process received DM frame. */
static void on_rx_frame_dm();
/** Process received DISC frame. */
static void on_rx_frame_disc();
/** Process received UIH frame. */
static void on_rx_frame_uih();
/** Process received frame, which is not supported. */
static void on_rx_frame_not_supported();
/** Process valid received frame. */
static void valid_rx_frame_decode();
/** SABM frame tx path post processing. */
static void on_post_tx_frame_sabm();
/** DM frame tx path post processing. */
static void on_post_tx_frame_dm();
/** UIH frame tx path post processing. */
static void on_post_tx_frame_uih();
/** Resolve rx frame type.
*
* @return Frame type.
*/
static Mux::FrameRxType frame_rx_type_resolve();
/** Resolve tx frame type.
*
* @return Frame type.
*/
static Mux::FrameTxType frame_tx_type_resolve();
/** Begin the frame retransmit sequence. */
static void frame_retransmit_begin();
/** TX state entry functions. */
static void tx_retransmit_enqueu_entry_run();
static void tx_retransmit_done_entry_run();
static void tx_idle_entry_run();
static void tx_internal_resp_entry_run();
static void tx_noretransmit_entry_run();
typedef void (*tx_state_entry_func_t)();
/** TX state exit function. */
static void tx_idle_exit_run();
typedef void (*tx_state_exit_func_t)();
/** Change Tx state machine state.
*
* @param new_state State to transit.
* @param entry_func State entry function.
* @param exit_func State exit function.
*/
static void tx_state_change(TxState new_state, tx_state_entry_func_t entry_func, tx_state_exit_func_t exit_func);
/** RX state entry functions. */
static void rx_header_read_entry_run();
typedef void (*rx_state_entry_func_t)();
/** Null action function. */
static void null_action();
/** Change Rx state machine state.
*
* @param new_state State to transit.
* @param entry_func State entry function.
*/
static void rx_state_change(RxState new_state, rx_state_entry_func_t entry_func);
/** Begin DM frame transmit sequence. */
static void dm_response_send();
/** Append DLCI ID to storage.
*
* @param dlci_id ID of the DLCI to append.
*/
static void dlci_id_append(uint8_t dlci_id);
/** Get file handle based on DLCI ID.
*
* @param dlci_id ID of the DLCI used as the key
*
* @return Valid object reference or NULL if not found.
*/
static MuxDataService* file_handle_get(uint8_t dlci_id);
/** Evaluate is DLCI ID in use.
*
* @param dlci_id ID of the DLCI to evaluate
*
* @return True if in use, false otherwise.
*/
static bool is_dlci_in_use(uint8_t dlci_id);
/** Evaluate is DLCI ID queue full.
*
* @return True if full, false otherwise.
*/
static bool is_dlci_q_full();
/** Begin pending self iniated multiplexer open sequence. */
static void pending_self_iniated_mux_open_start();
/** Begin pending self iniated DLCI establishment sequence. */
static void pending_self_iniated_dlci_open_start();
/** Begin pending peer iniated DLCI establishment sequence.
*
* @param dlci_id ID of the DLCI to establish.
*/
static void pending_peer_iniated_dlci_open_start(uint8_t dlci_id);
/** Enqueue user data for transmission.
*
* @note: This API is only meant to be used for the multiplexer (user) data service tx. Supplied buffer can be
* reused/freed upon call return.
*
* @param dlci_id ID of the DLCI to use.
* @param buffer Begin of the user data.
* @param size The number of bytes to write.
* @return The number of bytes written, negative error on failure.
*/
static ssize_t user_data_tx(uint8_t dlci_id, const void* buffer, size_t size);
/** Read user data into a buffer.
*
* @note: This API is only meant to be used for the multiplexer (user) data service rx.
*
* @param buffer The buffer to read in to.
* @param size The number of bytes to read.
* @return The number of bytes read, -EAGAIN if no data availabe for read.
*/
static ssize_t user_data_rx(void* buffer, size_t size);
/** Check for poll event flags
*
* @return Bitmask of poll events that have occurred - POLLIN/POLLOUT.
*/
static short poll();
/** Clear TX callback pending bit.
*
* @param bit Bit to clear.
*/
static void tx_callback_pending_bit_clear(uint8_t bit);
/** Set TX callback pending bit for supplied DLCI ID.
*
* @param dlci_id DLCI ID for bit to set.
*/
static void tx_callback_pending_bit_set(uint8_t dlci_id);
/** Advance the current TX callback index bit.
*
* @return The current TX callback index bit after advanced.
*/
static uint8_t tx_callback_index_advance();
/** Get the TX callback pending bitmask.
*
* @return TX callback pending bitmask.
*/
static uint8_t tx_callback_pending_mask_get();
/** Dispatch TX callback based on supplied bit.
*
* @param bit Bit identifier of callback to dispatch.
*/
static void tx_callback_dispatch(uint8_t bit);
/** Run main processing loop for resolving pending TX callbacks and dispatching them if they exist.
*/
static void tx_callbacks_run();
/** Get data service object based on supplied bit id.
*
* @param bit Bit identifier of data service object to get.
* @return Data service object reference.
*/
static MuxDataService& tx_callback_lookup(uint8_t bit);
/** Get minimum of 2 supplied paramaters.
*
* @param size_1 1st param for comparison.
* @param size_2 2nd param for comparison.
* @return Minimum of supplied paramaters.
*/
static size_t min(uint8_t size_1, size_t size_2);
/** Enqueue callback to event queue.
*/
static void event_queue_enqueue();
/** Verify is FCS valid in RX frame.
*
* @return True upon valid FCS, false otherwise.
*/
static bool is_rx_fcs_valid();
/* Deny object creation. */
Mux();
/* Deny copy constructor. */
Mux(const Mux& obj);
/* Deny assignment operator. */
Mux& operator=(const Mux& obj);
/* Definition for Tx context type. */
struct tx_context_t {
int timer_id; /* Timer id. */
union {
uint32_t align_4_byte; /* Force 4-byte alignment. */
uint8_t buffer[MBED_CONF_MUX_BUFFER_SIZE]; /* Rx buffer. */
};
uint8_t retransmit_counter; /* Frame retransmission counter. */
uint8_t bytes_remaining; /* Bytes remaining in the buffer to write. */
uint8_t offset; /* Offset in the buffer where to write from. */
uint8_t tx_callback_context; /* Context for the TX callback dispatching logic as follows:
- 4 LO bits contain the pending callback mask
- 4 HI bits contain the current bit used for masking */
TxState tx_state; /* Tx state machine current state. */
};
/* Definition for Rx context type. */
struct rx_context_t {
union {
uint32_t align_4_byte; /* Force 4-byte alignment. */
uint8_t buffer[MBED_CONF_MUX_BUFFER_SIZE]; /* Rx buffer. */
};
uint8_t offset; /* Offset in the buffer where to read to. */
uint8_t read_length; /* Amount to read in number of bytes. */
RxState rx_state; /* Rx state machine current state. */
};
/* Definition for state type. */
struct state_t {
uint16_t is_mux_open : 1; /* True when multiplexer is open. */
uint16_t is_mux_open_pending : 1; /* True when multiplexer open is pending. */
uint16_t is_mux_open_running : 1; /* True when multiplexer open is running. */
uint16_t is_dlci_open_pending : 1; /* True when DLCI open is pending. */
uint16_t is_dlci_open_running : 1; /* True when DLCI open is running. */
uint16_t is_system_thread_context : 1; /* True when current context is system thread context. */
uint16_t is_tx_callback_context : 1; /* True when current context is TX callback context. */
uint16_t is_user_tx_pending : 1; /* True when user TX is pending. */
uint16_t is_user_rx_ready : 1; /* True when user RX is ready/available. */
};
static FileHandle* _serial; /* Serial used. */
static events::EventQueue* _event_q; /* Event queue used. */
static rtos::Semaphore _semaphore; /* Semaphore used. */
static PlatformMutex _mutex; /* Mutex used. */
static MuxDataService _mux_objects[MBED_CONF_MUX_DLCI_COUNT]; /* Number of supported DLCIs. */
static tx_context_t _tx_context; /* Tx context. */
static rx_context_t _rx_context; /* Rx context. */
static state_t _state; /* General state context. */
static const uint8_t _crctable[MUX_CRC_TABLE_LEN]; /* CRC table used for frame FCS. */
static uint8_t _shared_memory; /* Shared memory used passing data between user and
system threads. */
};
} // namespace mbed
#endif
#endif // MBED_CONF_CELLULAR_MUX_ENABLED

View File

@ -1,64 +0,0 @@
/*
* Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if MBED_CONF_CELLULAR_MUX_ENABLED
#include "cellular_mux.h"
namespace mbed
{
ssize_t MuxDataService::write(const void* buffer, size_t size)
{
return Mux::user_data_tx(_dlci, buffer, size);
}
ssize_t MuxDataService::read(void *buffer, size_t size)
{
return Mux::user_data_rx(buffer, size);
}
short MuxDataService::poll(short events) const
{
return Mux::poll();
}
off_t MuxDataService::seek(off_t offset, int whence)
{
MBED_ASSERT(false);
return 0;
}
int MuxDataService::close()
{
MBED_ASSERT(false);
return 0;
}
void MuxDataService::sigio(Callback<void()> func)
{
_sigio_cb = func;
}
} // namespace mbed
#endif // MBED_CONF_CELLULAR_MUX_ENABLED

View File

@ -18,7 +18,6 @@
#include "TELIT_HE910.h"
#include "TELIT_HE910_CellularPower.h"
#include "TELIT_HE910_CellularNetwork.h"
#include "TELIT_HE910_CellularMultiplexer.h"
using namespace mbed;
using namespace events;
@ -59,18 +58,3 @@ CellularNetwork *TELIT_HE910::open_network(FileHandle *fh)
}
return _network;
}
CellularMultiplexer *TELIT_HE910::open_multiplexer(FileHandle *fh)
{
if (!_multiplexer) {
ATHandler *atHandler = get_at_handler(fh);
if (atHandler) {
_multiplexer = new AT_CellularMultiplexer(*atHandler);
if (!_multiplexer) {
release_at_handler(atHandler);
}
}
}
return _multiplexer;
}

View File

@ -32,7 +32,6 @@ public:
public: // from CellularDevice
virtual CellularPower *open_power(FileHandle *fh);
virtual CellularNetwork *open_network(FileHandle *fh);
virtual CellularMultiplexer *open_multiplexer(FileHandle *fh);
};
} // namespace mbed
#endif /* CELLULAR_TARGETS_TELIT_HE910_TELIT_HE910_H_ */

View File

@ -1,66 +0,0 @@
/*
* Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "TELIT_HE910_CellularMultiplexer.h"
using namespace mbed;
TELIT_HE910_CellularMultiplexer::TELIT_HE910_CellularMultiplexer(ATHandler &atHandler)
: AT_CellularMultiplexer(atHandler)
{
}
TELIT_HE910_CellularMultiplexer::~TELIT_HE910_CellularMultiplexer()
{
}
nsapi_error_t TELIT_HE910_CellularMultiplexer::multiplexer_mode_start()
{
_at.lock();
_at.cmd_start("AT#SELINT=2");
_at.cmd_stop();
_at.resp_start();
_at.resp_stop();
_at.cmd_start("ATE0V1&K3&D2");
_at.cmd_stop();
_at.resp_start();
_at.resp_stop();
_at.cmd_start("AT+IPR=115200");
_at.cmd_stop();
_at.resp_start();
_at.resp_stop();
_at.cmd_start("AT&W0&P0");
_at.cmd_stop();
_at.resp_start();
_at.resp_stop();
_at.cmd_start("AT#CMUXMODE=5");
_at.cmd_stop();
_at.resp_start();
_at.resp_stop();
_at.cmd_start("AT+CMUX=0");
_at.cmd_stop();
_at.resp_start();
_at.resp_stop();
return _at.unlock_return_error();
}

View File

@ -1,33 +0,0 @@
/*
* Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TELIT_HE910_CELLULARMULTIPLEXER_H_
#define TELIT_HE910_CELLULARMULTIPLEXER_H_
#include "AT_CellularMultiplexer.h"
namespace mbed {
class TELIT_HE910_CellularMultiplexer : public AT_CellularMultiplexer {
public:
TELIT_HE910_CellularMultiplexer(ATHandler &atHandler);
virtual ~TELIT_HE910_CellularMultiplexer();
virtual nsapi_error_t multiplexer_mode_start();
};
} // namespace mbed
#endif /* TELIT_HE910_CELLULARMULTIPLEXER_H_ */

View File

@ -5,10 +5,6 @@
"help": "Use APN database lookup",
"value": true
},
"mux-enabled": {
"help": "Use cellular modem over MUX",
"value": false
},
"random_max_start_delay": {
"help": "Maximum random delay value used in start-up sequence in milliseconds",
"value": 0