### Initialize PubSubClient Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/cellular/cellular-mqtt-pubsubclient.html Setup the TCP client and PubSubClient instance required for MQTT communication. ```cpp #include #include static WioCellularArduinoTcpClient TcpClient{ WioCellular, PDP_CONTEXT_ID }; static PubSubClient MqttClient{ TcpClient }; ``` -------------------------------- ### Perform HTTP GET request Source: https://seeedjp.github.io/Wiki/Wio_3G_for_Arduino/reference-ja.html Retrieves data from a specified URL via HTTP GET. ```cpp int HttpGet(const char* url, char* data, int dataSize) ``` -------------------------------- ### Configure Network Settings Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/soracom/soracom-uptime.html Set the access technology, LTE-M frequency bands, and SORACOM APN before starting the network. ```cpp WioNetwork.config.searchAccessTechnology = SEARCH_ACCESS_TECHNOLOGY; WioNetwork.config.ltemBand = LTEM_BAND; WioNetwork.config.apn = APN; WioNetwork.begin(); ``` -------------------------------- ### TurnOnOrReset Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Starts the cellular module. If the module is off, it turns it on; if it is on, it resets it. ```APIDOC ## TurnOnOrReset ### Description Starts the cellular module. If the module is off, it turns it on; if it is on, it resets it. Ensure PowerSupplyCellular is called before this function. ### Response - **bool** - Returns true on success, false on failure. ``` -------------------------------- ### HttpGet Function Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Performs an HTTP GET request to the specified URL. ```cpp int HttpGet(const char* url, char* data, int dataSize) int HttpGet(const char* url, char* data, int dataSize, const WioCellularHttpHeader& header) ``` -------------------------------- ### HttpGet Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Performs an HTTP GET request to the specified URL. ```APIDOC ## int HttpGet(const char* url, char* data, int dataSize) ## int HttpGet(const char* url, char* data, int dataSize, const WioCellularHttpHeader& header) ### Description Performs an HTTP GET request to the specified URL. ### Parameters - **url** (const char*) - URL to connect to (e.g., "http://test.co.jp"). - **data** (char*) - Variable to store the received data. - **dataSize** (int) - Size of the data buffer in bytes. - **header** (WioCellularHttpHeader) - Optional custom HTTP header. ### Returns - **int** - Returns the number of characters received on success, or a negative value on failure. ``` -------------------------------- ### TurnOnOrReset Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Starts the cellular module. If the module is off, it powers it on; if it is already on, it resets it. Ensure PowerSupplyCellular is called first. ```cpp bool TurnOnOrReset() ``` -------------------------------- ### TurnOnOrReset Source: https://seeedjp.github.io/Wiki/Wio_LTE_for_Arduino/Reference-ja.html Starts or resets the LTE module. Ensure power is supplied via PowerSupplyLTE before calling. ```cpp bool TurnOnOrReset(long timeout = 12000) ``` -------------------------------- ### HttpGet Source: https://seeedjp.github.io/Wiki/Wio_3G_for_Arduino/reference-ja.html Performs an HTTP GET request to the specified URL and stores the response in a provided buffer. ```APIDOC ## HttpGet ### Description Performs an HTTP GET request to the specified URL. ### Signature int HttpGet(const char* url, char* data, int dataSize) ### Parameters - **url** (const char*) - The URL to connect to (e.g., "http://test.co.jp"). - **data** (char*) - Buffer to store the received data. - **dataSize** (int) - Size of the data buffer in bytes. ### Returns - **int** - Returns the number of characters received on success, or a negative value on failure. ``` -------------------------------- ### GetIMSI Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Retrieves the IMSI of the SIM card installed in the Wio. ```cpp int GetIMSI(char* imsi, int imsiSize) ``` -------------------------------- ### SORACOM Unified Endpoint Communication Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/cellular/shell.html Example sequence to open a TCP socket, send a JSON payload to the SORACOM Unified Endpoint, and close the connection. ```text socketopen TCP uni.soracom.io 23080 socketsendreceive {"item1":12.34} socketclose ``` -------------------------------- ### GetPhoneNumber Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Retrieves the phone number of the SIM card installed in the Wio. ```cpp int GetPhoneNumber(char* number, int numberSize) ``` -------------------------------- ### Connectivity Diagnostics Output Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/soracom/soracom-connectivity-diagnostics.html Initial diagnostic output displayed upon starting the connectivity check. ```text **************************** * Connectivity diagnostics * **************************** ``` -------------------------------- ### Get Device Information Source: https://seeedjp.github.io/Wiki/Wio_LTE_for_Arduino/Reference-ja.html Functions to retrieve hardware revision, IMEI, IMSI, ICCID, and phone number information. ```cpp int GetRevision(char* revision, int revisionSize) ``` ```cpp int GetIMEI(char* imei, int imeiSize) ``` ```cpp int GetIMSI(char* imsi, int imsiSize) ``` ```cpp int GetICCID(char* iccid, int iccidSize) ``` ```cpp int GetPhoneNumber(char* number, int numberSize) ``` -------------------------------- ### Init Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Initializes the Wio board. All power supplies are turned off immediately after initialization. ```cpp void Init() ``` -------------------------------- ### HTTP GET SORACOM Metadata Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/cellular/transparent.html Retrieves subscriber tags from the SORACOM metadata service using HTTP GET. ```text AT+QHTTPURL=45 // HTTPのURLを設定(45バイト) http://metadata.soracom.io/v1/subscriber.tags AT+QHTTPGET // HTTP GET AT+QHTTPREAD // レスポンスを取得 ``` -------------------------------- ### Initialize WioCellularArduinoTcpClient Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/soracom/soracom-uptime-tcpclient.html Instantiate the client using the WioCellular module and PDP context ID. ```cpp WioCellularArduinoTcpClient client{ WioCellular, WioNetwork.config.pdpContextId }; ``` -------------------------------- ### Initialize FeRAM Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/basic/flash.html Initialize the Flash instance and configure the WP and HOLD pins. ```cpp digitalWrite(PIN_FERAM_WP, HIGH); digitalWrite(PIN_FERAM_HOLD, HIGH); pinMode(PIN_FERAM_WP, OUTPUT); pinMode(PIN_FERAM_HOLD, OUTPUT); if (!Flash.begin(&SPIFLASH_DEVICE, 1)) abort(); ``` -------------------------------- ### GetICCID Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Retrieves the ICCID of the SIM card installed in the Wio. ```cpp int GetICCID(char* iccid, int iccidSize) ``` -------------------------------- ### Init Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Initializes the Wio board. All power supplies are turned off immediately after initialization. ```APIDOC ## Init ### Description Initializes the Wio board. All power supplies are turned off immediately after initialization. ### Signature void Init() ``` -------------------------------- ### Homebrewのインストール Source: https://seeedjp.github.io/Wiki/Wio_LTE_for_Arduino/Installlibusb-ja.html ターミナルで実行してHomebrewをインストールします。 ```bash /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ``` -------------------------------- ### Init Source: https://seeedjp.github.io/Wiki/Wio_LTE_for_Arduino/Reference-ja.html Initializes the Wio LTE module. ```APIDOC ## Init ### Description Initializes the Wio LTE. Immediately after initialization, the LTE module power and Grove connector power are turned off. ``` -------------------------------- ### Initialize BG770A Module Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/cellular/transparent.html Sets factory defaults, enables hardware flow control, and activates sleep mode. ```text AT&F1 // 工場出荷時の設定に戻す AT+IFC=2,2 // ハードウェアフロー制御を有効化 AT+QSCLK=2 // スリープモードを有効化 ``` -------------------------------- ### Configure MQTT client settings Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/cellular/cellular-mqtt-pubsubclient.html Set the broker host, port, keep-alive interval, and callback function for the MQTT client. ```cpp MqttClient.setServer(MQTT_BROKER_HOST, MQTT_BROKER_PORT); MqttClient.setKeepAlive(MQTT_KEEP_ALIVE); MqttClient.setCallback(MqttClientCallback); ``` -------------------------------- ### Define Flash Instance and Variables Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/basic/flash.html Set up the global variables and instances required to interface with the FeRAM. ```cpp static const SPIFlash_Device_t SPIFLASH_DEVICE = FERAM_DEVICE_CONFIG; static SPIClass FlashSpi(FERAM_SPI, PIN_FERAM_SO, PIN_FERAM_SCK, PIN_FERAM_SI); static Adafruit_FlashTransport_SPI FlashTransport(PIN_FERAM_CS, FlashSpi); static Adafruit_SPIFlash Flash(&FlashTransport); static Adafruit_SPIFlashMemory FlashMemory(Flash); static NonVolatileMemory NvmValue(FlashMemory, 0x0000, 4); ``` -------------------------------- ### Connect and subscribe to MQTT topics Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/cellular/cellular-mqtt-pubsubclient.html Establish a connection to the broker and subscribe to a specific topic. ```cpp MqttClient.connect(ClientId.c_str()); MqttClient.subscribe(SubscribeTopic.c_str()); ``` -------------------------------- ### Connect to Host Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/soracom/soracom-uptime-tcpclient.html Establish a TCP connection to the specified host and port. ```cpp client.connect(HOST, PORT); ``` -------------------------------- ### PowerSupplyCellular Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Turns the power supply for the cellular module on or off. After turning on, the module must be started using TurnOnOrReset. ```APIDOC ## PowerSupplyCellular ### Description Turns the power supply for the cellular module on or off. After turning on, the module must be started using TurnOnOrReset. Wait at least 0.5 seconds after calling this function before operating the cellular module. ### Parameters - **on** (bool) - Required - Power supply state (true for on, false for off). ``` -------------------------------- ### libusbのインストール Source: https://seeedjp.github.io/Wiki/Wio_LTE_for_Arduino/Installlibusb-ja.html Homebrewを使用してlibusbをインストールします。実行にはXcodeが必要です。 ```bash brew install libusb ``` -------------------------------- ### Initialize Cellular Module Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/soracom/soracom-uptime.html Initialize the cellular module interface and power it on. ```cpp WioCellular.begin(); if (WioCellular.powerOn(POWER_ON_TIMEOUT) != WioCellularResult::Ok) abort(); ``` -------------------------------- ### Include WioCellular Library Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/grove/grove-button.html Include the WioCellular header to enable the WioCellular instance. ```cpp #include ``` -------------------------------- ### Initialize WioCellular and Grove Power Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/grove/grove-button.html Initialize the cellular module interface and enable power to the Grove connector. ```cpp WioCellular.begin(); digitalWrite(PIN_VGROVE_ENABLE, VGROVE_ENABLE_ON); ``` -------------------------------- ### System and Power Management Source: https://seeedjp.github.io/Wiki/Wio_3G_for_Arduino/reference-ja.html Methods for initializing the Wio 3G board and controlling power supply to various components. ```APIDOC ## GetLastError ### Description Returns the error code of the last executed function. Returns E_OK if no error occurred. ## Init ### Description Initializes the Wio 3G. All power is turned off immediately after initialization. ## PowerSupplyCellular ### Description Turns the power supply to the 3G module on or off. ## PowerSupplyLed ### Description Turns the power supply to the full-color LED on or off. ## PowerSupplyGrove ### Description Turns the power supply to the Grove connectors (D20/A4/A6/I2C/UART) on or off. ``` -------------------------------- ### Get GNSS Location Source: https://seeedjp.github.io/Wiki/Wio_LTE_for_Arduino/Reference-ja.html Retrieves current location data using GNSS/GPS. Returns true on success and false on failure. ```cpp bool GetGNSSLocation(double* longitude, double* latitude, double* altitude = NULL, struct tm* tim = NULL) ``` -------------------------------- ### Troubleshoot Azure Sphere device claim error Source: https://seeedjp.github.io/Wiki/MT3620 Example of an error message encountered during the device claiming process, indicating a required OS update. ```text C:\Users\Seeed05\Documents>azsphere device claim error: The Azure Sphere OS on the attached device requires an update to be used with this version of the SDK. Diagnostic info: [1.2.0, 3] error: Failed to retrieve device ID from attached device: 'The Azure Sphere OS on the attached device requires an update to be used with this version of the SDK. Diagnostic info: [1.2.0, 3]'. error: Command failed in 00:00:00.9187758. ``` -------------------------------- ### Handle MQTT connection loop Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/cellular/cellular-mqtt-pubsubclient.html Main loop logic to ensure the MQTT client remains connected and processes network events. ```cpp void loop(void) { if (!MqttClient.connected()) { if (!MqttClient.connect(ClientId.c_str())) { // 接続エラー } else { // 接続成功 } } else { // 接続中 WioCellular.doWork(10); MqttClient.loop(); if (!MqttClient.connected()) break; } } ``` -------------------------------- ### Arduinoヘッダーの追加 Source: https://seeedjp.github.io/Wiki/Wio_BG770A/kb/kb5.html コンパイルを通すために、スケッチの先頭にArduino.hをインクルードします。 ```cpp #include ``` -------------------------------- ### PowerSupplyLed Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Toggles power to the full-color LED. ```cpp void PowerSupplyLed(bool on) ``` -------------------------------- ### Initial Cellular Status Output Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/cellular/cellular-status.html Displays the initial device information such as IMEI, firmware revision, and SIM status upon module startup. ```text IMEI: 865502060041927 Revision: BG770AGLAAR02A05_JP_01.200.01.200 SIM Inserted: 1(Yes) SIM Init: 3(CPIN Ready & SMS Done) SIM State: READY IMSI: 440103167698583 ICCID: 8981100005810680869F Phone Number: 07043466052 Search ACT: 2(eMTC and NB-IoT) Search ACT Sequence: 0203(eMTC -> NB-IoT) Search Band - eMTC: 0x2000000000f0e189f Search Band - NB-IoT: 0x200000000090f189f ``` -------------------------------- ### WaitForCSRegistration Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Waits for CS network registration to complete. ```cpp bool WaitForCSRegistration(long timeout = 120000) ``` -------------------------------- ### Modem Initialization Output Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/soracom/soracom-connectivity-diagnostics.html Status output during the modem initialization phase. ```text --- Initializing modem, please wait for a while...[OK] Target modem: BG770AGLAAR02A05_JP_01.200.01.200 ``` -------------------------------- ### Check Available Data Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/soracom/soracom-uptime-tcpclient.html Verify if there is data available to be read from the client. ```cpp availableSize = client.available(); ``` -------------------------------- ### Include Required Libraries Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/basic/flash.html Include the necessary libraries for FeRAM operations. Ensure Adafruit_SPIFlash.h is included before WioNonVolatileMemory.h. ```cpp #include #include ``` -------------------------------- ### WaitForPSRegistration Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Waits for PS network registration to complete. ```cpp bool WaitForPSRegistration(long timeout = 120000) ``` -------------------------------- ### Retrieve Device and SIM Information Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/cellular/transparent.html Commands to fetch firmware version, IMEI, PIN status, IMSI, ICCID, and phone number. ```text AT+QGMR // ファームウェアのレビジョンを取得 AT+GSN // IMEIを取得 AT+CPIN? // PIN状態を取得 AT+CIMI // IMSIを取得 AT+QCCID // ICCIDを取得 AT+CNUM // 電話番号を取得 ``` -------------------------------- ### WaitForPSRegistration Source: https://seeedjp.github.io/Wiki/Wio_LTE_for_Arduino/Reference-ja.html Waits for the device to register with the PS network. ```APIDOC ## WaitForPSRegistration ### Signature bool WaitForPSRegistration(long timeout = 120000) ### Parameters - **timeout** (long) - Timeout duration in milliseconds. ### Returns - **bool** - Returns true if registration is successful, false otherwise. ``` -------------------------------- ### Include Adafruit SleepyDog Library Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/basic/watchdog.html Include the necessary header file to access the Watchdog instance. ```cpp #include ``` -------------------------------- ### Wait for Network Availability Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/soracom/soracom-uptime.html Wait until the network connection is established before proceeding. ```cpp if (!WioNetwork.waitUntilCommunicationAvailable(NETWORK_TIMEOUT)) abort(); ``` -------------------------------- ### SystemReset Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Resets the CPU. ```APIDOC ## static void SystemReset() ### Description Resets the CPU. ``` -------------------------------- ### WaitForCSRegistration Source: https://seeedjp.github.io/Wiki/Wio_LTE_for_Arduino/Reference-ja.html Waits for the device to register with the CS network. ```APIDOC ## WaitForCSRegistration ### Signature bool WaitForCSRegistration(long timeout = 120000) ### Parameters - **timeout** (long) - Timeout duration in milliseconds. ### Returns - **bool** - Returns true if registration is successful, false otherwise. ``` -------------------------------- ### Publish MQTT message Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/cellular/cellular-mqtt-pubsubclient.html Send a message to a specific topic using the MQTT client. ```cpp MqttClient.publish(PublishTopic.c_str(), str.c_str()); ``` -------------------------------- ### Blink USER LED on Wio BG770A Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/basic/blink.html Uses digitalWrite to control the built-in LED state and delay to manage the timing intervals. ```cpp digitalWrite(LED_BUILTIN, HIGH); delay(200); digitalWrite(LED_BUILTIN, LOW); delay(800); ``` -------------------------------- ### Verify MQTT message reception Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/cellular/cellular-mqtt-pubsubclient.html Command to publish a message to the Wio BG770A from a PC for testing. ```bash mosquitto_pub -h test.mosquitto.org -p 1883 -t "WioCellular//downstream" -m "" ``` -------------------------------- ### SocketOpen Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Opens a socket connection to the specified host and port. Up to 12 connections can be open simultaneously. ```cpp int SocketOpen(const char* host, int port, SocketType type) ``` -------------------------------- ### SystemReset Function Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Resets the CPU. ```cpp static void SystemReset() ``` -------------------------------- ### Activate Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Enables data communication using the specified APN, username, and password. ```cpp bool Activate(const char* accessPointName, const char* userName, const char* password, long waitForRegistTimeout = 120000) ``` -------------------------------- ### SocketOpen Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Opens a socket connection to the specified host and port. ```APIDOC ## SocketOpen ### Description Opens a socket connection to the specified host and port. Up to 12 connections can be open simultaneously. ### Parameters - **host** (const char*) - Required - Hostname to connect to - **port** (int) - Required - Port number - **type** (SocketType) - Required - Socket type (WIO_TCP or WIO_UDP) ### Response - **int** - Returns connection ID on success, negative value on failure. ``` -------------------------------- ### Network Connection Information Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/soracom/soracom-connectivity-diagnostics.html AT commands to verify IP address, signal quality, and operator information. ```text --- Getting network info... > AT+QIACT? +QIACT: 1,1,1,"10.225.154.84" > AT+QCSQ +QCSQ: "eMTC",-84,-91,165,-6 > AT+COPS? +COPS: 0,0,"NTT DOCOMO",7 > AT+CGPADDR=1 +CGPADDR: 1,"10.225.154.84" ``` -------------------------------- ### Configure Buzzer Pin Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/grove/grove-buzzer.html Set the buzzer pin to output mode and initialize its state. ```cpp digitalWrite(BUZZER_PIN, LOW); pinMode(BUZZER_PIN, OUTPUT); ``` -------------------------------- ### Enable Watchdog Timer Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/basic/watchdog.html Set the watchdog timeout duration in milliseconds using the enable method. ```cpp Watchdog.enable(10000); ``` -------------------------------- ### Configure Cellular Bands for KDDI Source: https://seeedjp.github.io/Wiki/Wio_BG770A/cellular.html Sets the specific frequency bands required for operation on the KDDI network. ```AT Command AT+QCFG="band",0,0xa020005,0x8020005 ``` -------------------------------- ### Activate Source: https://seeedjp.github.io/Wiki/Wio_LTE_for_Arduino/Reference-ja.html Enables data communication using the specified APN, username, and password. ```APIDOC ## Activate ### Signature bool Activate(const char* accessPointName, const char* userName, const char* password, long waitForRegistTimeout = 120000) ### Parameters - **accessPointName** (const char*) - APN string. - **userName** (const char*) - Username for authentication. - **password** (const char*) - Password for authentication. - **waitForRegistTimeout** (long) - Timeout duration in milliseconds. ### Returns - **bool** - Returns true on success, false on failure. ``` -------------------------------- ### キャリア別ネットワーク設定例 Source: https://seeedjp.github.io/Wiki/Wio_BG770A/kb/kb4.html NTTドコモおよびKDDIのLTE-M環境に合わせた設定例です。 ```cpp #define SEARCH_ACCESS_TECHNOLOGY (WioCellularNetwork::SearchAccessTechnology::LTEM) #define LTEM_BAND (WioCellularNetwork::NTTDOCOMO_LTEM_BAND) ``` ```cpp #define SEARCH_ACCESS_TECHNOLOGY (WioCellularNetwork::SearchAccessTechnology::LTEM) #define LTEM_BAND (WioCellularNetwork::KDDI_LTEM_BAND) ``` -------------------------------- ### Configure PDP Context Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/cellular/transparent.html Sets the APN and PDP context settings for cellular data connectivity. ```text AT+CGDCONT? // PDPコンテキストを取得 AT+CFUN=0 // 機能レベルを最小化 AT+CGDCONT=1,"IP","soracom.io","0.0.0.0",0,0,0 // PDPコンテキストを設定 AT+CFUN=1 // 機能レベルを最大化 ``` -------------------------------- ### ネットワーク探索設定の基本定義 Source: https://seeedjp.github.io/Wiki/Wio_BG770A/kb/kb4.html サンプルスケッチで使用されるネットワーク探索技術と周波数バンドの基本定義です。 ```cpp #define SEARCH_ACCESS_TECHNOLOGY (WioCellularNetwork::SearchAccessTechnology::LTEM) #define LTEM_BAND (WioCellularNetwork::ALL_LTEM_BAND) ``` ```cpp WioNetwork.config.searchAccessTechnology = SEARCH_ACCESS_TECHNOLOGY; WioNetwork.config.ltemBand = LTEM_BAND; ``` -------------------------------- ### GetIMEI Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Retrieves the IMEI of the Wio device. ```cpp int GetIMEI(char* imei, int imeiSize) ``` -------------------------------- ### PowerSupply Control Functions Source: https://seeedjp.github.io/Wiki/Wio_LTE_for_Arduino/Reference-ja.html Functions to toggle power supply for various hardware components on the Wio LTE board. ```cpp void PowerSupplyLTE(bool on) ``` ```cpp void PowerSupplyCellular(bool on) ``` ```cpp void PowerSupplyGNSS(bool on) ``` ```cpp void PowerSupplyLed(bool on) ``` ```cpp void PowerSupplyGrove(bool on) ``` ```cpp void PowerSupplySD(bool on) ``` -------------------------------- ### 広範囲探索のための設定例 Source: https://seeedjp.github.io/Wiki/Wio_BG770A/kb/kb4.html LTE-MとNB-IoTの両方を探索し、接続範囲を最大化するための設定例です。 ```cpp #define SEARCH_ACCESS_TECHNOLOGY (WioCellularNetwork::SearchAccessTechnology::LTEM_NBIOT) #define LTEM_BAND (WioCellularNetwork::ALL_LTEM_BAND) ``` ```cpp #define SEARCH_ACCESS_TECHNOLOGY (WioCellularNetwork::SearchAccessTechnology::NBIOT_LTEM) #define LTEM_BAND (WioCellularNetwork::ALL_LTEM_BAND) ``` -------------------------------- ### SORACOM Network Configuration Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/soracom/soracom-connectivity-diagnostics.html AT commands to configure APN and network scan settings for SORACOM. ```text --- Executing AT commands to connect SORACOM network... > AT+CGDCONT=1,"IP","soracom.io","0.0.0.0",0,0,0 Ok > AT+QCFG="iotopmode",0,1 Ok > AT+QCFG="nwscanseq",00,1 Ok ``` -------------------------------- ### Receive Data Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/soracom/soracom-uptime-tcpclient.html Read incoming data into a buffer. ```cpp const int recvSize = client.read(recvData, sizeof(recvData)); ``` -------------------------------- ### HttpPost Function Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Performs an HTTP POST request to the specified URL. ```cpp bool HttpPost(const char* url, const char* data, int* responseCode) bool HttpPost(const char* url, const char* data, int* responseCode, const WioCellularHttpHeader& header) ``` -------------------------------- ### LedSetRGB Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Sets the color of the onboard full-color LED. ```APIDOC ## LedSetRGB ### Description Sets the color of the onboard full-color LED. Set all parameters to 0 to turn off the LED. ### Parameters - **red** (byte) - Required - Red intensity (0-255) - **green** (byte) - Required - Green intensity (0-255) - **blue** (byte) - Required - Blue intensity (0-255) ``` -------------------------------- ### ソフトウェア起動シーケンスのフローチャート Source: https://seeedjp.github.io/Wiki/Wio_BG770A/user-manual.html Wio BG770Aの起動プロセスにおけるMBR、ブートローダー、アプリケーションの遷移を示します。 ```mermaid flowchart LR Start((Start)) Bootloader[ブートローダー] Application[アプリケーション] Start --> MBR MBR --> Bootloader Bootloader -->|APP mode| Application Bootloader -->|DFU mode| Bootloader ``` -------------------------------- ### Verify MQTT message transmission Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/cellular/cellular-mqtt-pubsubclient.html Command to subscribe to messages sent from the Wio BG770A to a PC for testing. ```bash mosquitto_sub -h test.mosquitto.org -p 1883 -t "WioCellular//upstream" ``` -------------------------------- ### GetTime Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Retrieves the current date and time from the cellular module. ```cpp bool GetTime(struct tm* tim) ``` -------------------------------- ### Convert Raw Value to Voltage Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/grove/grove-rotary-angle-sensor.html Calculate the actual analog input voltage based on the 14-bit raw value, gain, and reference voltage. ```cpp const auto rotaryAngleVoltage = (float)rotaryAngleRaw / 16383 * 0.6f / (1.0f / 6); ``` -------------------------------- ### Perform HTTP POST request Source: https://seeedjp.github.io/Wiki/Wio_3G_for_Arduino/reference-ja.html Sends data to a specified URL via HTTP POST and retrieves the response status code. ```cpp bool HttpPost(const char* url, const char* data, int* responseCode) ``` -------------------------------- ### Sleep and Wakeup Source: https://seeedjp.github.io/Wiki/Wio_LTE_for_Arduino/Reference-ja.html Manages the power-saving mode of the LTE module. ```cpp void Sleep() ``` ```cpp bool Wakeup() ``` -------------------------------- ### GetLocation Source: https://seeedjp.github.io/Wiki/Wio_LTE_for_Arduino/Reference-ja.html Retrieves the latitude and longitude of the connected base station. ```cpp bool GetLocation(double* longitude, double* latitude) ``` -------------------------------- ### Modem and SIM Information Retrieval Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/soracom/soracom-connectivity-diagnostics.html AT commands used to retrieve modem serial number, IMSI, and SIM status. ```text --- Getting modem info... > AT+GSN 865502060000279 > AT+CIMI 440103167698583 > AT+QSIMSTAT? +QSIMSTAT: 0,1 ``` -------------------------------- ### Control Buzzer Output Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/grove/grove-buzzer.html Toggle the buzzer state using digitalWrite to create a beep pattern. ```cpp digitalWrite(BUZZER_PIN, HIGH); delay(BUZZER_ON_TIME); digitalWrite(BUZZER_PIN, LOW); delay(BUZZER_OFF_TIME); ``` -------------------------------- ### SocketReceive Source: https://seeedjp.github.io/Wiki/Wio_LTE_for_Arduino/Reference-ja.html Receives data from an established socket connection. ```APIDOC ## SocketReceive ### Signature int SocketReceive(int connectId, byte* data, int dataSize) int SocketReceive(int connectId, char* data, int dataSize) int SocketReceive(int connectId, byte* data, int dataSize, long timeout) int SocketReceive(int connectId, char* data, int dataSize, long timeout) ### Parameters - **connectId** (int) - Connection ID. - **data** (byte*/char*) - Buffer to store received data. - **dataSize** (int) - Size of the buffer. - **timeout** (long) - Optional timeout in milliseconds. ### Returns - **int** - Returns number of bytes received, 0 if no data, or negative value on failure. ``` -------------------------------- ### LTE Module Lifecycle Source: https://seeedjp.github.io/Wiki/Wio_LTE_for_Arduino/Reference-ja.html Functions to manage the state of the LTE module. ```APIDOC ## LTE Lifecycle Functions ### Description - TurnOnOrReset(long timeout): Starts or resets the LTE module. - TurnOff(long timeout): Stops the LTE module. - Sleep(): Puts the LTE module into power-saving mode. - Wakeup(): Wakes the LTE module from power-saving mode. ``` -------------------------------- ### SyncTime Source: https://seeedjp.github.io/Wiki/Wio_LTE_for_Arduino/Reference-ja.html Synchronizes the LTE module time with the specified NTP server. ```cpp bool SyncTime(const char* host) ``` -------------------------------- ### Configure Button Pin Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/grove/grove-button.html Set the Grove - Button pin to input mode. ```cpp pinMode(BUTTON_PIN, INPUT); ``` -------------------------------- ### Send Data via TCP or UDP Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/soracom/soracom-uptime.html Use TCP or UDP clients to send data to the SORACOM Unified Endpoint. ```cpp WioCellularTcpClient2 client{ WioCellular }; client.open(WioNetwork.config.pdpContextId, HOST, PORT); client.waitforConnect(); client.send(str.data(), str.size()); client.receive(recvData, sizeof(recvData), &recvSize, RECEIVE_TIMEOUT); ``` ```cpp WioCellularUdpClient2 client{ WioCellular }; client.open(WioNetwork.config.pdpContextId, HOST, PORT); client.waitforConnect(); client.send(str.data(), str.size()); client.receive(recvData, sizeof(recvData), &recvSize, RECEIVE_TIMEOUT); ``` -------------------------------- ### TurnOff Source: https://seeedjp.github.io/Wiki/Wio_LTE_for_Arduino/Reference-ja.html Stops the LTE module. ```cpp bool TurnOff(long timeout = 60000) ``` -------------------------------- ### HttpPost Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Performs an HTTP POST request to the specified URL. ```APIDOC ## bool HttpPost(const char* url, const char* data, int* responseCode) ## bool HttpPost(const char* url, const char* data, int* responseCode, const WioCellularHttpHeader& header) ### Description Performs an HTTP POST request to the specified URL. ### Parameters - **url** (const char*) - URL to connect to. - **data** (const char*) - Data to send. - **responseCode** (int*) - Variable to store the received HTTP response status code. - **header** (WioCellularHttpHeader) - Optional custom HTTP header. ### Returns - **bool** - Returns true on success, false on failure. ``` -------------------------------- ### Device Information Source: https://seeedjp.github.io/Wiki/Wio_LTE_for_Arduino/Reference-ja.html Functions to retrieve device and SIM information. ```APIDOC ## Device Information Functions ### Description - GetRevision: Gets the Wio LTE revision. - GetIMEI: Gets the device IMEI. - GetIMSI: Gets the SIM IMSI. - GetICCID: Gets the SIM ICCID. - GetPhoneNumber: Gets the SIM phone number. ``` -------------------------------- ### LedSetRGB Source: https://seeedjp.github.io/Wiki/Wio_cell_lib_for_Arduino/reference-ja.html Sets the color of the full-color LED. Specify 0 for all parameters to turn the LED off. ```cpp void LedSetRGB(byte red, byte green, byte blue) ``` -------------------------------- ### HttpPost Source: https://seeedjp.github.io/Wiki/Wio_3G_for_Arduino/reference-ja.html Performs an HTTP POST request to the specified URL with provided data. ```APIDOC ## HttpPost ### Description Performs an HTTP POST request to the specified URL. ### Signature bool HttpPost(const char* url, const char* data, int* responseCode) ### Parameters - **url** (const char*) - The URL to connect to. - **data** (const char*) - The data to send. - **responseCode** (int*) - Pointer to a variable to store the HTTP response status code. ### Returns - **bool** - Returns true on success, false on failure. ``` -------------------------------- ### Check Network Registration Status Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/cellular/transparent.html Verifies EPS registration, current operator, and packet domain service status. ```text AT+CEREG? // EPSネットワーク登録状態を取得 AT+COPS? // 接続しているネットワークオペレーターを取得 AT+CGATT? // パケットドメインサービスの状態を取得 ``` -------------------------------- ### Network and Socket Communication Source: https://seeedjp.github.io/Wiki/Wio_3G_for_Arduino/reference-ja.html Methods for activating data connections and performing TCP/UDP socket operations. ```APIDOC ## Activate ### Description Enables data communication using the specified APN, username, and password. ## Deactivate ### Description Disables data communication. ## SocketOpen ### Description Opens a socket connection to the specified host and port. ## SocketSend ### Description Sends data to the specified connection ID. Maximum data size per send is 1460 bytes. ## SocketReceive ### Description Receives data from the specified connection ID. ## SocketClose ### Description Closes the specified socket connection. ``` -------------------------------- ### SORACOM Platform Ping Test Source: https://seeedjp.github.io/Wiki/Wio_BG770A/examples/soracom/soracom-connectivity-diagnostics.html AT command to ping the SORACOM platform and the resulting connectivity statistics. ```text --- Conntectivity test: Ping to pong.soracom.io... > AT+QPING=1,"pong.soracom.io",3,3 Ok Dest="100.127.100.127", Bytes=32, Time=56, TTL=64 Dest="100.127.100.127", Bytes=32, Time=67, TTL=64 Dest="100.127.100.127", Bytes=32, Time=93, TTL=64 Sent=3, Received=3, Lost=0, Min=56, Max=93, Avg=72 --- Execution completed, please write your own sketch and enjoy it. ```