Impl sendFile
This commit is contained in:
parent
0bc9b754a4
commit
d73339e9e2
@ -154,6 +154,19 @@ public class Client {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int sendFile(String path, String receiver) {
|
||||||
|
Wcf.PathMsg pathMsg = Wcf.PathMsg.newBuilder().setPath(path).setReceiver(receiver).build();
|
||||||
|
Request req = new Request.Builder().setFuncValue(Functions.FUNC_SEND_FILE_VALUE).setFile(pathMsg).build();
|
||||||
|
logger.debug("sendFile: {}", bytesToHex(req.toByteArray()));
|
||||||
|
Response rsp = sendCmd(req);
|
||||||
|
int ret = -1;
|
||||||
|
if (rsp != null) {
|
||||||
|
ret = rsp.getStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
public void waitMs(int ms) {
|
public void waitMs(int ms) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(ms);
|
Thread.sleep(ms);
|
||||||
|
@ -35,5 +35,8 @@ public class Main {
|
|||||||
|
|
||||||
// 发送图片消息,图片必须要存在
|
// 发送图片消息,图片必须要存在
|
||||||
client.sendImage("C:\\Projs\\WeChatFerry\\TEQuant.jpeg", "filehelper");
|
client.sendImage("C:\\Projs\\WeChatFerry\\TEQuant.jpeg", "filehelper");
|
||||||
|
|
||||||
|
// 发送文件消息,文件必须要存在
|
||||||
|
client.sendFile("C:\\Projs\\WeChatFerry\\README.MD", "filehelper");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user