Compare commits

..

No commits in common. 'master' and 'Huatao_branch' have entirely different histories.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 MiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 KiB

After

Width:  |  Height:  |  Size: 263 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 KiB

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 347 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 490 KiB

After

Width:  |  Height:  |  Size: 488 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 KiB

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 136 KiB

@ -7,11 +7,11 @@
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="E:\SDK\avd\.android\avd\Pixel_XL_API_30.avd" />
<value value="D:\AndroidSDK\.android\.android\avd\Pixel_2_API_31.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2022-07-10T02:39:23.302314100Z" />
<timeTargetWasSelectedWithDropDown value="2022-06-14T12:27:15.523840400Z" />
</component>
</project>

@ -19,9 +19,9 @@
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/activity_history.xml" value="0.22" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/activity_main.xml" value="0.1" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/activity_main2.xml" value="0.10235507246376811" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/activity_menu.xml" value="0.25" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/activity_menu.xml" value="0.33" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/activity_no_pick.xml" value="0.2" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/activity_sign_up.xml" value="0.22" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/activity_sign_up.xml" value="0.10235507246376811" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/activity_wait.xml" value="0.18" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/buttom.xml" value="0.10235507246376811" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/forget.xml" value="0.2630208333333333" />
@ -30,7 +30,7 @@
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/my_fragment1.xml" value="0.1" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/my_fragment2.xml" value="0.18489583333333334" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/my_fragment3.xml" value="0.2" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/pickup.xml" value="0.1" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/pickup.xml" value="0.5" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/tab1.xml" value="0.10235507246376811" />
<entry key="..\:/shijianer/xcr_se/src/Logistics/app/src/main/res/layout/top.xml" value="0.3717105263157895" />
<entry key="..\:/无人物流/xcr_se/src/Logistics/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.1" />

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head title="pickup">
<head>
<meta charset="utf-8" />
<script type="text/javascript" type="text/javascript">

