We meant to ask if code in
https://github.com/servo/devices/blob/d6c62e0873b2ec9a68c97a3370667e8b9a879cf4/src/bluetooth.rs#L276-L305
should
be split and the functions corresponding to say linux should be put in the
structure we created for implementing BluetoothAdapter for linux.

For example,

pub struct Bluez(Arc<BluetoothAdapterBluez>){
pub target_os: String,
pub feature: String
}
impl BluetoothAdapter for Bluez(Arc<BluetoothAdapterBluez){
fn BluetoothAdapter(&self){
pub fn new() -> Result<BluetoothAdapter, Box<Error>> {
                .......
    }
}
pub fn get_id(&self) -> String {
        get_inner_and_call!(self, BluetoothAdapter, get_id)
    }
 // code for just BluetoothaAdapterBluez
}

//Similarly for Mac/Android/Empty/BluetoothTest

-Niveditha Shankar

On Sat, Mar 30, 2019 at 11:40 AM Niveditha Shankar <nshan...@ncsu.edu>
wrote:

> Thank you!
> We meant to ask if code in
> https://github.com/servo/devices/blob/d6c62e0873b2ec9a68c97a3370667e8b9a879cf4/src/bluetooth.rs#L276-L305
>  should
> be split and the functions corresponding to say linux should be put in the
> structure we created for implementing BluetoothAdapter for linux.
>
> Sincerely
> Niveditha Shankar
>
> On Sat, Mar 30, 2019 at 12:26 AM Josh Bowman-Matthews <
> j...@joshmatthews.net> wrote:
>
>> That sounds like the right idea. I'm not quite sure what this question
>> is asking, however:
>>
>>  > Are we right in assuming that the current BluetoothAdapter function
>> has to
>>  > be broken for each component and put in the respective structure?
>>
>> If you are asking if code like
>>
>> https://github.com/servo/devices/blob/d6c62e0873b2ec9a68c97a3370667e8b9a879cf4/src/bluetooth.rs#L276-L305
>> should be distributed across the various trait implementations, then the
>> answer is yes.
>>
>> Cheers,
>> Josh
>>
>> On 3/28/19 8:23 PM, Sruthi Kannan wrote:
>> > Hello,
>> >
>> > I am a NC state graduate student working in the Refactoring Bluetooth
>> > support project with Niveditha.
>> > We went went through the documentation on traits. We arrived at the
>> > following approach and we just want to make sure we are doing it right.
>> >
>> > 1) Create an adapter.rs file. Define a trait object using a vector.
>> Create
>> > a structure, say DeviceType for the same.
>> >
>> > 2) Create individual structures for each component(like Android,Mac..)
>> and
>> > implement BluetoothAdapter function in each.
>> >
>> > 3) Make changes in the servo crate to call adapter.rs
>> >
>> > Are we right in assuming that the current BluetoothAdapter function has
>> to
>> > be broken for each component and put in the respective structure?
>> >
>> > Thank you.
>> >
>>
>> _______________________________________________
>> dev-servo mailing list
>> dev-servo@lists.mozilla.org
>> https://lists.mozilla.org/listinfo/dev-servo
>>
>
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo

Reply via email to