├── ic_launcher-web.png ├── libs └── android-support-v4.jar ├── res ├── drawable-hdpi │ └── ic_launcher.png ├── drawable-mdpi │ └── ic_launcher.png ├── drawable-xhdpi │ └── ic_launcher.png ├── drawable-xxhdpi │ └── ic_launcher.png ├── values-sw600dp │ └── dimens.xml ├── values │ ├── dimens.xml │ ├── strings.xml │ ├── styles.xml │ └── colors.xml ├── values-sw720dp-land │ └── dimens.xml ├── values-v11 │ └── styles.xml ├── values-v14 │ └── styles.xml ├── menu │ └── main.xml ├── layout │ ├── adapter_device_name.xml │ ├── activity_main.xml │ ├── fragment_main_dummy.xml │ ├── activity_device_list.xml │ └── fragment_settings.xml ├── drawable │ └── form_button_selector.xml └── values-ko │ └── strings.xml ├── README.md ├── src └── com │ └── hardcopy │ └── btchat │ ├── http │ ├── HttpListener.java │ ├── HttpInterface.java │ ├── HttpAsyncTask.java │ ├── HttpFileAsyncTask.java │ └── HttpRequester.java │ ├── fragments │ ├── IFragmentListener.java │ ├── LLSettingsFragment.java │ ├── FragmentAdapter.java │ └── ExampleFragment.java │ ├── utils │ ├── Constants.java │ ├── RecycleUtils.java │ ├── Logs.java │ ├── AppSettings.java │ └── Utils.java │ ├── contents │ ├── CommandParser.java │ └── DBHelper.java │ ├── bluetooth │ ├── TransactionReceiver.java │ ├── ConnectionInfo.java │ ├── TransactionBuilder.java │ └── BluetoothManager.java │ ├── service │ ├── ServiceMonitoring.java │ └── BTCTemplateService.java │ ├── DeviceListActivity.java │ └── MainActivity.java ├── AndroidManifest.xml └── LICENSE /ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godstale/BTChat/HEAD/ic_launcher-web.png -------------------------------------------------------------------------------- /libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godstale/BTChat/HEAD/libs/android-support-v4.jar -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godstale/BTChat/HEAD/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godstale/BTChat/HEAD/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godstale/BTChat/HEAD/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godstale/BTChat/HEAD/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /res/values-sw720dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 128dp 8 | 9 | 10 | -------------------------------------------------------------------------------- /res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BTChat 2 | BT chatting between arduino and android. (supports IoT feature) 3 | 4 | 5 | 아두이노와 블루투스로 연결해서 간단한 채팅을 할 수 있도록 작성한 앱입니다. IoT를 위한 HTTP Request 기능도 포함하고 있습니다. 6 | 7 | 좌측상단 블루투스 연결 버튼을 눌러 기기를 검색한 후 페어링을 할 수 있습니다. 페어링이 되면 이후 블루투스로 들어오는 문자열을 화면에 표시해줍니다. 간단한 채팅이나 로그 모니터링 용으로 사용할 수 있습니다. 8 | IoT 지원을 위해 특정 문자열이 들어올 경우 자동으로 HTTP Request를 보낼 수 있도록 작성되었습니다. 아래와 같은 문자열을 인식합니다. 9 | 10 | Whenever BTChat find message like : thingspeak:key=xxx&field1=xxx[*] 11 | 12 | Automatically sends a HTTP Request : http://184.106.153.149/update?key=xxx&field1=xxx 13 | 14 | -------------------------------------------------------------------------------- /res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /res/layout/adapter_device_name.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | -------------------------------------------------------------------------------- /src/com/hardcopy/btchat/http/HttpListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Retro Watch - Open source smart watch project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.hardcopy.btchat.http; 18 | 19 | public interface HttpListener { 20 | // Callback methods 21 | public void OnReceiveHttpResponse(int type, String strResult, int resultCode); 22 | public void OnReceiveFileResponse(int type, String id, String filepath, String url, int resultCode); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/com/hardcopy/btchat/fragments/IFragmentListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Bluetooth Connection Template 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.hardcopy.btchat.fragments; 18 | 19 | public interface IFragmentListener { 20 | public static final int CALLBACK_RUN_IN_BACKGROUND = 1; 21 | public static final int CALLBACK_SEND_MESSAGE = 2; 22 | 23 | public void OnFragmentCallback(int msgType, int arg0, int arg1, String arg2, String arg3, Object arg4); 24 | } 25 | -------------------------------------------------------------------------------- /res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 13 | 14 | 15 | 16 | 22 | 28 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /res/drawable/form_button_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/com/hardcopy/btchat/utils/Constants.java: -------------------------------------------------------------------------------- 1 | package com.hardcopy.btchat.utils; 2 | 3 | public class Constants { 4 | 5 | // Service handler message key 6 | public static final String SERVICE_HANDLER_MSG_KEY_DEVICE_NAME = "device_name"; 7 | public static final String SERVICE_HANDLER_MSG_KEY_DEVICE_ADDRESS = "device_address"; 8 | public static final String SERVICE_HANDLER_MSG_KEY_TOAST = "toast"; 9 | 10 | // Preference 11 | public static final String PREFERENCE_NAME = "btchatPref"; 12 | public static final String PREFERENCE_KEY_BG_SERVICE = "BackgroundService"; 13 | public static final String PREFERENCE_CONN_INFO_ADDRESS = "device_address"; 14 | public static final String PREFERENCE_CONN_INFO_NAME = "device_name"; 15 | 16 | // Message types sent from Service to Activity 17 | public static final int MESSAGE_CMD_ERROR_NOT_CONNECTED = -50; 18 | 19 | public static final int MESSAGE_BT_STATE_INITIALIZED = 1; 20 | public static final int MESSAGE_BT_STATE_LISTENING = 2; 21 | public static final int MESSAGE_BT_STATE_CONNECTING = 3; 22 | public static final int MESSAGE_BT_STATE_CONNECTED = 4; 23 | public static final int MESSAGE_BT_STATE_ERROR = 10; 24 | 25 | public static final int MESSAGE_READ_CHAT_DATA = 201; 26 | 27 | 28 | 29 | // Intent request codes 30 | public static final int REQUEST_CONNECT_DEVICE = 1; 31 | public static final int REQUEST_ENABLE_BT = 2; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /res/layout/fragment_main_dummy.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 15 | 16 | 20 | 21 | 28 | 29 |