@ -2,11 +2,10 @@ package com.example.logistics.entity;
public class Good {
private int id;
private String phoneNum;//货主手机号
private int shelfNum;//货架号
private int floorNum;//货架层号
private String time;//入库时间
private String phoneNum;
private int shelfNum;
private int floorNum;
private String time;
public Good(){

@ -4,9 +4,9 @@ import android.provider.ContactsContract;
public class Operation {
private int id;
private String pickUpCode;//取件码
private String phoneNum;//货主手机号
private String time;//取件时间
private String pickUpCode;
private String phoneNum;
private String time;
public Operation(){

@ -2,9 +2,9 @@ package com.example.logistics.entity;
public class User {
private int userId;
private String userName;//用户名
private String passWord;//密码
private String phoneNum;//手机吗
private String userName;
private String passWord;
private String phoneNum;
public User(){

@ -18,30 +18,31 @@ import java.util.Map;
public class goodManager {
private static final String TAG = "goodManager";
private static final String TAG = "goodDao";
public int search(String id, String phonenum, Context context){//搜索快件位置id手机号
Log.d(TAG, "search");
HashMap<String, Object> map = new HashMap<>();
Connection connection = DBOpenHelper.getConn();//DBO连接数据库
Connection connection = DBOpenHelper.getConn();
int msg = 0;
try{
Log.d(TAG, "select goods");
String sql = "select * from goods where id = ?";//搜索指定取件码(=id号的快件信息
String sql = "select * from goods where id = ?";
if(connection != null){
Log.d(TAG, "connection!");
PreparedStatement ps = connection.prepareStatement(sql);
if(ps != null){
Log.e(TAG, "id: " + id);
ps.setInt(1,Integer.parseInt(id));//设置sql语句中id号
ResultSet rs = ps.executeQuery();//执行sql语句并返回结果到rs
ps.setInt(1,Integer.parseInt(id));
ResultSet rs = ps.executeQuery();
int count = rs.getMetaData().getColumnCount();
while(rs.next()){//遍历返回结果加入map中
while(rs.next()){
for(int i = 1; i <= count; i++){
String field = rs.getMetaData().getColumnName(i);
map.put(field, rs.getString(field));
@ -52,14 +53,14 @@ public class goodManager {
if(map.size() != 0){
Log.d(TAG, "map isnot null");
StringBuilder s = new StringBuilder();
for(String key:map.keySet()){//搜索map中的key值
if(key.equals("phonenum")){//搜索phonenum属性
for(String key:map.keySet()){
if(key.equals("phonenum")){
String strphone = String.valueOf(map.get(key));
Log.d(TAG, strphone);
if(phonenum.equals(strphone.substring(7,11))){//如果手机尾号后四位相等
if(phonenum.equals(strphone.substring(7,11))){
msg = 1; //phonenum correct
Log.d(TAG, "phonenum correct");
AlertDialog.Builder builder = new AlertDialog.Builder(context);//弹出快件位置信息
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("快件位置");
builder.setMessage("\n第 "+ map.get("shelfnum")+ " 号货架\n第 " + map.get("floornum")+ " 层");
Looper.prepare();
@ -88,14 +89,11 @@ public class goodManager {
e.printStackTrace();
Log.d(TAG, "search bug: " + e.getMessage());
msg = 0;
} finally {
}
return msg;
}
public boolean delete(String pickupcode){//根据取件码删除快递
public boolean delete(String pickupcode){
Connection connection = DBOpenHelper.getConn();
try{
@ -107,9 +105,9 @@ public class goodManager {
PreparedStatement ps = connection.prepareStatement(sql);
if(ps != null){
Log.e(TAG, "pickupcode: " + pickupcode);
ps.setString(1,pickupcode);//设置参数
ps.setString(1,pickupcode);
ps.executeUpdate();//删除操作
ps.executeUpdate();
connection.close();
ps.close();
@ -123,16 +121,13 @@ public class goodManager {
return false;
}
}catch(Exception e){
e.printStackTrace();
Log.d(TAG, "delete bug" + e.getMessage());
}finally {
}
return false;
}
public List<Map<String, Object>> nopick(String phonenum){//根据手机号查询未取的件
public List<Map<String, Object>> nopick(String phonenum){
Connection connection = DBOpenHelper.getConn();
Log.d(TAG, "nopick goods");
@ -167,7 +162,7 @@ public class goodManager {
map.put(field, rs.getString(field));
}
}
datalist.add(map);//加入即将显示的列表中
datalist.add(map);
}
connection.close();
ps.close();
@ -180,13 +175,11 @@ public class goodManager {
}catch (Exception e){
e.printStackTrace();
Log.d(TAG, "search bug: " + e.getMessage());
} finally {
}
return datalist;
}
public int pickup(String pickupcode, String phonenum){//根据取件码与手机号取件
public int pickup(String pickupcode, String phonenum){
HashMap<String, Object> map = new HashMap<>();
Connection connection = DBOpenHelper.getConn();
@ -202,7 +195,7 @@ public class goodManager {
if(ps != null){
Log.e(TAG, "pickupcode: " + pickupcode);
ps.setInt(1,Integer.parseInt(pickupcode));
ResultSet rs = ps.executeQuery();//获取要取的件信息
ResultSet rs = ps.executeQuery();
int count = rs.getMetaData().getColumnCount();
while(rs.next()){
@ -213,12 +206,12 @@ public class goodManager {
}
connection.close();
ps.close();
if(map.size() != 0){//如果找不到对应快件
if(map.size() != 0){
Log.d(TAG, "map has value");
StringBuilder s = new StringBuilder();
for(String key:map.keySet()){
if(key.equals("phonenum")){
if(phonenum.equals(map.get(key).toString().substring(7,11))){//如果手机尾号相等
if(phonenum.equals(map.get(key).toString().substring(7,11))){
msg = 1; //password correct
}else{
msg = 2; //password incorrect
@ -242,8 +235,6 @@ public class goodManager {
e.printStackTrace();
Log.d(TAG, "login bug: " + e.getMessage());
msg = 0;
} finally {
}
return msg;
}

@ -15,19 +15,21 @@ import java.util.List;
import java.util.Map;
public class operationManager {
private static final String TAG = "operationManager";
private static final String TAG = "operationDao";
public boolean add(String pickupcode, String phonenum){//根据取件码与手机号添加操作记录
public boolean add(String pickupcode, String phonenum){
HashMap<String, Object> map = new HashMap<>();
Connection connection = DBOpenHelper.getConn();
try{
SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
Log.d(TAG, "add");
SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");//时间格式
Date date = new Date();
String time = format1.format(date);//时间格式字符串化
String time = format1.format(date);
String sql = "insert into operations(pickupcode, phonenum, time) values (?,?,?)";
if(connection != null){
PreparedStatement ps = connection.prepareStatement(sql);
@ -52,21 +54,16 @@ public class operationManager {
e.printStackTrace();
Log.e(TAG, "异常 add operation");
return false;
}finally {
}
}
public List<Map<String, Object>> history(String phonenum){//根据手机号查询历史记录
public List<Map<String, Object>> history(String phonenum){
Connection connection = DBOpenHelper.getConn();
List<Map<String, Object>> datalist;//查询结果显示列表
List<Map<String, Object>> datalist;
datalist = new ArrayList<Map<String, Object>>();
try{
Log.d(TAG, "history");
String sql = "select * from operations where phonenum = ?";
if(connection != null){
@ -101,8 +98,6 @@ public class operationManager {
}catch (Exception e){
e.printStackTrace();
Log.d(TAG, "search bug: " + e.getMessage());
}finally {
}
return datalist;
}

@ -14,18 +14,15 @@ import java.sql.Connection;
public class userManager {
private static final String TAG = "userManager";
private static final String TAG = "userDao";
public int login(String username, String password){//根据用户名与密码登录
public int login(String username, String password){
HashMap<String, Object> map = new HashMap<>();
Connection connection = DBOpenHelper.getConn();
int msg = 0;
try{
Log.d(TAG, "login");
String sql = "select * from users where username = ?";
if(connection != null){
@ -44,16 +41,16 @@ public class userManager {
}
connection.close();
ps.close();
password = MD5Utils.md5(password);//密码md5加密
password = MD5Utils.md5(password);
if(map.size() != 0){
StringBuilder s = new StringBuilder();
for(String key:map.keySet()){
if(key.equals("password")){//查看password属性
if(key.equals("password")){
if(password.equals(map.get(key))){
msg = 1; //密码正确
msg = 1; //password correct
}else{
msg = 2; //密码错误
msg = 2; //password incorrect
}
break;
}
@ -71,27 +68,20 @@ public class userManager {
msg = 0;
}
}catch (Exception e){
e.printStackTrace();
Log.d(TAG, "login bug: " + e.getMessage());
msg = 0;
} finally {
}
return msg;
}
public int loginByPhone(String phonenum, String password){//通过手机号登录
public int loginByPhone(String phonenum, String password){
HashMap<String, Object> map = new HashMap<>();
Connection connection = DBOpenHelper.getConn();
int msg = 0;
try{
Log.d(TAG, "loginByPhone");
String sql = "select * from users where phonenum = ?";
if(connection != null){
@ -110,7 +100,6 @@ public class userManager {
}
connection.close();
ps.close();
password = MD5Utils.md5(password);
if(map.size() != 0){
StringBuilder s = new StringBuilder();
@ -141,20 +130,15 @@ public class userManager {
e.printStackTrace();
Log.d(TAG, "login bug: " + e.getMessage());
msg = 0;
} finally {
}
return msg;
}
public User findUser(String username){//查看是否已有该用户
public User findUser(String username){
Connection connection = DBOpenHelper.getConn();
User user = null;
try{
Log.d(TAG, "findUser");
String sql = "select * from users where username = ?";
if(connection != null){
PreparedStatement ps = connection.prepareStatement(sql);
@ -168,26 +152,21 @@ public class userManager {
String passWord = rs.getString(3);
String phoneNum = rs.getString(4);
user = new User(userId, userName, passWord, phoneNum);//若已有用户,生成用户类并返回
user = new User(userId, userName, passWord, phoneNum);
}
}
}
} catch (SQLException throwables) {
throwables.printStackTrace();
} finally {
}
return user;
}
public boolean register(User user){//注册功能
public boolean register(User user){
HashMap<String, Object> map = new HashMap<>();
Connection connection = DBOpenHelper.getConn();
try{
Log.d(TAG, "register");
String sql = "insert into users(username, password, phonenum) values (?,?,?)";
if(connection != null){
@ -214,21 +193,16 @@ public class userManager {
e.printStackTrace();
Log.e(TAG, "异常 register");
return false;
} finally {
}
}
public int change(String phonenum, String password){//修改密码
public int change(String phonenum, String password){
HashMap<String, Object> map = new HashMap<>();
Connection connection = DBOpenHelper.getConn();
int msg = 0;
try{
Log.d(TAG, "change");
String sql = "update users set password = ? where phonenum = ?";
if(connection != null){
@ -256,8 +230,6 @@ public class userManager {
e.printStackTrace();
Log.d(TAG, "login bug: " + e.getMessage());
msg = 0;
} finally {
}
return msg;
}

@ -7,9 +7,9 @@ import java.sql.SQLException;
public class DBOpenHelper {
private static String diver = "com.mysql.jdbc.Driver";
//加入utf-8是为了后面往表中输入中文表中不会出现乱码的情况
private static String url = "jdbc:mysql://192.168.43.203:3306/logistics?characterEncoding=utf-8";
private static String url = "jdbc:mysql://192.168.43.139:3306/logistics?characterEncoding=utf-8";
private static String user = "root";//用户名
private static String password = "";//密码
private static String password = "123...iamfan";//密码
/*
*
* */
@ -22,8 +22,6 @@ public class DBOpenHelper {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
} finally {
}
return conn;
}

@ -32,8 +32,6 @@ public class MD5Utils {
e.printStackTrace();
//发送异常return空字符串
return "";
} finally {
}
}
}

@ -19,11 +19,8 @@ import androidx.fragment.app.Fragment;
import com.example.logistics.R;
import com.example.logistics.manager.goodManager;
//查询快件存放地
public class FindUI extends Fragment implements View.OnClickListener{
private String TAG = "FindUI";
public class FindUI extends Fragment implements View.OnClickListener{
private Context mContext;
private Button mButton;
private EditText mPickUpCode;
@ -36,17 +33,12 @@ public class FindUI extends Fragment implements View.OnClickListener{
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Log.d(TAG, "onCreateView");
View view = inflater.inflate(R.layout.frag_find,container,false);
View view = inflater.inflate(R.layout.my_fragment1,container,false);
mButton = (Button)view.findViewById(R.id.Sea_Button);
mPickUpCode = (EditText)view.findViewById(R.id.Sea_PickUpCode);
mPhoneNum = (EditText)view.findViewById(R.id.Sea_PhoneNum);
mButton.setOnClickListener(this);
mContext = getActivity();
return view;
}
@ -54,10 +46,7 @@ public class FindUI extends Fragment implements View.OnClickListener{
public void onClick(View v) {
switch(v.getId()){
case R.id.Sea_Button:
Log.d(TAG, "search");
search(v);
break;
}
}
@ -68,7 +57,7 @@ public class FindUI extends Fragment implements View.OnClickListener{
@Override
public void run(){
goodManager goodManager = new goodManager();
int msg = goodManager.search(mPickUpCode.getText().toString().trim(), mPhoneNum.getText().toString().trim(), getActivity());//查询快件位置并返回结果
int msg = goodManager.search(mPickUpCode.getText().toString().trim(), mPhoneNum.getText().toString().trim(), getActivity());
Log.e("Main", "msg");
hand1.sendEmptyMessage(msg);
}
@ -79,7 +68,6 @@ public class FindUI extends Fragment implements View.OnClickListener{
final Handler hand1 = new Handler(){
@Override
public void handleMessage(Message msg){
if(msg.what == 0){
Toast.makeText(mContext, "搜索失败", Toast.LENGTH_SHORT).show();
}else if(msg.what == 2){
@ -87,7 +75,6 @@ public class FindUI extends Fragment implements View.OnClickListener{
}else if(msg.what == 3){
Toast.makeText(mContext, "取件码不存在", Toast.LENGTH_SHORT).show();
}
}
};
}

@ -27,8 +27,7 @@ import java.util.Map;
public class HistoryUI extends Activity implements OnItemClickListener, OnScrollListener, View.OnClickListener {
private String TAG = "HistoryUI";
//绑定界面元素
private String TAG = "HistoryActivity";
private ListView lv_history;
private ArrayAdapter<String> arr_adapter;
private SimpleAdapter simp_adapter;
@ -38,9 +37,6 @@ public class HistoryUI extends Activity implements OnItemClickListener, OnScroll
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_history);
sync_his = (ImageButton) findViewById(R.id.sync_his);
@ -56,7 +52,6 @@ public class HistoryUI extends Activity implements OnItemClickListener, OnScroll
Intent intent = getIntent();
phonenum = intent.getStringExtra("user");
Log.d(TAG, "onCreate");
sync();
}
@ -71,12 +66,12 @@ public class HistoryUI extends Activity implements OnItemClickListener, OnScroll
public void onClick(View v){
switch(v.getId()){
case R.id.sync_his:
sync();//调用同步按钮同步记录
sync();
Toast.makeText(this, "同步成功", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState){//上下划动屏幕查看操作记录
public void onScrollStateChanged(AbsListView view, int scrollState){
// TODO Auto-generated method stub
switch(scrollState){
case SCROLL_STATE_FLING:
@ -99,14 +94,11 @@ public class HistoryUI extends Activity implements OnItemClickListener, OnScroll
}
public void sync(){
Log.d(TAG, "sync");
new Thread(){
@Override
public void run(){
operationManager operationManager = new operationManager();
dataList = operationManager.history(phonenum);//调用operationManager的查询历史记录
dataList = operationManager.history(phonenum);
int msg = 1;
hand1.sendEmptyMessage(msg);

@ -20,7 +20,7 @@ import android.widget.Toast;
public class LoginUI extends Activity {
private int islogin = 0;
private Button loginButton;
private Button signUpButton;
private Button forgetButton;
@ -29,29 +29,26 @@ public class LoginUI extends Activity {
private Button changeButton;
private EditText fphonenum;
private EditText fpassword;
private int islogin = 0;
int flag = 0; //flag = 0 是用户名登录;=1是手机号
// 调用Actvity
private String TAG = "LoginUI";
private String TAG = "LoginActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
setContentView(R.layout.activity_main);
loginButton = (Button) this.findViewById(R.id.LoginButton);
signUpButton = (Button) this.findViewById(R.id.SignUpButton);
forgetButton = (Button) this.findViewById(R.id.forget);
phonenumButton = (Button) this.findViewById(R.id.phonenum);
//设置对话框引用Activity对象
AlertDialog.Builder builder = new AlertDialog.Builder(LoginUI.this);
//使用别的layout
View view2 = View.inflate(LoginUI.this, R.layout.forget, null);
builder.setTitle("忘记密码").setView(view2);
builder.setTitle("取件").setView(view2);
alert = builder.create();
@ -103,7 +100,6 @@ public class LoginUI extends Activity {
new View.OnClickListener() {
@Override
public void onClick(View view) {
//输入提示
userName.setHint("请输入手机号");
flag = 1;
}
@ -113,22 +109,18 @@ public class LoginUI extends Activity {
}
public void change(View view){
//trim() 方法用于删除字符串的头尾空白符,空白符包括:空格、制表符 tab、换行符等其他空白符等。
String phoneunm = fphonenum.getText().toString().trim();
String password = fpassword.getText().toString().trim();
new Thread() {
@Override
public void run() {
//后端用来和数据库交互
userManager userManager = new userManager();
//msg=0代表操作成功
int msg = userManager.change(phoneunm, password);
Log.d(TAG, "change");
if(msg != 1){
Log.d(TAG, "pickup,failed");
//处理异步消息int类型的msg最终会转化为hander的msg类型
hand2.sendEmptyMessage(msg);
return;
}
@ -140,8 +132,6 @@ public class LoginUI extends Activity {
}
public void login(View view){
Log.d(TAG, "login");
EditText userName = (EditText) this.findViewById(R.id.UserNameEdit);
EditText passWord = (EditText) this.findViewById(R.id.PassWordEdit);
@ -158,12 +148,10 @@ public class LoginUI extends Activity {
}
Log.e("MAin", "msg");
hand1.sendEmptyMessage(msg);
//msg==1表示登录成功
if(msg == 1){
User owner = userManager.findUser(userName.getText().toString().trim());
Intent intent = new Intent(LoginUI.this, MenuActivity.class);
if(flag == 1){
//不同activity之间传递数据
intent.putExtra("user", userName.getText().toString().trim());
}else{
intent.putExtra("user", owner.getPhoneNum());

@ -1,4 +1,5 @@
package com.example.logistics.ui;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
@ -16,74 +17,68 @@ import androidx.fragment.app.FragmentManager;
import com.example.logistics.R;
public class MenuActivity extends AppCompatActivity implements View.OnClickListener{
private LinearLayout ly_one,ly_two,ly_three; //线性布局变量
private TextView mTextView1,mTextView2,mTextView3; //文本框变量
private TextView mTextNum1,mTextNum2,mTextNum3; //第二类文本框变量
private ImageView mImageView; //图像视图变量
//创建一系列成员变量:
private LinearLayout ly_one,ly_two,ly_three;
private TextView mTextView1,mTextView2,mTextView3;
private TextView mTextNum1,mTextNum2,mTextNum3;
private ImageView mImageView;
private Fragment mFrag1;
private Fragment mFrag2;
private Fragment mFrag3;
//创建Frag变量
private String owner; //唯一标识用户
private String owner;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);
super.onCreate(savedInstanceState); //调用父类的构造函数
setContentView(R.layout.activity_menu); //将类和布局文件绑定
bindView(); //调用bindView()
bindView();
Intent intent = getIntent();
owner = intent.getStringExtra("user");
selectTab(0);
} //类的构造函数
}
private void bindView() {
ly_one = (LinearLayout)findViewById(R.id.ly_tab_menu_deal);
ly_two = (LinearLayout)findViewById(R.id.ly_tab_menu_poi);
ly_three = (LinearLayout)findViewById(R.id.ly_tab_menu_more); //把三个布局绑定到布局变量上
ly_three = (LinearLayout)findViewById(R.id.ly_tab_menu_more);
mTextView1 = (TextView)findViewById(R.id.tab_menu_deal);
mTextView2 = (TextView)findViewById(R.id.tab_menu_poi);
mTextView3 = (TextView)findViewById(R.id.tab_menu_more); //把三个文本框绑定到变量上
mTextView3 = (TextView)findViewById(R.id.tab_menu_more);
mTextNum1 = (TextView)findViewById(R.id.tab_menu_deal_num);
mTextNum2 = (TextView)findViewById(R.id.tab_menu_poi_num);
mTextNum3 = (TextView)findViewById(R.id.tab_menu_more_num); //把三个第二类文本框绑定到变量上
mTextNum3 = (TextView)findViewById(R.id.tab_menu_more_num);
ly_one.setOnClickListener(this);
ly_two.setOnClickListener(this);
ly_three.setOnClickListener(this); //监听器:点击三个区域绑定三个功能
} //绑定变量和布局元素
ly_three.setOnClickListener(this);
}
//重置所有文本的选中状态
//重置所有文本的选中状态
private void setSelected() {
mTextView1.setSelected(false);
mTextView2.setSelected(false);
mTextView3.setSelected(false);
} //每次选中一按钮,先全设为未选中
}
@Override
public void onClick(View v) { //点击某区域实现某功能
setSelected(); //全部设为未选中
public void onClick(View v) {
setSelected();
switch (v.getId()) {
case R.id.ly_tab_menu_deal: //倘若点到这个id对应的
selectTab(0); //使第一个标签变蓝色
case R.id.ly_tab_menu_deal:
selectTab(0);
break;
case R.id.ly_tab_menu_poi:
selectTab(1);
break;
case R.id.ly_tab_menu_more:
selectTab(2);
break; //分析已点击区域对应的功能
break;
}
}

@ -52,31 +52,23 @@ public class PickUpUI extends Fragment implements View.OnClickListener{
private int shelfnum = 1;
private int floornum = 1;
//后端服务器
private String ws = "ws://192.168.43.203:8080/result";
private String TAG = "PickUpUI";
//flag = 0 代表mbutton为取件flag = 1 代表mbutton为确认
int flag = 0;
int flag = 0; //flag=0:chushi
public PickUpUI(){
}
//这个注解通常用于消除空指针异常
@Nullable
//用来指定方法重写的,只能修饰方法并且只能用于方法重写,不能修饰其它的元素。它可以强制一个子类必须重写父类方法或者实现接口的方法。
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.pickup,container,false);
View view = inflater.inflate(R.layout.my_fragment2,container,false);
mButton = (Button)view.findViewById(R.id.Pick_Button);
mButton.setOnClickListener(this);
//获得Fragment依附的Activity对象
mContext = getActivity();
Log.i("set", "listner");
@ -86,8 +78,6 @@ public class PickUpUI extends Fragment implements View.OnClickListener{
}
void setAlert(){
alert = new android.app.AlertDialog.Builder(mContext)
.setTitle("提醒")
@ -119,7 +109,7 @@ public class PickUpUI extends Fragment implements View.OnClickListener{
JSONObject js = new JSONObject();
try {
js.put("content", "no");
js.put("confirm", "no");
js.put("op", "confirm");
} catch (JSONException e) {
e.printStackTrace();
@ -132,7 +122,51 @@ public class PickUpUI extends Fragment implements View.OnClickListener{
Log.d(TAG, "setAlert");
}
void setWebsocket(){
URI uri = URI.create(ws);
client = new JWebSocketClient(uri){
@Override
public void onMessage(String message) {
Log.e("JWebSocketClientService", "收到的消息:" + message);
Log.e("alert",message);
if(message.equals("confirm")){
alert.dismiss();
hand2.sendEmptyMessage(3);
Log.e("alert","show");
}
}
@Override
public void onOpen(ServerHandshake handshakedata) {
super.onOpen(handshakedata);
Log.e("JWebSocketClientService", "websocket连接成功");
};
};
connect();
}
private void connect() {
new Thread() {
@Override
public void run() {
try {
//connectBlocking多出一个等待操作会先连接再发送否则未连接发送会报错
client.connectBlocking();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}.start();
}
@SuppressLint("HandlerLeak")
final Handler hand2 = new Handler(){
@Override
public void handleMessage(Message msg){
alert.show();
}
};
@Override
public void onClick(View view) {
@ -149,7 +183,21 @@ public class PickUpUI extends Fragment implements View.OnClickListener{
}
}
void confirm(){
JSONObject js = new JSONObject();
try {
js.put("op","finish");
client.send(js.toString());
flag = 0;
mButton.setText("取件");
client.onClose(1,"close",true);
Log.d("finish", "over");
} catch (JSONException jsonException) {
jsonException.printStackTrace();
}
}
public void pickup(){
@ -158,7 +206,6 @@ public class PickUpUI extends Fragment implements View.OnClickListener{
View view2 = View.inflate(mContext, R.layout.pickup, null);
PickUpCode = (EditText) view2.findViewById(R.id.pk_PickUp);
//尾号后四位
PhoneNum = (EditText) view2.findViewById(R.id.pk_PhoneNum);
Button button = (Button) view2.findViewById(R.id.pk_button);
@ -181,8 +228,6 @@ public class PickUpUI extends Fragment implements View.OnClickListener{
operationManager operationManager = new operationManager();
goodManager goodManager = new goodManager();
//获取menuactivity传来的值
Bundle bundle = getArguments();
String user = bundle.getString("user");
@ -213,81 +258,6 @@ public class PickUpUI extends Fragment implements View.OnClickListener{
});
}
void confirm(){
JSONObject js = new JSONObject();
try {
js.put("op","finish");
client.send(js.toString());
flag = 0;
mButton.setText("取件");
client.onClose(1,"close",true);
Log.d("finish", "over");
} catch (JSONException jsonException) {
jsonException.printStackTrace();
}
}
void setWebsocket(){
URI uri = URI.create(ws);
client = new JWebSocketClient(uri){
//onMessage()方法在接收到消息时调用
@Override
public void onMessage(String message) {
Log.e("JWebSocketClientService", "收到的消息:" + message);
Log.e("alert",message);
if(message.equals("confirm")){
alert.dismiss();
hand2.sendEmptyMessage(3);
Log.e("alert","show");
}
}
//onOpen()方法在websocket连接开启时调用
@Override
public void onOpen(ServerHandshake handshakedata) {
super.onOpen(handshakedata);
Log.e("JWebSocketClientService", "websocket连接成功");
}
};
connect();
}
private void connect() {
new Thread() {
@Override
public void run() {
try {
//connectBlocking多出一个等待操作会先连接再发送否则未连接发送会报错
client.connectBlocking();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}.start();
}
@SuppressLint("HandlerLeak")
final Handler hand2 = new Handler(){
@Override
public void handleMessage(Message msg){
alert.show();
}
};
@SuppressLint("HandlerLeak")
final Handler hand1 = new Handler() {
@Override
@ -315,7 +285,6 @@ public class PickUpUI extends Fragment implements View.OnClickListener{
Log.d(TAG, pickupcode);
Log.d(TAG, phonenum);
//将整型数据Integer转换为基本数据类型int
con.put("code", Integer.parseInt(pickupcode));
con.put("shelf", shelfnum);
con.put("floor", floornum);

@ -25,10 +25,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class SearchUI extends Activity implements OnItemClickListener, OnScrollListener, View.OnClickListener {//查询未取快件
public class SearchUI extends Activity implements OnItemClickListener, OnScrollListener, View.OnClickListener {
private String TAG = "SearchUI";
//绑定界面元素
private String TAG = "NoPickActivity";
private ListView lv_nopick;
private ArrayAdapter<String> arr_adapter;
private SimpleAdapter simp_adapter;
@ -38,11 +37,8 @@ public class SearchUI extends Activity implements OnItemClickListener, OnScrollL
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search);
setContentView(R.layout.activity_no_pick);
dataList=new ArrayList<Map<String,Object>>();
lv_nopick = (ListView) findViewById(R.id.lv_nopick);
@ -57,7 +53,7 @@ public class SearchUI extends Activity implements OnItemClickListener, OnScrollL
Intent intent = getIntent();
phonenum = intent.getStringExtra("user");
sync();//同步未取快件信息
sync();
}
@Override
@ -100,14 +96,11 @@ public class SearchUI extends Activity implements OnItemClickListener, OnScrollL
}
public void sync(){
Log.d(TAG, "sync");
new Thread(){
@Override
public void run(){
goodManager goodManager = new goodManager();
dataList = goodManager.nopick(phonenum);//掉用goodManager的查询未取件函数
dataList = goodManager.nopick(phonenum);
int msg = 1;
hand1.sendEmptyMessage(msg);

@ -5,7 +5,6 @@ import androidx.fragment.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -17,9 +16,6 @@ import androidx.annotation.Nullable;
import com.example.logistics.R;
public class SetUI extends Fragment implements View.OnClickListener{
private String TAG = "SetUI";
//绑定界面元素
private LinearLayout ll_waiting;
private LinearLayout ll_history;
private LinearLayout ll_exit;
@ -33,10 +29,7 @@ public class SetUI extends Fragment implements View.OnClickListener{
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Log.d(TAG, "onCreateView");
View view = inflater.inflate(R.layout.frag_set,container,false);
View view = inflater.inflate(R.layout.my_fragment3,container,false);
ll_waiting = (LinearLayout) view.findViewById(R.id.waiting);
ll_history = (LinearLayout) view.findViewById(R.id.history);
@ -58,22 +51,20 @@ public class SetUI extends Fragment implements View.OnClickListener{
public void onClick(View view) {
Intent intent;
switch(view.getId()){
case R.id.waiting://跳转到未取件界面
Log.d(TAG, "waiting");
case R.id.waiting:
intent = new Intent(mContext, SearchUI.class);
intent.putExtra("user", user);//将用户信息一并发过去
intent.putExtra("user", user);
startActivity(intent);
break;
case R.id.history://跳转到历史记录界面
Log.d(TAG, "history");
case R.id.history:
intent = new Intent(mContext, HistoryUI.class);
intent.putExtra("user", user);//将用户信息一并发过去
intent.putExtra("user", user);
startActivity(intent);
break;
case R.id.exit://跳转到退出登录界面
Log.d(TAG, "exit");
case R.id.exit:
Toast.makeText(mContext, "exit", Toast.LENGTH_SHORT).show();
intent = new Intent(mContext, LoginUI.class);//跳转到loginUI类
intent = new Intent(mContext, LoginUI.class);
startActivity(intent);
getActivity().finish();
break;

@ -15,8 +15,6 @@ import com.example.logistics.R;
import com.example.logistics.manager.userManager;
import com.example.logistics.entity.User;
//signup UI
//UI from android
public class SignUpUI extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -26,7 +24,6 @@ public class SignUpUI extends Activity {
Button signUpButton = (Button) this.findViewById(R.id.SignUpButton);
Button backLoginButton = (Button) this.findViewById(R.id.BackLoginButton);
//注册按钮
signUpButton.setOnClickListener(
new View.OnClickListener() {
@Override
@ -35,15 +32,13 @@ public class SignUpUI extends Activity {
}
}
);
//返回按钮
// 返回登录按钮监听器
backLoginButton.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
// 建立;跳转
// 跳转到登录界面
Intent intent = new Intent(SignUpUI.this, LoginUI.class);
//执行
startActivity(intent);
}
}
@ -51,21 +46,17 @@ public class SignUpUI extends Activity {
}
public void register(View view){
//获取
EditText userName = (EditText) this.findViewById(R.id.UserNameEdit);
EditText passWord = (EditText) this.findViewById(R.id.PassWordEdit);
EditText passWordAgain = (EditText) this.findViewById(R.id.PassWordAgainEdit);
EditText phone = (EditText) this.findViewById(R.id.PhoneEdit);
//编辑
String strUserName = userName.getText().toString().trim();
String strPassWord = passWord.getText().toString().trim();
String strPassWordAgain = passWordAgain.getText().toString().trim();
String strPhoneNumber = phone.getText().toString().trim();
//输入判断
if (strUserName.length() > 10) {
Toast.makeText(SignUpUI.this, "用户名长度必须小于10", Toast.LENGTH_SHORT).show();
} else if (strUserName.length() == 0) {
@ -84,7 +75,6 @@ public class SignUpUI extends Activity {
user.setPassWord(strPassWord);
user.setPhoneNum(strPhoneNumber);
//数据库查询得出msg
new Thread(){
@Override
public void run(){
@ -107,7 +97,6 @@ public class SignUpUI extends Activity {
}
}
//根据msg显示
@SuppressLint("HandlerLeak")
final Handler hand = new Handler(){
public void handleMessage(Message msg){
@ -117,7 +106,6 @@ public class SignUpUI extends Activity {
Toast.makeText(getApplicationContext(), "该账号已存在,请换一个注册", Toast.LENGTH_SHORT).show();
}else if(msg.what == 2){
Toast.makeText(getApplicationContext(), "注册成功", Toast.LENGTH_SHORT).show();
//于是自动跳转登录界面
Intent intent = new Intent(SignUpUI.this, LoginUI.class);
startActivity(intent);
}

@ -89,8 +89,6 @@ public class Example {
}
catch (InterruptedException ex) {
System.out.println("Process was interrupted.");
} finally {
}
/*
Service<Empty, Topics> topicService =
@ -125,16 +123,12 @@ public class Example {
Topic<Clock> clockTopic = new Topic<Clock>("/clock", Clock.class, client);
clockTopic.subscribe();
try {
Thread.sleep(20000);} catch(InterruptedException ex) {}finally {
}
Thread.sleep(20000);} catch(InterruptedException ex) {}
Clock cl = null;
try {
cl = clockTopic.take(); // just gets one
}
catch (InterruptedException ex) {}finally {
}
catch (InterruptedException ex) {}
cl.print();
cl.clock.nsecs++;
clockTopic.unsubscribe();

@ -136,8 +136,6 @@ public class Topic<T extends Message> extends LinkedBlockingQueue<T> implements
}
catch (InterruptedException ex) {
break;
} finally {
}
}
}

@ -53,8 +53,6 @@ public abstract class Message {
catch (MessageException ex) {
// should be changed to be a hooked method to give library user control
System.out.println(ex.getMessage());
}finally {
}
}
@ -167,9 +165,6 @@ public abstract class Message {
}
catch (IllegalAccessException ex) {
ex.printStackTrace();
}
finally {
}
return fo;
}
@ -195,9 +190,6 @@ public abstract class Message {
}
catch (ClassCastException ex) {
throw new RuntimeException("copyFrom error", ex);
}
finally {
}
// ReflectiveOperationException is not available on Android (Java 1.6)
/*

@ -1,145 +0,0 @@
/**
* Copyright (c) 2014 Jilk Systems, Inc.
*
* This file is part of the Java ROSBridge Client.
*
* The Java ROSBridge Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Java ROSBridge Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
*
*/
package com.jilk.ros.message.ros;
import com.jilk.ros.message.ros.message.Clock;
import com.jilk.ros.message.ros.message.Log;
import com.jilk.ros.message.ros.rosapi.message.Empty;
import com.jilk.ros.message.ros.rosapi.message.GetTime;
import com.jilk.ros.message.ros.rosapi.message.MessageDetails;
import com.jilk.ros.message.ros.rosapi.message.Type;
import com.jilk.ros.message.ros.rosbridge.ROSBridgeClient;
public class Example {
public Example() {}
public static void main(String[] args) {
ROSBridgeClient client = new ROSBridgeClient("ws://162.243.238.80:9090");
client.connect();
//testTopic(client);
try {
testService(client);
}
catch (RuntimeException ex) {
ex.printStackTrace();
}
finally {
client.disconnect();
}
}
public static void testService(ROSBridgeClient client) {
try {
Service<Empty, GetTime> timeService =
new Service<Empty, GetTime>("/rosapi/get_time", Empty.class, GetTime.class, client);
timeService.verify();
//System.out.println("Time (secs): " + timeService.callBlocking(new Empty()).time.sec);
Service<com.jilk.ros.message.ros.rosapi.message.Service, Type> serviceTypeService =
new Service<com.jilk.ros.message.ros.rosapi.message.Service, Type>("/rosapi/service_type",
com.jilk.ros.message.ros.rosapi.message.Service.class, Type.class, client);
serviceTypeService.verify();
String type = serviceTypeService.callBlocking(new com.jilk.ros.message.ros.rosapi.message.Service("/rosapi/service_response_details")).type;
Service<Type, MessageDetails> serviceDetails =
new Service<Type, MessageDetails>("/rosapi/service_response_details",
Type.class, MessageDetails.class, client);
serviceDetails.verify();
//serviceDetails.callBlocking(new Type(type)).print();
Topic<Log> logTopic =
new Topic<Log>("/rosout", Log.class, client);
logTopic.verify();
/*
System.out.println("Nodes");
for (String s : client.getNodes())
System.out.println(" " + s);
System.out.println("Topics");
for (String s : client.getTopics()) {
System.out.println(s + ":");
client.getTopicMessageDetails(s).print();
}
System.out.println("Services");
for (String s : client.getServices()) {
System.out.println(s + ":");
client.getServiceRequestDetails(s).print();
System.out.println("-----------------");
client.getServiceResponseDetails(s).print();
}
*/
}
catch (InterruptedException ex) {
System.out.println("Process was interrupted.");
} finally {
}
/*
Service<Empty, Topics> topicService =
new Service<Empty, Topics>("/rosapi/topics", Empty.class, Topics.class, client);
Service<Topic, Type> typeService =
new Service<Topic, Type>("/rosapi/topic_type", Topic.class, Type.class, client);
Service<Type, MessageDetails> messageService =
new Service<Type, MessageDetails>("/rosapi/message_details", Type.class, MessageDetails.class, client);
try {
Topics topics = topicService.callBlocking(new Empty());
for (String topicString : topics.topics) {
Topic topic = new Topic();
topic.topic = topicString;
Type type = typeService.callBlocking(topic);
MessageDetails details = messageService.callBlocking(type);
System.out.println("Topic: " + topic.topic + " Type: " + type.type);
details.print();
System.out.println();
}
Type type = new Type();
type.type = "time";
System.out.print("Single type check on \'time\': ");
messageService.callBlocking(type).print();
}
catch (InterruptedException ex) {
System.out.println("testService: process was interrupted.");
}
*/
}
public static void testTopic(ROSBridgeClient client) {
Topic<Clock> clockTopic = new Topic<Clock>("/clock", Clock.class, client);
clockTopic.subscribe();
try {
Thread.sleep(20000);} catch(InterruptedException ex) {}finally {
}
Clock cl = null;
try {
cl = clockTopic.take(); // just gets one
}
catch (InterruptedException ex) {}finally {
}
cl.print();
cl.clock.nsecs++;
clockTopic.unsubscribe();
clockTopic.advertise();
clockTopic.publish(cl);
clockTopic.unadvertise();
}
}

@ -1,26 +0,0 @@
/**
* Copyright (c) 2014 Jilk Systems, Inc.
*
* This file is part of the Java ROSBridge Client.
*
* The Java ROSBridge Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Java ROSBridge Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
*
*/
package com.jilk.ros.message.ros;
import com.jilk.ros.message.ros.message.Message;
public interface MessageHandler<T extends Message> {
public void onMessage(T message);
}

@ -1,68 +0,0 @@
/**
* Copyright (c) 2014 Jilk Systems, Inc.
*
* This file is part of the Java ROSBridge Client.
*
* The Java ROSBridge Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Java ROSBridge Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
*
*/
package com.jilk.ros.message.ros;
import com.jilk.ros.message.ros.message.Message;
import com.jilk.ros.message.ros.rosapi.message.TypeDef;
import com.jilk.ros.message.ros.rosbridge.FullMessageHandler;
import com.jilk.ros.message.ros.rosbridge.ROSBridgeClient;
import com.jilk.ros.message.ros.rosbridge.operation.Operation;
public abstract class ROSClient {
public ROSClient() {}
public static ROSClient create(String uriString) {
// if we ever implement other ROSClient types, we'll key off the URI protocol (e.g., ws://)
// we'd also have to abstract out Topic and Service since they depend on the ROSBridge operations
return new ROSBridgeClient(uriString);
}
public abstract boolean connect();
public abstract boolean connect(ConnectionStatusListener listener);
public abstract void disconnect();
public abstract void send(Operation operation);
public abstract void send(String json);
public abstract void register(Class<? extends Operation> c,
String s,
Class<? extends Message> m,
FullMessageHandler h);
public abstract void unregister(Class<? extends Operation> c, String s);
public abstract void setDebug(boolean debug);
public abstract String[] getNodes() throws InterruptedException;
public abstract String[] getTopics() throws InterruptedException;
public abstract String[] getServices() throws InterruptedException;
public abstract TypeDef getTopicMessageDetails(String topic) throws InterruptedException;
public abstract TypeDef[] getTopicMessageList(String topic) throws InterruptedException;
public abstract TypeDef getServiceRequestDetails(String service) throws InterruptedException;
public abstract TypeDef[] getServiceRequestList(String service) throws InterruptedException;
public abstract TypeDef getServiceResponseDetails(String service) throws InterruptedException;
public abstract TypeDef[] getServiceResponseList(String service) throws InterruptedException;
public abstract TypeDef getTypeDetails(String type) throws InterruptedException;
public abstract TypeDef[] getTypeList(String type) throws InterruptedException;
public abstract void typeMatch(TypeDef t, Class<? extends Message> c) throws InterruptedException;
public abstract Object getUnderlyingClient(); // for debugging
public interface ConnectionStatusListener {
public void onConnect();
public void onDisconnect(boolean normal, String reason, int code);
public void onError(Exception ex);
}
}

@ -1,134 +0,0 @@
/**
* Copyright (c) 2014 Jilk Systems, Inc.
*
* This file is part of the Java ROSBridge Client.
*
* The Java ROSBridge Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Java ROSBridge Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
*
*/
package com.jilk.ros.message.ros;
import com.jilk.ros.message.ros.message.Message;
import com.jilk.ros.message.ros.rosbridge.FullMessageHandler;
import com.jilk.ros.message.ros.rosbridge.operation.CallService;
import com.jilk.ros.message.ros.rosbridge.operation.ServiceResponse;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
public class Service<CallType extends Message, ResponseType extends Message> extends Message implements FullMessageHandler {
private String service;
private Class<? extends ResponseType> responseType;
private Class<? extends CallType> callType;
private ROSClient client;
private Map<String, CallRecord> calls;
public Service(String service, Class<? extends CallType> callType,
Class<? extends ResponseType> responseType, ROSClient client) {
this.service = service;
this.client = client;
this.responseType = responseType;
this.callType = callType;
calls = new HashMap<String, CallRecord>();
}
// A result can only be returned once; it is cleared from the hash before
// being sent/returned. This is to ensure that results do not accumulate
// indefinitely. If callers need to keep these around they can set up their
// own hash.
@Override
public void onMessage(String id, Message response) {
//System.out.print("Service.onMessage: ");
//response.print();
CallRecord call = calls.get(id);
if(call == null) {
System.out.print("No caller service response");
return;
}
if (call.handler != null) {
calls.remove(id);
call.handler.onMessage((ResponseType) response);
}
else {
call.result = (ResponseType) response;
call.latch.countDown();
}
}
public String call(CallType args) {
return callImpl(args, null);
}
public void callWithHandler(CallType args, MessageHandler<ResponseType> responseHandler) {
callImpl(args, responseHandler);
}
public ResponseType callBlocking(CallType args) throws InterruptedException {
return take(call(args));
}
private String callImpl(CallType args, MessageHandler<ResponseType> responseHandler) {
client.register(ServiceResponse.class, service, responseType, this); // do this once on creation?
CallService messageCallService = new CallService(service, args);
String id = messageCallService.id;
CallRecord callRecord = new CallRecord(responseHandler);
calls.put(id, callRecord);
client.send(messageCallService);
return id;
}
public ResponseType poll(String id) {
CallRecord call = calls.get(id);
if (call.result != null)
calls.remove(id);
return call.result;
}
public ResponseType take(String id) throws InterruptedException {
CallRecord call = calls.get(id);
call.latch.await();
calls.remove(id);
return call.result;
}
public void verify() throws InterruptedException {
boolean hasService = false;
for (String s : client.getServices()) {
if (s.equals(service)) {
hasService = true;
break;
}
}
if (!hasService)
throw new RuntimeException("Service \'" + service + "\' not available.");
client.typeMatch(client.getServiceRequestDetails(service), callType);
client.typeMatch(client.getServiceResponseDetails(service), responseType);
}
private class CallRecord {
public ResponseType result;
public CountDownLatch latch;
public MessageHandler<ResponseType> handler;
public CallRecord(MessageHandler<ResponseType> handler) {
this.result = null;
this.latch = new CountDownLatch(1);
this.handler = handler;
}
}
}

@ -1,146 +0,0 @@
/**
* Copyright (c) 2014 Jilk Systems, Inc.
*
* This file is part of the Java ROSBridge Client.
*
* The Java ROSBridge Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Java ROSBridge Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
*
*/
package com.jilk.ros.message.ros;
import com.jilk.ros.message.ros.message.Message;
import com.jilk.ros.message.ros.rosbridge.FullMessageHandler;
import com.jilk.ros.message.ros.rosbridge.operation.Advertise;
import com.jilk.ros.message.ros.rosbridge.operation.Operation;
import com.jilk.ros.message.ros.rosbridge.operation.Publish;
import com.jilk.ros.message.ros.rosbridge.operation.Subscribe;
import com.jilk.ros.message.ros.rosbridge.operation.Unadvertise;
import com.jilk.ros.message.ros.rosbridge.operation.Unsubscribe;
import java.util.concurrent.LinkedBlockingQueue;
public class Topic<T extends Message> extends LinkedBlockingQueue<T> implements FullMessageHandler {
protected String topic;
private Class<? extends T> type;
private String messageType;
private ROSClient client;
private Thread handlerThread;
public Topic(String topic, Class<? extends T> type, ROSClient client) {
this.topic = topic;
this.client = client;
this.type = type;
messageType = Message.getMessageType(type);
handlerThread = null;
}
@Override
public void onMessage(String id, Message message) {
add((T) message);
}
// warning: there is a delay between the completion of this method and
// the completion of the subscription; it takes longer than
// publishing multiple other messages, for example.
public void subscribe(MessageHandler<T> handler) {
startRunner(handler);
subscribe();
}
public void subscribe() {
client.register(Publish.class, topic, type, this);
send(new Subscribe(topic, messageType));
}
public void unsubscribe() {
// need to handle race conditions in incoming message handler
// so that once unsubscribe has happened the handler gets no more
// messages
send(new Unsubscribe(topic));
client.unregister(Publish.class, topic);
stopRunner();
}
private void startRunner(MessageHandler<T> handler) {
stopRunner();
handlerThread = new Thread(new MessageRunner(handler));
handlerThread.setName("Message handler for " + topic);
handlerThread.start();
}
private void stopRunner() {
if (handlerThread != null) {
handlerThread.interrupt();
clear();
handlerThread = null;
}
}
public void advertise() {
send(new Advertise(topic, messageType));
}
public void publish(T message) {
send(new Publish(topic, message));
}
public void unadvertise() {
send(new Unadvertise(topic));
}
private void send(Operation operation) {
client.send(operation);
}
public void verify() throws InterruptedException {
boolean hasTopic = false;
for (String s : client.getTopics()) {
if (s.equals(topic)) {
hasTopic = true;
break;
}
}
if (!hasTopic)
throw new RuntimeException("Topic \'" + topic + "\' not available.");
client.typeMatch(client.getTopicMessageDetails(topic), type);
}
private class MessageRunner implements Runnable {
private MessageHandler<T> handler;
public MessageRunner(MessageHandler<T> handler) {
this.handler = handler;
}
@Override
public void run() {
while (!Thread.interrupted()) {
try {
handler.onMessage(take());
}
catch (InterruptedException ex) {
break;
} finally {
}
}
}
}
}

@ -1,9 +0,0 @@
package com.jilk.ros.message.ros.message;
/**
* Created by xxhong on 16-11-17.
*/
@MessageType(string = "std_msgs/Int16MultiArray")
public class AudioMsg extends Message {
public short[] data;
}

@ -1,25 +0,0 @@
/**
* Copyright (c) 2014 Jilk Systems, Inc.
*
* This file is part of the Java ROSBridge Client.
*
* The Java ROSBridge Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Java ROSBridge Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
*
*/
package com.jilk.ros.message.ros.message;
@MessageType(string = "rosgraph_msgs/Clock")
public class Clock extends Message {
public TimePrimitive clock;
}

@ -1,24 +0,0 @@
/**
* Copyright (c) 2014 Jilk Systems, Inc.
*
* This file is part of the Java ROSBridge Client.
*
* The Java ROSBridge Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Java ROSBridge Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
*
*/
package com.jilk.ros.message.ros.message;
@MessageType(string = "std_msgs/Duration")
public class Duration extends DurationPrimitive {
}

@ -1,25 +0,0 @@
/**
* Copyright (c) 2014 Jilk Systems, Inc.
*
* This file is part of the Java ROSBridge Client.
*
* The Java ROSBridge Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Java ROSBridge Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
*
*/
package com.jilk.ros.message.ros.message;
@MessageType(string = "duration")
public class DurationPrimitive extends TimePrimitive {
}

@ -1,24 +0,0 @@
/**
* Copyright (c) 2014 Jilk Systems, Inc.
*
* This file is part of the Java ROSBridge Client.
*
* The Java ROSBridge Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Java ROSBridge Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
*
*/
package com.jilk.ros.message.ros.message;
@MessageType(string = "std_srvs/Empty")
public class Empty extends Message {
}

@ -1,27 +0,0 @@
/**
* Copyright (c) 2014 Jilk Systems, Inc.
*
* This file is part of the Java ROSBridge Client.
*
* The Java ROSBridge Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Java ROSBridge Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
*
*/
package com.jilk.ros.message.ros.message;
@MessageType(string = "std_msgs/Header")
public class Header extends Message {
public long seq;
public TimePrimitive stamp;
public String frame_id;
}

@ -1,32 +0,0 @@
/**
* Copyright (c) 2014 Jilk Systems, Inc.
*
* This file is part of the Java ROSBridge Client.
*
* The Java ROSBridge Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Java ROSBridge Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
*
*/
package com.jilk.ros.message.ros.message;
@MessageType(string = "rosgraph_msgs/Log")
public class Log extends Message {
public Header header;
public byte level;
public String name;
public String msg;
public String file;
public String function;
public long line;
public String[] topics;
}

@ -1,210 +0,0 @@
/**
* Copyright (c) 2014 Jilk Systems, Inc.
*
* This file is part of the Java ROSBridge Client.
*
* The Java ROSBridge Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Java ROSBridge Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
*
*/
package com.jilk.ros.message.ros.message;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.util.Map;
@MessageType(string = "message")
public abstract class Message {
// Some requirements about message types:
// - It must have a MessageType declaration to be recognized on inbound messages
// - Every field must be explicitly designated as public
// - Every field that is not a primitive or near-primitive must be another Message class
// - If there is a non-empty constructor, you must also have an empty constructor
// - If it is set up as an inner class, it needs an explicit nullary constructor
// (note: I have seen an inner class otherwise fail, I have not tested it with the explicit constructor)
public static void register(Class c, Map<String, Class> messageClasses) {
try {
typecheck(c);
// Must register the class and not have duplicate
// This is not recursive because only the top level message class
// needs to be determined from the string - others are top-down.
String messageString = getMessageType(c);
Class existingClass = messageClasses.get(messageString);
if (existingClass != null && !existingClass.equals(c))
throw new MessageException("Message String \'" + messageString +
"\' is assigned to two different classes (" +
c.getName() + " and " + existingClass.getName() + ")");
messageClasses.put(messageString, c);
}
catch (MessageException ex) {
// should be changed to be a hooked method to give library user control
System.out.println(ex.getMessage());
}finally {
}
}
public static String getMessageType(Class c) {
return ((MessageType) c.getAnnotation(MessageType.class)).string();
}
// this has never been used or tested but kind of belongs here
// commented out because it uses ReflectiveOperationException which is not available on Android
/*
public static Message newInstance(String className) {
try {
Class messageClass = Class.forName(className);
if (Message.class.isAssignableFrom(messageClass))
return (Message) messageClass.newInstance();
else throw new ClassCastException();
}
catch (ReflectiveOperationException ex) {
throw new RuntimeException("Unable to create message of class \'" + className + "\'.", ex);
}
}
*/
// Could probably do more checking here, but not sure what right now
private static void typecheck(Class c) throws MessageException {
// Must inherit from Message
if (!Message.class.isAssignableFrom(c))
throw new MessageException("Class \'" + c.getName() +
"\' does not extend Message");
// Must have the MessageType annotation
if (getMessageType(c) == null)
throw new MessageException("Class \'" + c.getName() +
"\' is missing the MessageType annotation");
// All fields must also be valid Message classes
// Note that this also serves to force-load all the message classes
// so that they get registered
for (Field f : c.getFields()) {
Class fc = f.getType();
if (fc.isArray()) {
Class ac = fc.getComponentType();
if (!isPrimitive(ac))
typecheck(ac);
}
else if (!isPrimitive(fc))
typecheck(fc);
}
}
public void print() {
printMessage(this, "");
}
private static void printMessage(Object o, String indent) {
for (Field f : o.getClass().getFields()) {
Class c = f.getType();
Object fieldObject = getFieldObject(f, o);
if (fieldObject != null) {
if (isPrimitive(c))
System.out.println(indent + f.getName() + ": " + fieldObject);
else if (c.isArray()) {
System.out.println(indent + f.getName() + ": [");
printArray(fieldObject, indent + " ");
System.out.println(indent + "]");
}
else {
System.out.println(indent + f.getName() + ":");
printMessage(fieldObject, indent + " ");
}
}
}
}
private static void printArray(Object array, String indent) {
Class arrayClass = array.getClass().getComponentType();
for (int i = 0; i < Array.getLength(array); i++) {
Object elementObject = Array.get(array, i);
if (elementObject != null) {
if (isPrimitive(arrayClass))
System.out.println(indent + i + ": " + elementObject);
else if (arrayClass.isArray()) { // this is not actually allowed in ROS
System.out.println(indent + i + ": [");
printArray(elementObject, indent + " ");
System.out.println(indent + "]");
}
else {
System.out.println(indent + i + ":");
printMessage(elementObject, indent + " ");
}
}
}
// remember to print array indices
}
public static boolean isPrimitive(Class c) {
return (c.isPrimitive() ||
c.equals(String.class) ||
Number.class.isAssignableFrom(c) ||
c.equals(Boolean.class));
}
// Copied from com.jilk.ros.rosbridge.JSON
private static Object getFieldObject(Field f, Object o) {
Object fo = null;
try {
fo = f.get(o);
}
catch (IllegalAccessException ex) {
ex.printStackTrace();
}
finally {
}
return fo;
}
public void copyFrom(Message source) {
try {
if (source.getClass() != getClass())
throw new RuntimeException("Attempt to copy non-matching classes");
for (Field f : getClass().getFields()) {
Class fc = f.getType();
if (fc.isArray())
throw new RuntimeException("copyFrom - array types not implemented");
else if (!isPrimitive(fc))
((Message) f.get(this)).copyFrom((Message) f.get(source));
else {
Object value = f.get(source);
f.set(this, value);
}
}
}
catch (IllegalAccessException ex) {
throw new RuntimeException("copyFrom error", ex);
}
catch (ClassCastException ex) {
throw new RuntimeException("copyFrom error", ex);
}
finally {
}
// ReflectiveOperationException is not available on Android (Java 1.6)
/*
catch (ReflectiveOperationException ex) {
throw new RuntimeException ("copyFrom error", ex);
}
*/
}
}

@ -1,32 +0,0 @@
/**
* Copyright (c) 2014 Jilk Systems, Inc.
*
* This file is part of the Java ROSBridge Client.
*
* The Java ROSBridge Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Java ROSBridge Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
*
*/
package com.jilk.ros.message.ros.message;
public class MessageException extends Exception {
public MessageException(String message) {
super(message);
}
public MessageException(String message, Throwable cause) {
super(message, cause);
}
}

@ -1,32 +0,0 @@
/**
* Copyright (c) 2014 Jilk Systems, Inc.
*
* This file is part of the Java ROSBridge Client.
*
* The Java ROSBridge Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Java ROSBridge Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
*
*/
package com.jilk.ros.message.ros.message;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface MessageType {
String string() default "";
}

@ -1,13 +0,0 @@
package com.jilk.ros.message.ros.message;
/**
* Created by xxhong on 16-11-17.
*/
@MessageType(string = "std_msgs/String")
public class SemanticRequest extends Message {
public SemanticRequest(String args) {
jsonStr = args;
}
public String jsonStr;
}

@ -1,9 +0,0 @@
package com.jilk.ros.message.ros.message;
/**
* Created by xxhong on 16-11-17.
*/
@MessageType(string = "std_msgs/String")
public class SemanticResponse extends Message {
public String result;
}

@ -1,9 +0,0 @@
package com.jilk.ros.message.ros.message;
/**
* Created by xxhong on 16-11-17.
*/
@MessageType(string = "std_msgs/String")
public class StdMsg extends Message {
public String data;
}

@ -1,24 +0,0 @@
/**
* Copyright (c) 2014 Jilk Systems, Inc.
*
* This file is part of the Java ROSBridge Client.
*
* The Java ROSBridge Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Java ROSBridge Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
*
*/
package com.jilk.ros.message.ros.message;
@MessageType(string = "std_msgs/Time")
public class Time extends TimePrimitive {
}

@ -1,26 +0,0 @@
/**
* Copyright (c) 2014 Jilk Systems, Inc.
*
* This file is part of the Java ROSBridge Client.
*
* The Java ROSBridge Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Java ROSBridge Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
*
*/
package com.jilk.ros.message.ros.message;
@MessageType(string = "time")
public class TimePrimitive extends Message {
public int secs; // when requesting this format from ROSbridge, it uses 'sec' (no 's')
public int nsecs; // when requesting this format from ROSbridge, it uses 'nsec'
}

@ -1,178 +0,0 @@
package com.jilk.ros.message.ros.model;
import java.util.List;
/**
* Created by super_yu on 2018/1/8.
*/
public class FootPrintResult {
/**
* header : {"seq":4297,"frame_id":"odom","stamp":{"secs":1515378187,"nsecs":125325857}}
* polygon : {"points":[{"z":0,"x":0.31369608640670776,"y":-0.5355392694473267},{"z":0,"x":0.35115259885787964,"y":-0.016890067607164383},{"z":0,"x":-0.30713292956352234,"y":0.03065088950097561},{"z":0,"x":-0.3445894420146942,"y":-0.4879983365535736}]}
*/
private HeaderBean header;
private PolygonBean polygon;
public HeaderBean getHeader() {
return header;
}
public void setHeader(HeaderBean header) {
this.header = header;
}
public PolygonBean getPolygon() {
return polygon;
}
public void setPolygon(PolygonBean polygon) {
this.polygon = polygon;
}
public static class HeaderBean {
/**
* seq : 4297
* frame_id : odom
* stamp : {"secs":1515378187,"nsecs":125325857}
*/
private int seq;
private String frame_id;
private StampBean stamp;
public int getSeq() {
return seq;
}
public void setSeq(int seq) {
this.seq = seq;
}
public String getFrame_id() {
return frame_id;
}
public void setFrame_id(String frame_id) {
this.frame_id = frame_id;
}
public StampBean getStamp() {
return stamp;
}
public void setStamp(StampBean stamp) {
this.stamp = stamp;
}
public static class StampBean {
/**
* secs : 1515378187
* nsecs : 125325857
*/
private int secs;
private int nsecs;
public int getSecs() {
return secs;
}
public void setSecs(int secs) {
this.secs = secs;
}
public int getNsecs() {
return nsecs;
}
public void setNsecs(int nsecs) {
this.nsecs = nsecs;
}
}
}
public static class PolygonBean {
private List<PointsBean> points;
public List<PointsBean> getPoints() {
return points;
}
public void setPoints(List<PointsBean> points) {
this.points = points;
}
public static class PointsBean {
/**
* z : 0
* x : 0.31369608640670776
* y : -0.5355392694473267
*/
private int z;
private double x;
private double y;
public int getZ() {
return z;
}
public void setZ(int z) {
this.z = z;
}
public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public double getY() {
return y;
}
public void setY(double y) {
this.y = y;
}
}
}
// {
// "header": {
// "seq": 4297,
// "frame_id": "odom",
// "stamp": {
// "secs": 1515378187,
// "nsecs": 125325857
// }
// },
// "polygon": {
// "points": [
// {
// "z": 0,
// "x": 0.31369608640670776,
// "y": -0.5355392694473267
// },
// {
// "z": 0,
// "x": 0.35115259885787964,
// "y": -0.016890067607164383
// },
// {
// "z": 0,
// "x": -0.30713292956352234,
// "y": 0.03065088950097561
// },
// {
// "z": 0,
// "x": -0.3445894420146942,
// "y": -0.4879983365535736
// }
// ]
// }
// }
}

@ -1,274 +0,0 @@
package com.jilk.ros.message.ros.model;
import java.util.ArrayList;
import java.util.List;
/**
* Created by super_yu on 2018/2/5.
*/
public class InitPoseResult {
/**
* op : publish
* topic : /initialpose
* msg : {"header":{"frame_id":"map"},"pose":{"pose":{"position":{"x":0,"y":0,"z":0},"orientation":{"x":0,"y":0,"z":0,"w":1}},"covariance":[0.25,0,0,0,0,0,0,0.25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.06853891945200942]}}
*/
private String op = "publish";
private String topic = "/initialpose";
private MsgBean msg;
public MsgBean getMsg() {
return msg;
}
public void setMsg(MsgBean msg) {
this.msg = msg;
}
public static class MsgBean {
/**
* header : {"frame_id":"map"}
* pose : {"pose":{"position":{"x":0,"y":0,"z":0},"orientation":{"x":0,"y":0,"z":0,"w":1}},"covariance":[0.25,0,0,0,0,0,0,0.25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.06853891945200942]}
*/
private HeaderBean header;
private PoseBeanX pose;
public HeaderBean getHeader() {
return header;
}
public void setHeader(HeaderBean header) {
this.header = header;
}
public PoseBeanX getPose() {
return pose;
}
public void setPose(PoseBeanX pose) {
this.pose = pose;
}
public static class HeaderBean {
/**
* frame_id : map
*/
private String frame_id = "map";
}
public static class PoseBeanX {
/**
* pose : {"position":{"x":0,"y":0,"z":0},"orientation":{"x":0,"y":0,"z":0,"w":1}}
* covariance :
* 0.25,0,0,0,0,0,0,0.25,
* 0,0,0,0,0,0,0,0,0,0,0,
* 0,0,0,0,0,0,0,0,0,0,0,
* 0,0,0,0,0,0.06853891945200942
*/
private PoseBean pose;
private List<Double> covariance;
public PoseBean getPose() {
return pose;
}
public void setPose(PoseBean pose) {
this.pose = pose;
}
public void setCovariance() {
covariance = new ArrayList<Double>();
for (int i = 0; i < 36; i++) {
if (i == 0) {
covariance.add(0.25);
} else if (i == 7) {
covariance.add(0.25);
} else if (i == 35) {
covariance.add(0.06853891945200942);
} else {
covariance.add((double) 0);
}
}
}
public static class PoseBean {
/**
* position : {"x":0,"y":0,"z":0}
* orientation : {"x":0,"y":0,"z":0,"w":1}
*/
private PositionBean position;
private OrientationBean orientation;
public PositionBean getPosition() {
return position;
}
public void setPosition(PositionBean position) {
this.position = position;
}
public OrientationBean getOrientation() {
return orientation;
}
public void setOrientation(OrientationBean orientation) {
this.orientation = orientation;
}
public static class PositionBean {
/**
* x : 0
* y : 0
* z : 0
*/
private double x;
private double y;
private double z;
public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public double getY() {
return y;
}
public void setY(double y) {
this.y = y;
}
public double getZ() {
return z;
}
public void setZ(double z) {
this.z = z;
}
}
public static class OrientationBean {
/**
* x : 0
* y : 0
* z : 0
* w : 1
*/
private double x;
private double y;
private double z;
private double w;
public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public double getY() {
return y;
}
public void setY(double y) {
this.y = y;
}
public double getZ() {
return z;
}
public void setZ(double z) {
this.z = z;
}
public double getW() {
return w;
}
public void setW(double w) {
this.w = w;
}
}
}
}
}
// {
// "op": "publish",
// "topic": "/initialpose",
// "msg": {
// "header": {
// "frame_id": "map"
// },
// "pose": {
// "pose": {
// "position": {
// "x": 0,
// "y": 0,
// "z": 0
// },
// "orientation": {
// "x": 0,
// "y": 0,
// "z": 0,
// "w": 1
// }
// },
// "covariance": [
// 0.25,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0.25,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0.06853891945200942
// ]
// }
// }
// }
}

@ -1,501 +0,0 @@
package com.jilk.ros.message.ros.model;
/**
* Created by super_yu on 2018/1/5.
*/
import java.util.List;
/**
*
* orientation zw
* position xy
* twist x
* angular z
* Created by super_yu on 2017/9/29.
*/
public class PoiResult {
/**
* twist : {"twist":{"angular":{"z":0,"y":0,"x":0},"linear":{"z":0,"y":0,"x":0}},"covariance":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}
* child_frame_id : base_footprint
* pose : {"covariance":[0.1,0,0,0,0,0,0,0.1,0,0,0,0,0,0,1.7976931348623157E308,0,0,0,0,0,0,1.7976931348623157E308,0,0,0,0,0,0,1.7976931348623157E308,0,0,0,0,0,0,0.2],"pose":{"position":{"z":0,"y":-0.16137039724419636,"x":0.001470031525333453},"orientation":{"w":-0.08271030624895466,"z":-0.9965736326234024,"y":"-0","x":0}}}
* header : {"seq":69712,"stamp":{"secs":1506650141,"nsecs":455670567},"frame_id":"odom"}
*/
private TwistBeanX twist;
private String child_frame_id;
private PoseBeanX pose;
private HeaderBean header;
public TwistBeanX getTwist() {
return twist;
}
public void setTwist(TwistBeanX twist) {
this.twist = twist;
}
public String getChild_frame_id() {
return child_frame_id;
}
public void setChild_frame_id(String child_frame_id) {
this.child_frame_id = child_frame_id;
}
public PoseBeanX getPose() {
return pose;
}
public void setPose(PoseBeanX pose) {
this.pose = pose;
}
public HeaderBean getHeader() {
return header;
}
public void setHeader(HeaderBean header) {
this.header = header;
}
public static class TwistBeanX {
/**
* twist : {"angular":{"z":0,"y":0,"x":0},"linear":{"z":0,"y":0,"x":0}}
* covariance : [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
*/
private TwistBean twist;
private List<Integer> covariance;
public TwistBean getTwist() {
return twist;
}
public void setTwist(TwistBean twist) {
this.twist = twist;
}
public List<Integer> getCovariance() {
return covariance;
}
public void setCovariance(List<Integer> covariance) {
this.covariance = covariance;
}
public static class TwistBean {
/**
* angular : {"z":0,"y":0,"x":0}
* linear : {"z":0,"y":0,"x":0}
*/
private AngularBean angular;
private LinearBean linear;
public AngularBean getAngular() {
return angular;
}
public void setAngular(AngularBean angular) {
this.angular = angular;
}
public LinearBean getLinear() {
return linear;
}
public void setLinear(LinearBean linear) {
this.linear = linear;
}
public static class AngularBean {
/**
* z : 0
* y : 0
* x : 0
*/
private int z;
private int y;
private int x;
public int getZ() {
return z;
}
public void setZ(int z) {
this.z = z;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
}
public static class LinearBean {
/**
* z : 0
* y : 0
* x : 0
*/
private int z;
private int y;
private int x;
public int getZ() {
return z;
}
public void setZ(int z) {
this.z = z;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
}
}
}
public static class PoseBeanX {
/**
* covariance : [0.1,0,0,0,0,0,0,0.1,0,0,0,0,0,0,1.7976931348623157E308,0,0,0,0,0,0,1.7976931348623157E308,0,0,0,0,0,0,1.7976931348623157E308,0,0,0,0,0,0,0.2]
* pose : {"position":{"z":0,"y":-0.16137039724419636,"x":0.001470031525333453},"orientation":{"w":-0.08271030624895466,"z":-0.9965736326234024,"y":"-0","x":0}}
*/
private PoseBean pose;
private List<Double> covariance;
public PoseBean getPose() {
return pose;
}
public void setPose(PoseBean pose) {
this.pose = pose;
}
public List<Double> getCovariance() {
return covariance;
}
public void setCovariance(List<Double> covariance) {
this.covariance = covariance;
}
public static class PoseBean {
/**
* position : {"z":0,"y":-0.16137039724419636,"x":0.001470031525333453}
* orientation : {"w":-0.08271030624895466,"z":-0.9965736326234024,"y":"-0","x":0}
*/
private PositionBean position;
private OrientationBean orientation;
public PositionBean getPosition() {
return position;
}
public void setPosition(PositionBean position) {
this.position = position;
}
public OrientationBean getOrientation() {
return orientation;
}
public void setOrientation(OrientationBean orientation) {
this.orientation = orientation;
}
public static class PositionBean {
/**
* z : 0
* y : -0.16137039724419636
* x : 0.001470031525333453
*/
private int z;
private double y;
private double x;
public int getZ() {
return z;
}
public void setZ(int z) {
this.z = z;
}
public double getY() {
return y;
}
public void setY(double y) {
this.y = y;
}
public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
}
public static class OrientationBean {
/**
* w : -0.08271030624895466
* z : -0.9965736326234024
* y : -0
* x : 0
*/
private double w;
private double z;
private String y;
private int x;
public double getW() {
return w;
}
public void setW(double w) {
this.w = w;
}
public double getZ() {
return z;
}
public void setZ(double z) {
this.z = z;
}
public String getY() {
return y;
}
public void setY(String y) {
this.y = y;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
}
}
}
public static class HeaderBean {
/**
* seq : 69712
* stamp : {"secs":1506650141,"nsecs":455670567}
* frame_id : odom
*/
private int seq;
private StampBean stamp;
private String frame_id;
public int getSeq() {
return seq;
}
public void setSeq(int seq) {
this.seq = seq;
}
public StampBean getStamp() {
return stamp;
}
public void setStamp(StampBean stamp) {
this.stamp = stamp;
}
public String getFrame_id() {
return frame_id;
}
public void setFrame_id(String frame_id) {
this.frame_id = frame_id;
}
public static class StampBean {
/**
* secs : 1506650141
* nsecs : 455670567
*/
private int secs;
private int nsecs;
public int getSecs() {
return secs;
}
public void setSecs(int secs) {
this.secs = secs;
}
public int getNsecs() {
return nsecs;
}
public void setNsecs(int nsecs) {
this.nsecs = nsecs;
}
}
}
//
// {
// "twist": {
// "twist": {
// "angular": {
// "z": 0,
// "y": 0,
// "x": 0
// },
// "linear": {
// "z": 0,
// "y": 0,
// "x": 0
// }
// },
// "covariance": [
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0
// ]
// },
// "child_frame_id": "base_footprint",
// "pose": {
// "covariance": [
// 0.1,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0.1,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 1.7976931348623157E308,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 1.7976931348623157E308,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 1.7976931348623157E308,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0.2
// ],
// "pose": {
// "position": {
// "z": 0,
// "y": -0.16137039724419636,
// "x": 0.001470031525333453
// },
// "orientation": {
// "w": -0.08271030624895466,
// "z": -0.9965736326234024,
// "y": -0,
// "x": 0
// }
// }
// },
// "header": {
// "seq": 69712,
// "stamp": {
// "secs": 1506650141,
// "nsecs": 455670567
// },
// "frame_id": "odom"
// }
// }
}

@ -1,246 +0,0 @@
package com.jilk.ros.message.ros.nav;
/**
* Created by super_yu on 27/10/2017.
*/
public class Move_Base_Goal {
/**
* msg : {"target_pose":{"header":{"frame_id":"/map"},"pose":{"w":0.72508,"x":0.00455891,"y":0.0110448,"z":-0.688561}},"base_position":{"header":{"frame_id":"/map"},"pose":{"x":-5.56034,"y":0.543951,"z":2.96803E-4}}}
* op : publish
* topic : /move_base/goal
*/
private MsgBean msg;
private String op = "publish";
private String topic = "/move_base/goal";
public MsgBean getMsg() {
return msg;
}
public void setMsg(MsgBean msg) {
this.msg = msg;
}
public String getOp() {
return op;
}
public String getTopic() {
return topic;
}
public static class MsgBean {
/**
* target_pose : {"header":{"frame_id":"/map"},"pose":{"w":0.72508,"x":0.00455891,"y":0.0110448,"z":-0.688561}}
* base_position : {"header":{"frame_id":"/map"},"pose":{"x":-5.56034,"y":0.543951,"z":2.96803E-4}}
*/
private TargetPoseBean target_pose;
private BasePositionBean base_position;
public TargetPoseBean getTarget_pose() {
return target_pose;
}
public void setTarget_pose(TargetPoseBean target_pose) {
this.target_pose = target_pose;
}
public BasePositionBean getBase_position() {
return base_position;
}
public void setBase_position(BasePositionBean base_position) {
this.base_position = base_position;
}
public static class TargetPoseBean {
/**
* header : {"frame_id":"/map"}
* pose : {"w":0.72508,"x":0.00455891,"y":0.0110448,"z":-0.688561}
*/
private HeaderBean header;
private PoseBean pose;
public HeaderBean getHeader() {
return header;
}
public void setHeader(HeaderBean header) {
this.header = header;
}
public PoseBean getPose() {
return pose;
}
public void setPose(PoseBean pose) {
this.pose = pose;
}
public static class HeaderBean {
/**
* frame_id : /map
*/
private String frame_id = "/map";
public String getFrame_id() {
return frame_id;
}
}
public static class PoseBean {
/**
* w : 0.72508
* x : 0.00455891
* y : 0.0110448
* z : -0.688561
*/
private double w;
private double x;
private double y;
private double z;
public double getW() {
return w;
}
public void setW(double w) {
this.w = w;
}
public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public double getY() {
return y;
}
public void setY(double y) {
this.y = y;
}
public double getZ() {
return z;
}
public void setZ(double z) {
this.z = z;
}
}
}
public static class BasePositionBean {
/**
* header : {"frame_id":"/map"}
* pose : {"x":-5.56034,"y":0.543951,"z":2.96803E-4}
*/
private HeaderBeanX header;
private PoseBeanX pose;
public HeaderBeanX getHeader() {
return header;
}
public void setHeader(HeaderBeanX header) {
this.header = header;
}
public PoseBeanX getPose() {
return pose;
}
public void setPose(PoseBeanX pose) {
this.pose = pose;
}
public static class HeaderBeanX {
/**
* frame_id : /map
*/
private String frame_id = "/map";
public String getFrame_id() {
return frame_id;
}
}
public static class PoseBeanX {
/**
* x : -5.56034
* y : 0.543951
* z : 2.96803E-4
*/
private double x;
private double y;
private double z;
public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public double getY() {
return y;
}
public void setY(double y) {
this.y = y;
}
public double getZ() {
return z;
}
public void setZ(double z) {
this.z = z;
}
}
}
}
// {
// "op": "publish",
// "topic": "/move_base/goal",
// "msg": {
// "target_pose": {
// "header": {
// "frame_id": "/map"
// },
// "pose": {
// "z": -0.695688,
// "x": 0.000728705,
// "w": 0.71834,
// "y": 0.00213251
// }
// },
// "base_position": {
// "header": {
// "frame_id": "/map"
// },
// "pose": {
// "z": 0.00984454,
// "x": -0.0483838,
// "y": -0.00480753
// }
// }
// }
// }
}

@ -1,219 +0,0 @@
package com.jilk.ros.message.ros.nav;
import java.util.List;
/**
* Created by super_yu on 30/10/2017.
*/
public class Move_Base_Status {
/**
* status_list : [{"goal_id":{"id":"map_6_A_603","stamp":{"secs":1509348841,"nsecs":490135242}},"text":"Goal reached.","status":3},{"goal_id":{"id":"map_6_A_601","stamp":{"secs":1509348875,"nsecs":650002258}},"text":"This goal has been accepted by the simple action server","status":1}]
* header : {"seq":13516,"frame_id":"","stamp":{"secs":1509348876,"nsecs":156902566}}
*/
private HeaderBean header;
private List<StatusListBean> status_list;
public HeaderBean getHeader() {
return header;
}
public void setHeader(HeaderBean header) {
this.header = header;
}
public List<StatusListBean> getStatus_list() {
return status_list;
}
public void setStatus_list(List<StatusListBean> status_list) {
this.status_list = status_list;
}
public static class HeaderBean {
/**
* seq : 13516
* frame_id :
* stamp : {"secs":1509348876,"nsecs":156902566}
*/
private int seq;
private String frame_id;
private StampBean stamp;
public int getSeq() {
return seq;
}
public void setSeq(int seq) {
this.seq = seq;
}
public String getFrame_id() {
return frame_id;
}
public void setFrame_id(String frame_id) {
this.frame_id = frame_id;
}
public StampBean getStamp() {
return stamp;
}
public void setStamp(StampBean stamp) {
this.stamp = stamp;
}
public static class StampBean {
/**
* secs : 1509348876
* nsecs : 156902566
*/
private int secs;
private int nsecs;
public int getSecs() {
return secs;
}
public void setSecs(int secs) {
this.secs = secs;
}
public int getNsecs() {
return nsecs;
}
public void setNsecs(int nsecs) {
this.nsecs = nsecs;
}
}
}
public static class StatusListBean {
/**
* goal_id : {"id":"map_6_A_603","stamp":{"secs":1509348841,"nsecs":490135242}}
* text : Goal reached.
* status : 3
*/
private GoalIdBean goal_id;
private String text;
private int status;
public GoalIdBean getGoal_id() {
return goal_id;
}
public void setGoal_id(GoalIdBean goal_id) {
this.goal_id = goal_id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public static class GoalIdBean {
/**
* id : map_6_A_603
* stamp : {"secs":1509348841,"nsecs":490135242}
*/
private String id;
private StampBeanX stamp;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public StampBeanX getStamp() {
return stamp;
}
public void setStamp(StampBeanX stamp) {
this.stamp = stamp;
}
public static class StampBeanX {
/**
* secs : 1509348841
* nsecs : 490135242
*/
private int secs;
private int nsecs;
public int getSecs() {
return secs;
}
public void setSecs(int secs) {
this.secs = secs;
}
public int getNsecs() {
return nsecs;
}
public void setNsecs(int nsecs) {
this.nsecs = nsecs;
}
}
}
}
// {
// "status_list": [
// {
// "goal_id": {
// "id": "map_6_A_603",
// "stamp": {
// "secs": 1509348841,
// "nsecs": 490135242
// }
// },
// "text": "Goal reached.",
// "status": 3
// },
// {
// "goal_id": {
// "id": "map_6_A_601",
// "stamp": {
// "secs": 1509348875,
// "nsecs": 650002258
// }
// },
// "text": "This goal has been accepted by the simple action server",
// "status": 1
// }
// ],
// "header": {
// "seq": 13516,
// "frame_id": "",
// "stamp": {
// "secs": 1509348876,
// "nsecs": 156902566
// }
// }
// }
}

@ -1,37 +0,0 @@
package com.jilk.ros.message.ros.nav;
import java.util.HashMap;
import java.util.List;
/**
*
* Created by super_yu on 27/10/2017.
*/
public class NavPublich {
private List<String> wayPointsNames;
private HashMap<String, TMove_Base_Goal> navPublishHashMap;
public List<String> getWayPointsNames() {
return wayPointsNames;
}
public void setWayPointsNames(List<String> wayPointsNames) {
this.wayPointsNames = wayPointsNames;
}
public HashMap<String, TMove_Base_Goal> getNavPublishHashMap() {
return navPublishHashMap;
}
public void setNavPublishHashMap(HashMap<String, TMove_Base_Goal> navPublishHashMap) {
this.navPublishHashMap = navPublishHashMap;
}
public void clear() {
if (wayPointsNames != null) wayPointsNames.clear();
if (navPublishHashMap != null) navPublishHashMap.clear();
}
}

@ -1,402 +0,0 @@
package com.jilk.ros.message.ros.nav;
/**
* Created by super_yu on 30/10/2017.
*/
public class TMove_Base_Goal {
/**
* op : publish
* topic : /move_base/goal
* msg : {"header":{"seq":0,"stamp":{"secs":0,"nsecs":0},"frame_id":"map"},"goal_id":{"stamp":{"secs":0,"nsecs":0},"id":"map_6_A_601"},"goal":{"target_pose":{"header":{"seq":0,"stamp":{"secs":0,"nsecs":0},"frame_id":"map"},"pose":{"position":{"z":2.96803E-4,"x":-5.56034,"y":0.543951},"orientation":{"z":-0.688561,"x":0.00455891,"w":0.72508,"y":0.0110448}}}}}
*/
private String op = "publish";
private String topic = "/move_base/goal";
private MsgBean msg;
public String getOp() {
return op;
}
public String getTopic() {
return topic;
}
public MsgBean getMsg() {
return msg;
}
public void setMsg(MsgBean msg) {
this.msg = msg;
}
public static class MsgBean {
/**
* header : {"seq":0,"stamp":{"secs":0,"nsecs":0},"frame_id":"map"}
* goal_id : {"stamp":{"secs":0,"nsecs":0},"id":"map_6_A_601"}
* goal : {"target_pose":{"header":{"seq":0,"stamp":{"secs":0,"nsecs":0},"frame_id":"map"},"pose":{"position":{"z":2.96803E-4,"x":-5.56034,"y":0.543951},"orientation":{"z":-0.688561,"x":0.00455891,"w":0.72508,"y":0.0110448}}}}
*/
private HeaderBean header;
private GoalIdBean goal_id;
private GoalBean goal;
public HeaderBean getHeader() {
return header;
}
public void setHeader(HeaderBean header) {
this.header = header;
}
public GoalIdBean getGoal_id() {
return goal_id;
}
public void setGoal_id(GoalIdBean goal_id) {
this.goal_id = goal_id;
}
public GoalBean getGoal() {
return goal;
}
public void setGoal(GoalBean goal) {
this.goal = goal;
}
public static class HeaderBean {
/**
* seq : 0
* stamp : {"secs":0,"nsecs":0}
* frame_id : map
*/
private int seq = 0;
private StampBean stamp;
private String frame_id = "map";
public int getSeq() {
return seq;
}
public StampBean getStamp() {
return stamp;
}
public void setStamp(StampBean stamp) {
this.stamp = stamp;
}
public String getFrame_id() {
return frame_id;
}
public static class StampBean {
/**
* secs : 0
* nsecs : 0
*/
private int secs = 0;
private int nsecs = 0;
public int getSecs() {
return secs;
}
public int getNsecs() {
return nsecs;
}
}
}
public static class GoalIdBean {
/**
* stamp : {"secs":0,"nsecs":0}
* id : map_6_A_601
*/
private StampBeanX stamp;
private String id;
public StampBeanX getStamp() {
return stamp;
}
public void setStamp(StampBeanX stamp) {
this.stamp = stamp;
}
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public static class StampBeanX {
/**
* secs : 0
* nsecs : 0
*/
private int secs = 0;
private int nsecs = 0;
public int getSecs() {
return secs;
}
public int getNsecs() {
return nsecs;
}
}
}
public static class GoalBean {
/**
* target_pose : {"header":{"seq":0,"stamp":{"secs":0,"nsecs":0},"frame_id":"map"},"pose":{"position":{"z":2.96803E-4,"x":-5.56034,"y":0.543951},"orientation":{"z":-0.688561,"x":0.00455891,"w":0.72508,"y":0.0110448}}}
*/
private TargetPoseBean target_pose;
public TargetPoseBean getTarget_pose() {
return target_pose;
}
public void setTarget_pose(TargetPoseBean target_pose) {
this.target_pose = target_pose;
}
public static class TargetPoseBean {
/**
* header : {"seq":0,"stamp":{"secs":0,"nsecs":0},"frame_id":"map"}
* pose : {"position":{"z":2.96803E-4,"x":-5.56034,"y":0.543951},"orientation":{"z":-0.688561,"x":0.00455891,"w":0.72508,"y":0.0110448}}
*/
private HeaderBeanX header;
private PoseBean pose;
public HeaderBeanX getHeader() {
return header;
}
public void setHeader(HeaderBeanX header) {
this.header = header;
}
public PoseBean getPose() {
return pose;
}
public void setPose(PoseBean pose) {
this.pose = pose;
}
public static class HeaderBeanX {
/**
* seq : 0
* stamp : {"secs":0,"nsecs":0}
* frame_id : map
*/
private int seq = 0;
private StampBeanXX stamp;
private String frame_id = "map";
public int getSeq() {
return seq;
}
public StampBeanXX getStamp() {
return stamp;
}
public void setStamp(StampBeanXX stamp) {
this.stamp = stamp;
}
public String getFrame_id() {
return frame_id;
}
public static class StampBeanXX {
/**
* secs : 0
* nsecs : 0
*/
private int secs = 0;
private int nsecs = 0;
public int getSecs() {
return secs;
}
public int getNsecs() {
return nsecs;
}
}
}
public static class PoseBean {
/**
* position : {"z":2.96803E-4,"x":-5.56034,"y":0.543951}
* orientation : {"z":-0.688561,"x":0.00455891,"w":0.72508,"y":0.0110448}
*/
private PositionBean position;
private OrientationBean orientation;
public PositionBean getPosition() {
return position;
}
public void setPosition(PositionBean position) {
this.position = position;
}
public OrientationBean getOrientation() {
return orientation;
}
public void setOrientation(OrientationBean orientation) {
this.orientation = orientation;
}
public static class PositionBean {
/**
* z : 2.96803E-4
* x : -5.56034
* y : 0.543951
*/
private double z;
private double x;
private double y;
public double getZ() {
return z;
}
public void setZ(double z) {
this.z = z;
}
public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public double getY() {
return y;
}
public void setY(double y) {
this.y = y;
}
}
public static class OrientationBean {
/**
* z : -0.688561
* x : 0.00455891
* w : 0.72508
* y : 0.0110448
*/
private double z;
private double x;
private double w;
private double y;
public double getZ() {
return z;
}
public void setZ(double z) {
this.z = z;
}
public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public double getW() {
return w;
}
public void setW(double w) {
this.w = w;
}
public double getY() {
return y;
}
public void setY(double y) {
this.y = y;
}
}
}
}
}
}
// {
// "op": "publish",
// "topic": "/move_base/goal",
// "msg": {
// "header": {
// "seq": 0,
// "stamp": {
// "secs": 0,
// "nsecs": 0
// },
// "frame_id": "map"
// },
// "goal_id": {
// "stamp": {
// "secs": 0,
// "nsecs": 0
// },
// "id": "map_6_A_601"
// },
// "goal": {
// "target_pose": {
// "header": {
// "seq": 0,
// "stamp": {
// "secs": 0,
// "nsecs": 0
// },
// "frame_id": "map"
// },
// "pose": {
// "position": {
// "z": 0.000296803,
// "x": -5.56034,
// "y": 0.543951
// },
// "orientation": {
// "z": -0.688561,
// "x": 0.00455891,
// "w": 0.72508,
// "y": 0.0110448
// }
// }
// }
// }
// }
// }
}

@ -1,22 +0,0 @@
package com.jilk.ros.message.ros.net;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
/**
* Created by Administrator on 2017/5/22 0022.
*/
public class NetBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
// 如果相等的话就说明网络状态发生了变化
if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
int netWorkState = NetUtil.getNetWorkState(context);
}
}
}

@ -1,49 +0,0 @@
package com.jilk.ros.message.ros.net;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
/**
* Created by Administrator on 2017/5/22 0022.
*/
public class NetUtil {
/**
*
*/
private static final int NETWORK_NONE = -1;
/**
*
*/
private static final int NETWORK_MOBILE = 0;
/**
* 线
*/
private static final int NETWORK_WIFI = 1;
public static int getNetWorkState(Context context) {
// 得到连接管理器对象
ConnectivityManager connectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager
.getActiveNetworkInfo();
if (activeNetworkInfo != null && activeNetworkInfo.isConnected()) {
if (activeNetworkInfo.getType() == (ConnectivityManager.TYPE_WIFI)) {
return NETWORK_WIFI;
} else if (activeNetworkInfo.getType() == (ConnectivityManager.TYPE_MOBILE)) {
return NETWORK_MOBILE;
}
} else {
return NETWORK_NONE;
}
return NETWORK_NONE;
}
}

File diff suppressed because one or more lines are too long

@ -1,27 +0,0 @@
/**
* Copyright (c) 2014 Jilk Systems, Inc.
*
* This file is part of the Java ROSBridge Client.
*
* The Java ROSBridge Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Java ROSBridge Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
*
*/
package com.jilk.ros.message.ros.rosapi.message;
import com.jilk.ros.message.ros.message.Message;
import com.jilk.ros.message.ros.message.MessageType;
@MessageType(string = "std_msgs/Empty")
public class Empty extends Message {
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save