|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
|
4 * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "SmsMessage.h" |
|
7 #include "SmsService.h" |
|
8 #include "SmsSegmentInfo.h" |
|
9 #include "AndroidBridge.h" |
|
10 |
|
11 namespace mozilla { |
|
12 namespace dom { |
|
13 namespace mobilemessage { |
|
14 |
|
15 NS_IMPL_ISUPPORTS(SmsService, nsISmsService) |
|
16 |
|
17 NS_IMETHODIMP |
|
18 SmsService::GetSmsDefaultServiceId(uint32_t* aServiceId) |
|
19 { |
|
20 // Android has no official DSDS support. |
|
21 *aServiceId = 0; |
|
22 return NS_OK; |
|
23 } |
|
24 |
|
25 NS_IMETHODIMP |
|
26 SmsService::GetSegmentInfoForText(const nsAString& aText, |
|
27 nsIMobileMessageCallback* aRequest) |
|
28 { |
|
29 if (!AndroidBridge::Bridge()) { |
|
30 return NS_ERROR_FAILURE; |
|
31 } |
|
32 |
|
33 nsresult rv = AndroidBridge::Bridge()->GetSegmentInfoForText(aText, aRequest); |
|
34 NS_ENSURE_SUCCESS(rv, rv); |
|
35 |
|
36 return NS_OK; |
|
37 } |
|
38 |
|
39 NS_IMETHODIMP |
|
40 SmsService::Send(uint32_t aServiceId, |
|
41 const nsAString& aNumber, |
|
42 const nsAString& aMessage, |
|
43 bool aSilent, |
|
44 nsIMobileMessageCallback* aRequest) |
|
45 { |
|
46 if (!AndroidBridge::Bridge()) { |
|
47 return NS_OK; |
|
48 } |
|
49 |
|
50 AndroidBridge::Bridge()->SendMessage(aNumber, aMessage, aRequest); |
|
51 return NS_OK; |
|
52 } |
|
53 |
|
54 NS_IMETHODIMP |
|
55 SmsService::IsSilentNumber(const nsAString& aNumber, |
|
56 bool* aIsSilent) |
|
57 { |
|
58 NS_NOTYETIMPLEMENTED("Implement me!"); |
|
59 return NS_ERROR_NOT_IMPLEMENTED; |
|
60 } |
|
61 |
|
62 NS_IMETHODIMP |
|
63 SmsService::AddSilentNumber(const nsAString& aNumber) |
|
64 { |
|
65 NS_NOTYETIMPLEMENTED("Implement me!"); |
|
66 return NS_ERROR_NOT_IMPLEMENTED; |
|
67 } |
|
68 |
|
69 NS_IMETHODIMP |
|
70 SmsService::RemoveSilentNumber(const nsAString& aNumber) |
|
71 { |
|
72 NS_NOTYETIMPLEMENTED("Implement me!"); |
|
73 return NS_ERROR_NOT_IMPLEMENTED; |
|
74 } |
|
75 |
|
76 NS_IMETHODIMP |
|
77 SmsService::GetSmscAddress(uint32_t aServiceId, |
|
78 nsIMobileMessageCallback *aRequest) |
|
79 { |
|
80 // TODO: bug 878016 - Android backend: implement getSMSCAddress/setSMSCAddress |
|
81 return NS_OK; |
|
82 } |
|
83 |
|
84 } // namespace mobilemessage |
|
85 } // namespace dom |
|
86 } // namespace mozilla |